I have been able to read up to 8k messages per second at a bitrate of 1mb. This is when polling from the main loop, if using the event this does not work as well.
The only problem I’m running into right now is that at somepoint the controller.MessagesToRead property stays 0, even though there are definitely messages being sent on the bus (checked with my oscilloscope)
This happens when I try to process the messages after receiving them. All I do is take the data bytes and send them over a UDP socket to a computer. If I do this, I can process about 500 messages per second for a few seconds before the MessagesToRead property drops to 0. When it drops to 0, there is no error event triggered. It also never recovers from 0, only when I restart the microcontroller.
Things I tried to fix this but that had no results:
- Impedance on the bus is 59.9 ohm, perfectly within CAN spec
- I tried tinyclr 2.0 and 2.1p1
- I tried switching socket type to tcp instead of udp
I also noticed that when the CPU runs hot, the performance get’s worse. I had multiple times where it suddenly was unable to handle 100 messages per second and when I turned it off and let it cool down for a minute, it did 500 messages per second again (only to drop to 0 again after a few seconds).
The final thing I can note is that, when the MessagesToRead property is 0, the ReadErrorCount stays 0 and the CanReadMessage stays true.
So my question here is, is the MessagesToRead property going to 0 a bug or is it something wrong on my end?
I have uploader the project I’m using here so you can test and see if you can reproduce the problem. The TinyCLR version is 2.10 preview 1 and the used cpu is the SC20100S on a custom PCB.