pierremolinaro / acan2515

MCP2515 CAN Controller Driver for Arduino
MIT License
74 stars 29 forks source link

Default SPI on Pi Pico (RP2040) #33

Closed david284 closed 2 years ago

david284 commented 2 years ago

Wanting to use your library on a Pi Pico, sitting on a prebuilt circuit board that has an SPI device (MCP2515) on the 'default' SPI pins of the Pi Pico module (GPIO 16 - 19)

Unfortunately, the 'standard' Arduino SPI library uses GPIO2 - GPIO5 - I've proved this by running an SPI 'loopback' test And I see your library uses this library The default doesn't appear to allow you to redefine the pins used

Any idea how I can resolve this? (I'd rather not cut pcb tracks to re-work the physical pins)

I did get the SPI test working on the 'default' pins using instead of , as allows you to redefine the pins used, but the syntax of the SPI functions seems to be slightly different, and of course your library uses , so I don't see how that helps

If it's any use, here's the build info for the working test I mentioned using

` PLATFORMPLATFORM: Raspberry Pi RP2040 (1.5.0) > Raspberry Pi Pico HARDWARE: RP2040 133MHz, 264KB RAM, 2MB Flash DEBUG: Current (cmsis-dap) External (cmsis-dap, jlink, raspberrypi-swd)
PACKAGES:

david284 commented 2 years ago

Ok It seems the issue of not using the 'default' SPI pins is confined to earlier versions of mbed-core PlatformIO seems to be using version 2.6.1, but the Arduino IDE uses V2.8.0, which has the correct default pins

So, consider this a closed issue, as I can use the Arduino IDE, or I suspect I can manually edit the pins_arduino.h used in platformIO as a temporary measure until the version gets updated

pierremolinaro commented 2 years ago

Hello,

I have installed Arduino Mbed OS RP 2040 2.8.0, it is very instable on Mac (impossible to change monitor serial bit rate — crash). and I did not succeed to change default SPI pins.

Earle Philhower's board manager (https://github.com/earlephilhower/arduino-pico https://github.com/earlephilhower/arduino-pico) runs much better.

Best Regards,

Pierre

Le 15 mars 2022 à 17:55, david284 @.***> a écrit :

Ok It seems the issue of not using the 'default' SPI pins is confined to earlier versions of mbed-core PlatformIO seems to be using version 2.6.1, but the Arduino IDE uses V2.8.0, which has the correct default pins

So, consider this a closed issue, as I can use the Arduino IDE, or I suspect I can manually edit the pins_arduino.h used in platformIO as a temporary measure until the version gets updated

— Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan2515/issues/33#issuecomment-1068222057, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWKZVGNWXFH4OLGMPIIWQDVAC6IDANCNFSM5QYG46VQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you are subscribed to this thread.

david284 commented 2 years ago

Thanks for the comment about Earle Philhower's board manager - if I run into trouble with mbed I may try it