pierremolinaro / acan2517FD

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

Problem with SPI Communication #16

Open smellit opened 4 years ago

smellit commented 4 years ago

Dear all

I'm trying to set up a board using Microchip's MCP2518 controller (MCP2518FD CLICK Board) together with an Arduino Uno, but I can't get SPI communication working.

The example in ACAN2517FD\examples\LoopBackDemoArduinoUno\LoopBackDemoArduinoUno.ino seems to not be able to setup the SPI correctly.

Here a diagram of the SPI CLK (CH1) and SPI MOSI (CH2) using the example:

ACAN2517FD

As check I try the Arduino Barometric Pressure Sensor SPI example and here the SPI seems to be OK:

SPI_Example

Any suggestion how to proceed to find the root cause? Thanks in advance!

Ludwig

pierremolinaro commented 4 years ago

Hello,

Maybe it's a memory overflow: an Arduino has little memory. Try to reduce the size of the transmit and receive buffers: settings.mDriverTransmitFIFOSize = 0 ; // Should be >= 0 settings.mDriverReceiveFIFOSize = 1 ; //Should be > 0

Otherwise, post your code. Do you try to run one of the sample codes ?

Best Regards,

Pierre

Le 4 juil. 2020 à 09:11, Ludo <notifications@github.com mailto:notifications@github.com> a écrit :

Dear all

I'm trying to set up a board using Microchip's MCP2518 controller (MCP2518FD CLICK Board https://www.mikroe.com/mcp2518fd-click) together with an Arduino Uno, but I can't get SPI communication working.

The example in ACAN2517FD\examples\LoopBackDemoArduinoUno\LoopBackDemoArduinoUno.ino seems to not be able to setup the SPI correctly.

Here a diagram of the SPI CLK (CH1) and SPI MOSI (CH2) using the example:

https://user-images.githubusercontent.com/8124111/86506954-8462b800-bdd4-11ea-9ad3-b0623d5dbda2.gif As check I try the Arduino Barometric Pressure Sensor SPI example and here the SPI seems to be OK:

https://user-images.githubusercontent.com/8124111/86506955-84fb4e80-bdd4-11ea-8fd8-f28eeb9ba6e0.gif Any suggestion how to proceed to find the root cause? Thanks in advance!

Ludwig

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

pierremolinaro commented 4 years ago

And you use an MCP2518FD CLICK Board with an Arduino Uno : do you select +5V for VIO ?

Pierre

Le 4 juil. 2020 à 09:11, Ludo notifications@github.com a écrit :

Dear all

I'm trying to set up a board using Microchip's MCP2518 controller (MCP2518FD CLICK Board https://www.mikroe.com/mcp2518fd-click) together with an Arduino Uno, but I can't get SPI communication working.

The example in ACAN2517FD\examples\LoopBackDemoArduinoUno\LoopBackDemoArduinoUno.ino seems to not be able to setup the SPI correctly.

Here a diagram of the SPI CLK (CH1) and SPI MOSI (CH2) using the example:

https://user-images.githubusercontent.com/8124111/86506954-8462b800-bdd4-11ea-9ad3-b0623d5dbda2.gif As check I try the Arduino Barometric Pressure Sensor SPI example and here the SPI seems to be OK:

https://user-images.githubusercontent.com/8124111/86506955-84fb4e80-bdd4-11ea-8fd8-f28eeb9ba6e0.gif Any suggestion how to proceed to find the root cause? Thanks in advance!

Ludwig

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

soso49 commented 3 years ago

Hello, I've had a hard time setting the SPI com with my arduino UNO and a MCP2518FD click board. I haven't seen a clear wiring scheme yet so I'm sharing mine. image Make sure to remove the jumper on the 3.3V section and solder it on the 5V section. Note : With this specific wiring, the Slave Select has to be set on pin 10 of your Arduino.

pierremolinaro commented 3 years ago

Thank you very much, I will add this wiring scheme to the library documentation.

Best Regards,

Pierre

Le 23 oct. 2020 à 15:12, soso49 notifications@github.com a écrit :

Hello, I've had a hard time setting the SPI com with my arduino UNO and a MCP2518FD click board. I haven't seen a clear wiring scheme yet so I'm sharing mine. https://user-images.githubusercontent.com/73294829/97007471-bfcef100-1541-11eb-95e2-882647477e00.png Make sure to remove the jumper on the 3.3V section and solder it on the 5V section.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan2517FD/issues/16#issuecomment-715331995, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVHPGU7VS2T2IL52PS3SMF6MLANCNFSM4OQIYNWQ.

dost0011 commented 2 years ago

Hello, I have the same problem and can't find the solution. Arduino Mega 2560 Rev. 3 --> MCP2517FD click I have downloaded your lib and tried the example "LoopBackDemoArduinoUnoNoInt". I connected the CS to PIN 53 (and changed the code). I have used a Pullup 10kOhm.

Jumpers: VIO 5V STBY ON 40 MHz STBY SEL STBY

51 MOSI --> 6 SDI 50 MISO --> 5 SD0 52 SCK --> 4 SCK 53 CS --> 3 CS I checked the connections 1000 times.

The error is always 1 = kRequestedConfigurationModeTimeOut.

It looks, that SPI from Arduino Mega doesn't work. I tried settings.mDriverTransmitFIFOSize = 0 --> no effect.

I don't have any single idea... Could you help me? Many thanks...

dost0011 commented 2 years ago

One thing: is it normal that the voltage between CANL and CANH is 0V if nothing is connected?

dost0011 commented 2 years ago

Okay. now I'm one step further with a oscilloskop. CANL and CANH are 2.5V --> that's why the difference is 0v CLK, MOSI, CS are working. SDO is 0V the whole time. Does anybody know, how to wake up the SDO from the MCP2517FD?

pierremolinaro commented 2 years ago

Hello,

I have checked your connections, I think it is ok.

Did you change the the clock setting ? ACAN2517FDSettings::OSC_40MHz for a 40 MHz clock ?

Pierre

Le 22 mars 2022 à 14:00, dost0011 @.***> a écrit :

Hello, I have the same problem and can't find the solution. Arduino Mega 2560 Rev. 3 --> MCP2517FD click I have downloaded your lib and tried the example "LoopBackDemoArduinoUnoNoInt". I connected the CS to PIN 53 (and changed the code). I have used a Pullup 10kOhm.

Jumpers: VIO 5V STBY ON 40 MHz STBY SEL STBY

51 MOSI --> 6 SDI 50 MISO --> 5 SD0 52 SCK --> 4 SCK 53 CS --> 3 CS I checked the connections 1000 times.

The error is always 1 = kRequestedConfigurationModeTimeOut.

It looks, that SPI from Arduino Mega doesn't work. I tried settings.mDriverTransmitFIFOSize = 0 --> no effect.

I don't have any single idea... Could you help me? Many thanks...

— Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan2517FD/issues/16#issuecomment-1075148713, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVDDIFNV3CD7LKHM22TVBG76VANCNFSM4OQIYNWQ. You are receiving this because you commented.

pierremolinaro commented 2 years ago

I agree, CANH = CANL = 2.5V when the bus is IDLE.

Note the easy way for enabling the ATA6563 transceiver is to connect pins 1 and 2 of strap STBY.

Pierre

Le 22 mars 2022 à 16:30, dost0011 @.***> a écrit :

Okay. now I'm one step further with a oscilloskop. CANL and CANH are 2.5V --> that's why the difference is 0v CLK, MOSI, CS are working. SDO is 0V the whole time. Does anybody know, how to wake up the SDO from the MCP2517FD?

— Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan2517FD/issues/16#issuecomment-1075328099, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVGFXXQIY4NWSVOQ22DVBHRSJANCNFSM4OQIYNWQ. You are receiving this because you commented.