SC13 CAN bit timings


Is it possible that the bit timings on the documentation page listed for the CAN bus are incorrect for the SC13? I’m having some issues getting CAN to work on the SC13 and this is something I am suspecting.

I just checked the can.sourceclock property on the SC13 and it returns SourceClock = 40000000

The docs state:

Calculating the timing arguments with this calculater, give me a propagationphase1 of 13, phase2 of 2 and a prescaler of 10. The prescaler in the docs state 12

This does not solve my problem :frowning:

Im also subscribed to the error event but Im not getting any errors.

The can bit timing seemed to have been the issue.

I am having the same issue as I had when I first used the CAN on SC20. When the CAN buffer gets full, no new messages are accepted and the CAN peripheral stops working.

This happens when the buffer is at its maximum size - 3, so if I create a 128 size readbuffer it stops working when the buffer has 125 messages in it. With a buffer of size 256, it stops working when it has 253 messages in it.

The can peripheral does not recover from this.

  1. baudrate = (clock source / prescaler ) / (propagationphase1 + phase2 + 1).
  2. you need to read or clear message once counter = max -3.

I am continously reading the buffer, but the SC13 can not keep up with the message frequency of about 1K/sec.

I can’t make the SC13 any faster, so naturally, the buffer fills up.

Read and write or just read? Polling or use event to read?

Just read. When polling in main loop.

If I print can.messagestoread every loop cycle, I can see it rise to 125 and then it will go down from 125 to 0 and then it will stay at 0 forever because it stops accepting new messages. No error event is triggered either. All other devices on the bus do see the messages still.

This is the same as we had for the SC20100. This fixed it for the SC20100:

IntPtr add = (IntPtr)(0x4000A054);
var value = Marshal.ReadInt32(add);
value |= (1 << 2);
Marshal.WriteInt32(add, value);

We will check and back to this in shortly.

1 Like

CAN SC13 stop receiving data one get max -3 · Issue #1077 · ghi-electronics/TinyCLR-Libraries (

1 Like