pierremolinaro / acan2517FD

Distribution of Arduino driver for MCP2517FD CAN controller (CANFD mode)
MIT License
68 stars 17 forks source link

Problem with arduino due #39

Open Maaz-Sansare opened 1 year ago

Maaz-Sansare commented 1 year ago

I encountered a timeout error while attempting to run one of your example codes, specifically the loopback code, on an Arduino Due. In order to investigate the issue further, I decided to write a small program to configure and trigger the GPIO of the click board, and that seemed to work without any problems.

Now, I'm wondering if there are any specific configurations that I should be aware of when trying to configure CANFD using the Arduino Due. Could you provide me with some guidance on this matter? Alternatively, is it possible that the issue I'm experiencing is a result of a bug in the code or the system?

pierremolinaro commented 1 year ago

Hello,

I cannot build the same configuration, as I have no Arduino Due.

I have just understood that there is a small bug in my library. I have taken a look the MCP251863 datasheet DS20006624A). Section 4 is SPI clock speed, it should be less than or equal to 0.85 * (FSYSCLK/2). But my library is based on MCP2518FD datasheet ( DS20000000A) where section 4 says "The frequency of SCK has to be less than or equal to half the frequency of SYSCLK".

Can you change a line of the ACAN2517FD.cpp file in the ACAN2517FD library : line 351 : mSPISettings = SPISettings (inSettings.sysClock () / 2, MSBFIRST, SPI_MODE0) ; change to : mSPISettings = SPISettings ((inSettings.sysClock () * 2) / 5, MSBFIRST, SPI_MODE0) ;

Can you try this ?

Pierre

Le 8 juil. 2023 à 08:37, Maaz Sansare @.***> a écrit :

I encountered a timeout error while attempting to run one of your example codes, specifically the loopback code, on an Arduino Due. In order to investigate the issue further, I decided to write a small program to configure and trigger the GPIO of the click board, and that seemed to work without any problems.

Now, I'm wondering if there are any specific configurations that I should be aware of when trying to configure CANFD using the Arduino Due. Could you provide me with some guidance on this matter? Alternatively, is it possible that the issue I'm experiencing is a result of a bug in the code or the system?

— Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan2517FD/issues/39, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVDNYJDSVFEZZQNOTMLXPD53DANCNFSM6AAAAAA2CVFZFM. You are receiving this because you are subscribed to this thread.

Maaz-Sansare commented 1 year ago

same issue

Maaz-Sansare commented 1 year ago

May this help. I tried the ACAN2517 library loopback example code, and after a few resets, it started working with the same SPI settings as ACAN2517FD. mSPISettings = SPISettings (inSettings.sysClock () / 2, MSBFIRST, SPI_MODE0) ;