I want to connect a ST7789 1.3 oled display (240x240) to this module.
My display board does not have CS pin, so I understand that I should initialize the display with:
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);
tft.init(240, 240, SPI_MODE3);
But I don't know which pins I have to use for SCL and MOSI on esp32-c6 supermini.
How can I find the correct pins ?
But all I get is a resetting black screen.
The display receives power I can see its backlit but there is nothing on the display.
what am I doing wrong ?
when I change the SCL to 9 and MOSI to 6 , screen turns white after black.
If I change SCL to 9 and MOSI to 8 , screen stays black BUT the onboard led turns on (first green then white)
interesting ?
But I really don't prefer to use that PIN 21.
Can I change it to something else ?
Why doesn't the following command work:
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);
Find and read the datasheet for the display, the esp32. Check github for any documentation. The easiest way is to open Library Manager, find the library and beside the name is 3 periods. Click that and navigate to the example sketches.
If that doesn't work your wiring is wrong do post the entire sketch and a hand drawn wiring diagram.
if I don't set MOSI and SCK manually, it defaults to 19 and 21 and if I wire to these ports , it works fine.
I just don't prefer to use the PIN 21.
How can I change SCK to another PIN ?
Probably in the begin or init methods, but if I can't see the code I can't tell you. Look at the begin and init member functions in the library, or just hover the cursor over the begin or init statement. You may need to do a compile first, and it won;t hurt to do a highlight the library hdr and rt click then goto definition. I am including the goto definition screen grabs. The last one is the read-only tab now open in your sketch.
I really didn't understand what you meant. Did you read what I wrote ?
Code works. If I don't set the MOSI and SCK explicitly in Adafruit_ST7789 definition, and if I use PINS 19 & 21 it WORKS.
I am asking if it is possible to change the default PINS (19 and 21) because you wrote above:
"but I bet this is a modern board and almost any pin can be used."
it is not a fake clone. All pins are working. I can use pins 3,4,5,6,7,8,9 for other purposes. But when I set SCK or MOSI to one of these PINS , it does not work.
Maybe the library needs some other option to be set.