earlephilhower / arduino-pico

Raspberry Pi Pico Arduino core, for all RP2040 and RP2350 boards
GNU Lesser General Public License v2.1
2.09k stars 434 forks source link

RP2040 with MCP2515 libraries #1503

Closed albmaid closed 1 year ago

albmaid commented 1 year ago

Dear Earle,

Thank you very much for your GitHub repository. I am currently working on a project, and it has been extremely helpful! However, I am encountering several issues when trying to import other libraries into my project using the Raspberry Pi Pico Arduino core. I am attempting to communicate with an MCP2515 via SPI using the library found at https://github.com/autowp/arduino-mcp2515. I have observed with an oscilloscope that no signals are being generated on my Raspberry microcontroller (there is no signal present). I have also tried examining the internal code of this MCP2515 library to understand its behavior and attempt to replicate the SPI messages using the functions from your libraries, but I have not been successful. I believe I am still quite inexperienced in this area. It is strange because the codes compile without any errors, yet I do not see any output signals on the microcontroller.

If you could provide any kind of guidance or assistance to control a MCP2515 for Raspberry Pi Pico using your core I would greatly appreciate it!

Also I don't know if it's necessary or helpful but I am attaching a file with other code that works well with another Arduino board just as a correct usage example of the mcp2515 library.

I hope everything is going well for you and thank you for you work! Best regards.

mcp2515.txt

earlephilhower commented 1 year ago

Sorry, but there's nothing that we can do here. I don't have any CAN hardware or experience. I would suggest hooking up a debugger and single stepping through the code, or adding lots of Serial.printf()s to help trace things. Good luck.

maxgerhardt commented 1 year ago

Sanity check: Are you connecting to the right SPI pins? If the library uses the standard SPI object and you've set Tools->Board to the standard "Raspberry Pi Pico" (rpipico), then the SPI pins will be per

https://github.com/earlephilhower/arduino-pico/blob/fe3af4d98b09b151dc245daa4aab6f58c29c7bb7/variants/rpipico/pins_arduino.h#L17-L20

where as these are the "GP"-numbers that are also printed on the silkscreen.