View previous topic :: View next topic |
Author |
Message |
2xhp
Joined: 14 Jan 2019 Posts: 39
|
18F25K80 CAN Transmit issue |
Posted: Fri Dec 29, 2023 7:40 pm |
|
|
I'm using an 18F25K80 with PCH 5.105 and attempting to do what I've done before with this version of compiler and the same chip - even using the same basic code. I did change from the MCP2551 CAN transceiver to the MCP2561FD (which is working fine on a different MCU).
I'm scoping the transmit pin from the MCU, and getting a repeated pulse at 21.74 kHz.
If I don't transmit any messages from the MCU, there is no pulse.
I'm hoping this sounds familiar to someone and they can point me in the right direction. I'm a bit lost right now.
Thanks in advance! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Sat Dec 30, 2023 2:09 am |
|
|
First thing, is the oscillator the same as your previous version?.
The pulse time suggests possibly a speed problem.
What CAN bus rate are you using?.
Then how is pin8 wired?. Difference between the chips, the 2551 allows
a resistor on this pin to control the slope speed. The 2561 does
not support this.
What does the RX pin have on it?. With CAN, the RX receives what is sent.
If this is not happening the drive code will error and may behave as you
are seeing. |
|
|
2xhp
Joined: 14 Jan 2019 Posts: 39
|
|
Posted: Sat Dec 30, 2023 12:12 pm |
|
|
Hi Ttelmah - thank you for the response.
Your first question hit the nail on the head. I have used the same setup for so long that when I changed from the 10 MHz crystal to an 8 MHz oscillator, I didn't think to change the CAN timing registers. I did that.
My CAN bus rate is 500 kbaud.
Pin 8 (Standby) is tied to ground (standby mode disabled).
Rx pin was receiving what was sent.
I looked more carefully at the Tx pin waveform on the scope and after measuring, see it is not rising to the 5 V Vdd value - only getting up to about 3.5 V. The 2561 does have a pullup on the Tx line. I added another 10 k to Vdd which did bring it nearly to the 5 V, but still no luck. I then tried setting CAN_ENABLE_DRIVE_HIGH to 1 and that got it working.
So in summary, I did the following:
Set the CAN timing registers
Set CAN_ENABLE_DRIVE_HIGH to 1
I'm just stumped now why I need CAN_ENABLE_DRIVE_HIGH set to 1. With the pullup resistor, it doesn't seem that should be necessary. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Sun Dec 31, 2023 10:56 am |
|
|
Glad you got it working.
10K is a rather large resistor for a signal clocking at 500KHz. Depending
on the line capacotance the rise tme may be too slow without the active
drive.
If you look Vih of the older transceiver is 2v. For the new one 0.7Vdd.
Huge difference in how high the signal needs to go!.... |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1909
|
|
|
|