G120 Can Bus sample point

Hi everyone, I’m looking for help trying to solve this issue.

I’m using a G120 with the latest GHI libraries (4.3.6.0)

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)

Thanks in advance for all your help

I must be blind! ::slight_smile:

I have found the timings parameter in the constructor and also a property that has it.

Any advice using your expertise to get it to work at 500K with a sample point of 87.5% aprox?

There is still the issue of the error recovery for BusOff, any ideas?

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;
  • poor termination;
  • different CAN drivers that sometimes prefer different voltage level on the bus;
  • star-like bus topology.
1 Like

A ControllerAreaNetwork.reset in the ErrorReceived event should do the trick.
(If the external fault was fixed)

1 Like

Thanks Simons, my network has only 2 devices in a Canopen port that I made from a C# code.

Network master is a Canusb device (LAWICEL CANUSB | canusb.com) and the slave is the G120 connected to a transceiver sn65hvd230 (SN65HVD230 data sheet, product information and support | TI.com), bus is terminated in both ends with a 120ohm resistor in a 30mts twisted pair wire.

Like I have said before is not always but I get one BusOff error every hour or so.

I will check the usb device specs to see if there is something.

Thanks David, I will check on this and let you know

David@ Emrol thanks for that it works.

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.

@ Mogollon - There are some effective methods to suppress lots of EMC noise.

1 Like

Hey David, thanks for that. I’ll check it out and report my findings