4.0 Flexcan with Interrupts Library

bigboosted

Well-known member
Hi, I'm wondering if the 4.0 has a Flexcan with Interrupts library available yet? I'm Just looking for Can 2.0, not FD.


Enjoying a Collin Flexcan Library for 3.6 with Interrupts, and wanting to move up into 4.0.


Thanks!
 
There is on the forum thread, just got my PC fixed so I'm going to upload one soon today after a github update

EDIT, I added a FIFO Interrupt demo, you can view it on the github site
 
Last edited:
There is on the forum thread, just got my PC fixed so I'm going to upload one soon today after a github update

EDIT, I added a FIFO Interrupt demo, you can view it on the github site

Thank you very much tonton! Looking forward to giving it a try! This will work on the 3.2 and 3.6 also correct?
 
Yes, Teensy 3.2,3.5,3.6,4.0

I had a chance to play with it today. Very Awesome! Thanks again for sharing this with us!

One thing I noticed is the msg.flags.overrun never changes from 0 even when I push more messages then it can handle.
Maybe I misunderstand but if I send more messages then it can handle it will overrun?

Thanks for any help explaining stuff so I can better understand.


Edit; Also as a note I will never need to run a can bus this fast anyway so its kinda a moot point. Also, I might be trying to send more messages than the bus can handle and they are not actually sending. My can bus knowlege is limited.
 
Last edited:
The overrun is a per mailbox flag that is set per message. It is very rarely seen sent unless the traffic is overloading the mailboxes (not necessarily the bus). But because the ISR queues and frees the mailbox as fast as possible it's able to pull the next message in without being overrun. If you decide to do non-interrupt, polling mode, considering loop delays, then you may see the overrun flag appear in a message. Also keep in mind that only the last mailbox will overrun in many mailboxes accept the same frame.

Example, with interrupts off, and not reading the mailboxes, lets say you have 8 reception mailboxes accepting the same frames.
The first 7 would occupy a message but the 8th is a bit different (actually, its always the last one that does). If 8th is also full, and the next message comes in from the SMB (serial message buffer holding next frame to drop into a mailbox, done via hardware), flexcan will see the 8 mailboxes full, however, ONLY the 8th mailbox will be overwritten with the new frame and the overrun flag would be set. The other mailboxes will not be shown as overrun, so when you read their frames they wont be set.
 
Back
Top