[Resolved] 18F4680 eCAN 20Mhz - BRGCON1/BRGCON2/BRGCON3
I spent a few hours last night trying to set BRGCON1/BRGCON2/BRGCON3 registers to send and receive CAN at a Baud rate of 1Mbps.
I have managed for a few years successfully send out and receive at 500kbps, but I have now a device that needs a 1Mbps rate. I am using a PIC18F4680 with a 20Mhz External OSC
My previous set up for 500kbps is, Using the ECAN Library;
ECAN_BRP VAL 1
I think I got these values along time ago, from either from a utility tool or working it out, I know I did have alot of issues trying to identify and work these values out but in the end I managed it.
So, this is great, I have the 500kbp working and have been for a few years, trying to test to get the 1Mbps working is proving difficult, I know the success is also determined on the OSC Speed but a 20Mhz OSC, should be sufficient, I believe!
SO I have sat there for hours and worked out (Obviously wrongly) that for a 1Mbps should be;
ECAN_BRP VAL 0
When looking at the CANbus on the Scope, it seems ok and seems to have a nice valid wave form, but when trying to read it via CANalyser at 1Mbps, all I reading is error frames... I would image I have not set up the timings correctly, can anyone help me? And if someone can help me with the math so I actually fully understand it for next time that would be great.
The hardware is fine as it was working with 500kbps, the ability to read 1Mbps was ok because I was able to read the other device at this speed.. I know it's my timing set-up.
Thanks in advise and stay safe all.
post edited by huttojb - 2020/06/04 06:18:08