The 0x denotes hexadecimal notation, which is typically used for ID and Byte data. However, the decimal equivalent is equally valid. For example, ID=0x3EA is the same as if you wrote ID=1002. Therefore you can't simply drop the "0x" without...
Yep, that's the bare minimum to create a message. If you need to shorten the data length, you can use the msg.len property. If you don't specify the length, it defaults to 8 bytes.
I'm glad that helped. Good catch on copying the frame in the callback.
Yes. enableFIFOInterrupt() instructs FlexCAN to call the callbacks you specify with onReceive(). Without that, gotFrame1() and gotFrame2() will never be processed.
The onReceive() function can't be used to separate messages by ID, as you are trying to do. It can only be attached to mailboxes or the FIFO.
In setup(), attach your callback to the FIFO like this:
Can0.enableFIFO()...
Hi Gef
Those expansion devices over I2C will not be much good at all for analog signals. They are really suitable for low speed digital IO. There are SPI versions of these devices available that can obviously increase the update bandwidth...
@skpang @msadie
Oh my god... Thank you so much you two. I feel really dumb for making such a mistake!
I cant believe it was something so simple.
I was searching for this for ages and couldnt find the sollution. I was almost sure, that I had a...
SK Pang is correct regarding the clock. I ran your code with a MCP2558FD transceiver and Vector CANalyzer. Red lines are CLK_80MHz, black are CLK_24MHz.
Nothing in your code stands out to me as incorrect. Is the bus properly terminated with 120ohms at each end? What do you see if you scope the TX and RX lines?
FWIW, you can operate CAN over very short distances without transceivers.
It is absolutely critical that you use a 3.3v source instead of the 5v shown!
https://www.mikrocontroller.net/attachment/28831/siemens_AP2921.pdf