Hi everyone, I’m looking for help trying to solve this issue.
I’m using a G120 with the latest GHI libraries (184.108.40.206)
I’m porting a C# stack of Canopen and it is working good but sometimes I get a busoff error and the system stops communicating.
I’m trying to check the communication parameters and the first one to look at is the sample point, canopen recommend that it should be between 85% and 90%, how do I calculate the sample point with the new library?
When creating a Controller Area Network object the constructor takes only the channel and speed, these two are enums.
In the previous library we can calculate these parameters and pass it along when creating the can object, now I can’t find a way to do that.
How can I calculate and possibly change the parameters that has something to do with the sample point in the new library? (BRP,PROP,PHASE1,PHASE2,SJW)
Is there any way to recover from the busoff error? (only a reboot is working for me)
You don’t get Bus Offs in a healthy bus. If you’ve got Bus Offs, it means your CAN bus is flawed, and there is a device that tries to send a messages and it repeatedly fails. Check for the issues like:
different devices using different timings;
different CAN drivers that sometimes prefer different voltage level on the bus;
Simon thanks a lot, some others post have help me out to figure out my settings, the CAN bus is more stable now. I’m having a few disconnect/crashes when using a 30mts wire in a very noisy environment and I think is my actual developing board that gets overwhelmed because the EM emissions.
I will do one more test with some protection on it.
Just for everyone else that may be looking for a similar issue this is what I have found:
1.- Seems like the equation for the G120 is (unconfirmed):
NominaBitTime x DeviceClock = (BRP+1) x (3 + T1 + T2 + Propagation)
To figure this values I have used the current timings for 500Kbps, they are:
BRP = 5, T1 = 15, T2 = 8, Prop = 0
At 500Kbps Nominal Bit Time is 2uS, so the device clock is 78Mhz.
Sample point with this settings is 62.22%
Canopen requires it to be between 85% and 90%, so I have used the device clock to calculate one in that range (T1/(T1+T2) * 100).
To match 87.5% I’m using T1=14 T2=2, as a result BRP should be 7.21, because has to be integer I have tested 7 and it works.
The clock of 78Mhz doesn’t make too much sense to me 156Mhz / 2 (PLL Divisor), so I think it should be more like 60Mhz but doing the same maths with 60Mhz just doesn’t work.