PIC18F2680 ECAN Stuck in Config Mode
I've used this exact micro about 8 years ago on a couple different projects with a common architecture and a few unique I/O features. I never had a problem with the CAN module, but I did use a different CAN transceiver with an opto-isolator between the 18F and the transceiver.
At any rate, rather than learn one of the newer controllers with multiple CAN controllers, I decided to design a module with two of these 18F2680s, each with its own CAN transceiver, and connected to each other via SPI without chip select. Figured I could easily re-purpose old code and save some development time.
I used my old code as a framework for starting the code in each micro, and in fact used SPI in the past for a DAC channel output. For whatever reason, I'm not able to get the CAN module out of config mode. So far I've only been debugging the "slave" micro, but neither micro appears to be online on its respective CAN bus, which makes me think I may have a coding problem. There are no error frames present on the bus, but as I said, the CAN controller is stuck in config mode.
I've taken the normal considerations in my previous projects and carried over to this:
- CANRX pin is configured as an input (RB3)
- CANTX pin is configured as an output (RB2)
- 10Mhz xtal oscillator with HSPLL to run at 40 MHz
- same bit rate as in previous project - 500kbps, using BRP = 3, PROP=3Tq, PH1 = 4Tq, PH2 = 2Tq, SJW=2
- PIE3=0 --> no CAN interrupts being used
While there are no pin conflicts, I'm considering trying to initialize CAN before setting up the SPI port and see how that does. I've noticed that if I set the bit to Abort Messages being transmitted in the CANCON, the bit never gets cleared. So, I've changed my code to never set that bit when I'm initializing the BAUD, TX, RX, filter and mask registers. I can't explain why that bit gets stuck, but it seems like it could be related to getting stuck in config mode.
I'm using the TLE6250G at 5V - used a 251 in the past.
Should I try pull-ups on CANRX (TLE6250 contains weak pull-ups)? I'm driving CANTX to 5V in the recessive state by setting the appropriate bit in CIOCON.
Any suggestions would be appreciated. I plan on getting on a scope soon and see what is going on between the micro and transceiver. My project deadline is nearing, and I don't have a backup plan.
Thanks in advance for your help!