Flexcan bugs and limitations

xxxajk

Well-known member
I've found FlexCAN to work, but not as solid as it could be.

  • There is no possible way to do a write that times out, and aborts the transmission.
    Unplug the cable and your sketch will think it is sending stuff. It will stuff the buffer, and there is no way to send any more messages since none of them ever expire.
  • There is no way to avoid the buffer if you want to do a priority/out of band write. One mailbox could be a priority only for TX.
  • There is a potential for the IRQ to want to use the same TX buffer as write does, causing a collision.
  • There are some possible useful interrupts that are dismissed entirely. I'll see how useful they are as I go along.

I'll make yet another fork, fix these problems. These are all that I have currently found.
I need a good CAN lib in order to upload from a teensy 3.2 to a FSL MKE device using the built-in FSL ROM bootloader, and I *REALLY* don't like serial/SPI/I2C for this. So I've decided to share it once I have it going.

@Paul you will be welcome to pull the fixes into the main library. I'll post again once these are fixed with the github URL. :cool:
 
Thanks. Let me know what you come up with?

CAN has been on my todo list for a long time, and keeps getting pushed to lower priority by other stuff.

Long term, we need a good CAN library API... and we really need to get some agreement on a common API between the various boards with CAN controllers. Sadly, it seems the Arduino devs aren't very eager to talk about APIs lately. I was really hoping they would take the lead on such things, but it seems unlikely.
 
Yeah. Expect some reformatting to the code too. It not only looks horrible, but it also has loads of trailing spaces, tabs, all sorts of ugliness in it.
All I need to do now is find out why the reset line on the MKE chip here is yanking super low. No matter what I do, I can't seem to pull it out of reset, and nothing is shorted out.... I may have to replace the chip :-/
 
Houston, we have communication with the Freescale ROM!
Code:
CAN0 ID: 123 Data: 5A A7 
CAN0 ID: 123 Data: 00 02 01 50 00 00 AA EA 
CAN0 ID: 123 Data: 5A A7 
CAN0 ID: 123 Data: 00 02 01 50 00 00 AA EA
:cool:

I Still need to do more to validate, but, Just thought I would let you all know my progress with the library thus far.
 
If you're going to reformat the source code, please do so as a separate pull request which makes zero changes other than white space.
 
Back
Top