CLR_E_BUSY during fast CAN write


This worked fine with the last release (preview 6), but now when trying to send precisely timed CAN packets I get the following exception. Not sure how I can run this one down.



I have attempted to wrap in a try catch / loop but it continues to fail.



Check connection, timing… any changed? Busy mean the tx fifo is full, somehow all tx message couldnt be sent.

Connection and timing are fine, as all other CAN interactions work fine. It’s only when I send at a high (but precisely timed) rate.

What’s the TX FIFO size? I will loop when it’s full (with timeout)

16 msg in fifo.

1 Like

Checking the MessagesToWrite property before the failure, it is reporting 0

That would indicate the failure is not due to the TX FIFO being full correct?

No, MessagesToWrite come from our internal buffer, not Fifo buffer.

You can check Fifo by the code below before send:

       static bool IsFifoFull(string canController)
            var reg = canController.CompareTo(SC20260.CanBus.Can1) == 0 ? (IntPtr)0x4000A0C4 : (IntPtr)0x4000A4C4;

            var v = Marshal.ReadInt32(reg) & (1 <<21);

            return v != 0;

That worked perfectly! Thank you!

1 Like