khoih-prog / RP2040_SD

This library enables you to use SPI SD cards with RP2040-based boards such as Nano_RP2040_Connect, RASPBERRY_PI_PICO using either RP2040 Arduino-mbed or arduino-pico core. This SD-Fat v2 can support FAT16, FAT32, exFAT file systems. exFAT supports files larger than 4GB by using uint64_t as file offset.
MIT License
37 stars 11 forks source link

Library not work in SPI1 only works in SPI0 #3

Closed AndresBellero74 closed 2 years ago

AndresBellero74 commented 2 years ago

My question is simple, I need it to work on SPI1, so I see I change the pins and it doesn't work, only on SPI0 is it possible to make it selectable? Thank you so much.

khoih-prog commented 2 years ago

Your question is too vague: no core, no board. I don't think I'll answer this type of question next time

Anyway, check RASPBERRY_PI_PICO pins_arduino.h#L44-L48 and see ArduinoCore-mbed core only support 1 SPI

// SPI
#define PIN_SPI_MISO  (4u)
#define PIN_SPI_MOSI  (3u)
#define PIN_SPI_SCK   (2u)
#define PIN_SPI_SS    (5u)

while as in rpipico pins_arduino.h#L17-L26, arduino-pico core can support 2 SPIs

// SPI
#define PIN_SPI0_MISO  (16u)
#define PIN_SPI0_MOSI  (19u)
#define PIN_SPI0_SCK   (18u)
#define PIN_SPI0_SS    (17u)

#define PIN_SPI1_MISO  (12u)
#define PIN_SPI1_MOSI  (15u)
#define PIN_SPI1_SCK   (14u)
#define PIN_SPI1_SS    (13u)

In order to use something special and custom, it requires some more research, even some modifications done by yourself.


Moreover, check Library's Features

This library was created as an effort to use SD Card while the arduino-pico core still has issue SD card FILE_WRITE issue #214, which has been fixed from core v1.8.6.

It's better to use the built-in SD library for Earle Philhower's arduino-pico core v1.8.6+.

But if you need to write codes to be used in both Arduino-mbed RP2040 core and Earle Philhower's arduino-pico core without having to modify the code, you can have the option to use this library.

AndresBellero74 commented 2 years ago

Thank you very much for the answer, I installed the pico core and the problem was solved. I already read the SD now I have to see how to make the BMP visualize me but it is with another library. It served me a lot. sorry for not giving you more info. I still can't see the bmp but I rescue the attributes, which is a problem with my program that reads the BMP file. Regards. WhatsApp Image 2021-11-09 at 22 20 10

khoih-prog commented 2 years ago

I'm glad you've solved the issue and appreciate you post the good result / experience, which will also help many other users

Regards,

AndresBellero74 commented 2 years ago

Thanks to your help and the author of the tft_espi library for the raspberry pico I was able to play BMP files with the SD and on the 3.5 "display of the raspberry pi. I'll pass it to you in case anyone is interested. This is the project link: https://github.com/AndresBellero74/Raspberry-PI-PICO-display-RPI35 Regards.