-
Notifications
You must be signed in to change notification settings - Fork 58
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
Can not auto reset on my board #25
Comments
The reset timing may be different for each TFT. |
I find the 100 ohm pull up weird.. Its an active low signal and if I measure the level when not asserted it is 3.3V. Secondly, with the 100 Ohm pull up the esp32 needs to sink at least 33mA to pull the signal low (active low to reset), this feels high. The documentation (but it is not very clear) states a max of 28mA. If I find time I will hook up a scope and see if I can spot a difference so we know for sure. |
The moment I add some debug code to delayMS my display works, if I remove it, it fails.. this suggest a timing issue (is compiler optimizing stuff away?) |
This made it work for me (tm), might be a double thing? diff --git a/main/st7789.c b/main/st7789.c
index 5bde9bc..da8b62e 100644
--- a/main/st7789.c
+++ b/main/st7789.c
@@ -63,11 +63,11 @@ void spi_master_init(TFT_t * dev, int16_t GPIO_MOSI, int16_t GPIO_SCLK, int16_t
gpio_reset_pin( GPIO_RESET );
gpio_set_direction( GPIO_RESET, GPIO_MODE_OUTPUT );
gpio_set_level( GPIO_RESET, 1 );
- delayMS(50);
+ delayMS(100);
gpio_set_level( GPIO_RESET, 0 );
- delayMS(50);
+ delayMS(200);
gpio_set_level( GPIO_RESET, 1 );
- delayMS(50);
+ delayMS(300);
}
ESP_LOGI(TAG, "GPIO_BL=%d",GPIO_BL);
@@ -98,7 +98,7 @@ void spi_master_init(TFT_t * dev, int16_t GPIO_MOSI, int16_t GPIO_SCLK, int16_t
memset(&devcfg, 0, sizeof(devcfg));
devcfg.clock_speed_hz = SPI_Frequency;
devcfg.queue_size = 7;
- devcfg.mode = 2;
+ devcfg.mode = 3;
devcfg.flags = SPI_DEVICE_NO_DUMMY;
if ( GPIO_CS >= 0 ) {
@@ -199,11 +199,13 @@ bool spi_master_write_colors(TFT_t * dev, uint16_t * colors, uint16_t size)
return spi_master_write_byte( dev->_SPIHandle, Byte, size*2);
} change spi mode to 3 (hint I found somewhere else) and add a bit more delay. |
I tried your code, But don’t work for me. After adding the circuit below, it works fine.
|
So you are inverting the reset signal? did not expect that as solution. |
No. There was a typo for S8050 instead of S8080 The two circuits below are very similar.
|
hmm I assume C/E is swapped, so you are pulling the rst to ~(3.3V-0.7V ) . It is still odd behavior, I will scope it when I have time. For me the SPI mode 3 (same as was used in the adafruit demo on the esp8266) and slightly longer reset (again picked values from working esp8266 example) works reliable so far. I've done 40 resets and around 15 power cycles and it came back fine every time. |
For me, SPI mode 3 and mode 2 both work fine. |
I'm going to get some more modules (slighlty different form factor) soon, I will report back how they work. |
If you have a scope, I want you to observe the current through RES and the voltage on RES. |
Do you know the current value? I think that the current value has an effect. |
Given the above trace, I see no reason to measure current. It clearly is not an issue. (also your above schematic with the 220 ohm resistor to ground shows the current it takes is most likely < 10mA. ) Did a quick measurement, at high, the current going is 0.1mA, less for pulling to ground. so this is clearly a high-z input. |
The schematic was wrong. Circuit A works on ESP32.
|
Ill retry it with an esp32. Was using an esp32c3 now. |
Try to use SPI mode 3 for modules with CS grounded. Not any external circuit required. |
yes, see my reply above. SPI mode 3 works perfectly reliable. I have ~400 devices now running with the right mode without any issues or any extra reset circuitry. |
I'll test it on the weekend. |
Changed SPI mode from 2 to 3. Thank you. @DaveDavenport @sl45sms |
related #38 |
Thank you. |
Thanks again for your library. |
The screen cant reset after I flash the code. After I double the delay of reset pin it can auto reset now.
The text was updated successfully, but these errors were encountered: