Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 8 of 8

Thread: 4.0 Flexcan with Interrupts Library

  1. #1

    4.0 Flexcan with Interrupts Library

    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!

  2. #2
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,337
    FlexCAN_T4: https://github.com/tonton81/FlexCAN_T4

    It works on all T3 and T4.0 boards

  3. #3
    Is there a Example on how to use Interrupts with that Library?

  4. #4
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,337
    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 by tonton81; 02-22-2020 at 06:51 PM.

  5. #5
    Quote Originally Posted by tonton81 View Post
    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?

  6. #6
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,337
    Yes, Teensy 3.2,3.5,3.6,4.0

  7. #7
    Quote Originally Posted by tonton81 View Post
    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 by bigboosted; 02-23-2020 at 02:53 AM.

  8. #8
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,337
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •