adafruit / Adafruit-ST7735-Library

This is a library for the Adafruit 1.8" SPI display http://www.adafruit.com/products/358 and http://www.adafruit.com/products/618
https://learn.adafruit.com/1-8-tft-display
547 stars 303 forks source link

not spout esp32c3 HW SPI? #164

Open wx85105157 opened 2 years ago

wx85105157 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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