Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not spout esp32c3 HW SPI? #164

Open
wx85105157 opened this issue Jan 20, 2022 · 3 comments
Open

not spout esp32c3 HW SPI? #164

wx85105157 opened this issue Jan 20, 2022 · 3 comments

Comments

@wx85105157
Copy link

wx85105157 commented Jan 20, 2022

Arduino board: ESP-C3-13-Kit

Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.19

List the steps to reproduce the problem below (if possible attach a sketch or
copy the sketch code in too):
test graphicstest.ino

#define TFT_CS 1
#define TFT_RST -1
#define TFT_DC 0
#define TFT_MOSI 2 // Data out
#define TFT_SCLK 6 // Clock out
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);
it will work,but slow.

Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
use this code nothing happend.
GPIO2 is HW spi MOSI
GPIO6 is HW spi SCK

@wx85105157
Copy link
Author

Discovered using a logic analyzer,GPIO4 use by HW_SPI_SCK,GPIO6 use by HW_SPI_MOSI.
It's not match datasheet default pin func,

@wx85105157
Copy link
Author

After line 582 of the Adafruit_SPITFT.cpp file:
if (!freq)
freq = DEFAULT_SPI_FREQ; // If no freq specified, use default
Add the following code:
freq = 10000000;

After line 639:
hwspi._spi->begin();
Add the following code:
pinMode(3, OUTPUT);//spi clk
pinMode(4, OUTPUT);//spi mosi
gpio_matrix_out(3, 63, false, false);//spi clk
gpio_matrix_out(4, 65, false, false);//spi mosi
gpio_matrix_out(5, 0x100, false, false);
gpio_matrix_out(6, 0x100, false, false);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);

The LCD works perfectly on the hardware spi.

@ladyada
Copy link
Member

ladyada commented May 8, 2022

can you try again with the 2.0.3 ESP for arduino ide release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants