maxgerhardt / platform-raspberrypi

Raspberry Pi: development platform for PlatformIO
Apache License 2.0
94 stars 46 forks source link

SPI1 on SD #55

Closed BaTaTaAdb closed 2 months ago

BaTaTaAdb commented 4 months ago

When using the SD library, the compiler uses the arduino SD library, which doesn't have the overflow version begin(uint8_t csPin, uint32_t cfg = SPI_HALF_SPEED, HardwareSPI &spi = SPI) which I need in order to have it on SPI1 (correct me if I'm wrong).

This is the part of my code that is giving me the error if (!SD.begin(CS_SPI, SPI1)). How do I override the arduino library with the custom board library to be able to use SPI1 on my board? SPI1 is necessary in my case.

platformio.ini: [env:pico] platform = https://github.com/maxgerhardt/platform-raspberrypi.git board = pico framework = arduino board_build.core = earlephilhower board_build.filesystem_size = 0.5m lib_deps = olikraus/U8g2@^2.35.9 adafruit/Adafruit Unified Sensor@^1.1.14 adafruit/Adafruit BNO055@^1.6.3 adafruit/Adafruit BME280 Library@^2.2.4 adafruit/Adafruit GPS Library@^1.7.4 If you need more info, let me know.

maxgerhardt commented 2 months ago

What's the "Overflow version"?

Arduino-Pico's SD library does allow you to use whatever SPI port you want. If it uses a different SD library, use lib_ignore against the undesired one.

https://github.com/earlephilhower/arduino-pico/blob/master/libraries/SD/src/SD.h#L39-L42

BaTaTaAdb commented 2 months ago

This question was made almost 2 months ago, so I don't quite recall all the details. The problem was that platformio wasn't recognizing any of pico libraries. I'm not quite sure what fixed it, but I remember that at some point I just created a customSD library that was a copy of the pico SD library.