B4R Question Can rAdafruit_ST7735 and rSD be used in the same project?

Gerardo Tenreiro

Active Member
Licensed User
Hello
I have an ESP32 application where I need to use the rAdafruit_ST7735 version 1.00 library and the rSD version 1.21 library and problems arise.

If I use each library separately everything works correctly, however when I try to use both libraries it stops connecting rSD, it does not detect the card

I initialized the rAdafruit_ST7735 library with HARD like this:
' Inicializa los Pines para el Display
CS_Oled.Initialize ( 5,CS_Oled.MODE_OUTPUT) ' Pin CS del Display
RS_Oled.Initialize ( 2,RS_Oled.MODE_OUTPUT) ' Pin A0 del Display
MOSI.Initialize (23,MOSI.MODE_OUTPUT) ' Pin MOSI del Display
RST_Oled.Initialize (15,RST_Oled.MODE_OUTPUT) ' Pin RST del Display
CLK.Initialize (18,CLK.MODE_OUTPUT) ' Pin CLK del Display

' Inicializa la Libreria
Oled.InitializeHardware(CS_Oled.PinNumber,RS_Oled.PinNumber,RST_Oled.PinNumber,2)
'Oled.InitializeSoftware(CS_Oled.PinNumber,RS_Oled.PinNumber,MOSI.PinNumber,CLK.PinNumber,-1,2)

I initialized the rSD library like this
SD_CS.Initialize(13,SD_CS.MODE_OUTPUT) ' Inicializa PIN de como Salida Digital
SD.Initialize(SD_CS.PinNumber) ' Inicializa SD
In the compilation there is no error and apparently everything is correct, but the library returns FALSE when initializing it

Some suggestion.
Thank you so much
 

Gerardo Tenreiro

Active Member
Licensed User
Without knowing the values of your constants it is a little difficult.
Sorry for not specifying the data
Both use the same SPI bus, the bus pins are
CLK -> 18
MOSI -> 23
RST -> 15
CS_TFT -> 5
RS_TFT -> 2
the SD has the CS -> 13

The TFT always works correctly, the problem is in this code that returns FALSE when starting the SD library.

If SD.Initialize(SD_CS.PinNumber) = True Then

The same code in another project that does not use the Adafuir_ST7735 library works correctly.

If you need any more information, do not hesitate to tell me and I will send it immediately.

Thank you so much
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Are both devices being used in SPI mode?
have you tried changing the CS (Chip Select) Pin?
It seems to me that it is being caused by the fact that both devices are maybe sharing the same CS and thus conflicting.
 
Upvote 0

Gerardo Tenreiro

Active Member
Licensed User
Are both devices being used in SPI mode?
have you tried changing the CS (Chip Select) Pin?
It seems to me that it is being caused by the fact that both devices are maybe sharing the same CS and thus conflicting.
The CS of the TFT is: 5
The CS of the SD is: 13
They are different CS in both, the only thing they share is the SPI BUS lines
CLK = 18
MOSi = 23
MISO = 19

I have the SD example and it works correctly.
Law in the ARDUINO PHOTO and use version 1.1.19 and have no problems,
Could it be because of the rAdaFruit version?
Thanks
 
Upvote 0
Top