Building a CAN API for Arduino DUE

Hello,

First, thank you all for your job, especially Palliser and AdderD !

I checked this topic from time to time and today I started to test the CAN on my Arduino DUE ! :slight_smile:

So I make here a first feedback of my first tests, in order to give some information and ask more questions...

First remark, I'm not a Github user, and I don't know how to download the CAN part of the official version, so I used the AdderD's version, which is available in a zip format (thanks).

So I just put the librairy in my directory and started to compile : OK.

About the hardware part, expecially the transceiver. I will also order the same SN65HVD234 as you, but at the right time I have one another kind of transceiver : MCP2551. It is a 5V transceiver, but I wanted to test it. its advantages : it is cheap and available in the "old fashion soldering", I don't know the word ("traversant" in french), I mean that you can easily solder it with you big figers and basic iron.

As it si 5V, of course it's better to put a Zener diode on the CanRx pin. And for the Tx, we hope that the 3.3v signal will be enough.

And the answer is.. yes, it seems to work fine.
With an oscilloscope I checked that 3.3v signal coming out of the Due is well transformed in differential tension.

Now, About first functionnal test.
My first test is the "Example1" delivered with AdderD librairy.
To understand a little bit more what I was sending I set CAN_MSG_DUMMY_DATA at 0.
So then I sent for example "250" from the serial port, and I got a communication with the result :
"CAN message received= 2500000000"

So display may be strange but it seems to work.

But I tried more values and I noticed that it works well only for value under 255... ?
Here is some examples of what I get :
250 => 2500000000
256 => 01000000
257 => 11000000
258 => 21000000
3000 = > 18411000000
65535 => 255255000000
65536=> 00100000

Do you have the same ? isn't it juste a problem of data interpretation or display?
I haven't yet looked insided the code, please give me your opinion about this.