Comments (24)
Thank you.
from esp-idf-st7789.
The reset timing may be different for each TFT.
from esp-idf-st7789.
I think there is an electrical problem around reset circuit in the breakout without the CS pin.
Perhaps the reset circuit requires a lot of current.
I inserted a 100 ohm resistor between Vcc and RESET.
from esp-idf-st7789.
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.
On the esp8266 the display works (without external components, with the adafruit library) and in general esp8266 (from what I found) can sink/source less current then the esp32. I wonder if it is more a timing issue.
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.
from esp-idf-st7789.
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?)
from esp-idf-st7789.
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.
from esp-idf-st7789.
I tried your code, But don’t work for me.
After adding the circuit below, it works fine.
ESP32 3V3 -------------------------------+
|
| Emitter
/
/
ESP32 RES ------------R(2.2K)---------| S8080
Base \
\
| Collector
|
ST7789 RST -------------------------------+
|
|
|
|
ESP32 GND ------------R(220)-------------+
from esp-idf-st7789.
So you are inverting the reset signal? did not expect that as solution.
(if V(E-B) is above threshold it conducts, so if res is pulled low, ST7780 RST goes high)
from esp-idf-st7789.
you are inverting the reset signal?
No.
There was a typo for S8050 instead of S8080
The two circuits below are very similar.
In both cases, when the ESP32 RES goes HIGH, the ST7789's RST goes HIGH.
The current flowing through the RST of the ST7789 is different.
The upper circuit carries more current.
ESP32 3V3 -------------------------------+
|
| Emitter
/
/
ESP32 RES ------------R(2.2K)---------| S8050
Base \
\
| Collector
|
ST7789 RST -------------------------------+
|
|
|
|
ESP32 GND ------------R(220)-------------+
ESP32 RES -------------------------------+
|
ST7789 RST -------------------------------+
from esp-idf-st7789.
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.
from esp-idf-st7789.
For me, SPI mode 3 and mode 2 both work fine.
from esp-idf-st7789.
I'm going to get some more modules (slighlty different form factor) soon, I will report back how they work.
from esp-idf-st7789.
If you have a scope, I want you to observe the current through RES and the voltage on RES.
from esp-idf-st7789.
That signal looks fine. the esp32c3 has no problems asserting that.
from esp-idf-st7789.
Do you know the current value?
I think that the current value has an effect.
from esp-idf-st7789.
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.
from esp-idf-st7789.
The schematic was wrong.
Sorry for the confusion.
Circuit A works on ESP32.
Circuit B don't works on ESP32.
Circuit B works on ESP32-S2/ESP32-C3.
circuit A
ESP32 3V3 -------------------------------+
|
| Collector
/
/
ESP32 RES ------------R(2.2K)---------| SS8050
Base \
\
| Emitter
|
ST7789 RST -------------------------------+
|
|
|
|
ESP32 GND ------------R(220)-------------+
circuit B
ESP32 RES -------------------------------+
|
ST7789 RST -------------------------------+
from esp-idf-st7789.
Ill retry it with an esp32. Was using an esp32c3 now.
from esp-idf-st7789.
Try to use SPI mode 3 for modules with CS grounded. Not any external circuit required.
from esp-idf-st7789.
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.
from esp-idf-st7789.
I'll test it on the weekend.
from esp-idf-st7789.
Changed SPI mode from 2 to 3.
Test results are good.
No pull-up resistor is required on the reset pin.
Thank you. @DaveDavenport @sl45sms
from esp-idf-st7789.
related #38
from esp-idf-st7789.
Thanks again for your library.
from esp-idf-st7789.
Related Issues (20)
- TFT backlight not powered on for Lilygo TTGO T-Watch-2020 HOT 4
- Please add a LICENSE to this repository HOT 1
- IMAGE HOT 4
- Just use u lib
- IMAGE HOT 14
- Preventing black screen while refreshing text HOT 5
- PlatformIO IDE use
- Video playing HOT 2
- Improve performance with frame buffer and DMA HOT 28
- No demo appears on screen HOT 3
- This Project can not work on esp32C3 HOT 6
- did you original this st7789 library? HOT 2
- SVG logging HOT 1
- How to display 1 bit depth BMP image? HOT 34
- Not working in ESP-IDF5.0 HOT 5
- Slow Refresh Rate of ST7789 Screen Compared to ESP-IDF Screen Library HOT 5
- demo worked, but only 240x240? HOT 1
- SPI data is sampled on rising edge of clock, wrong mode? HOT 1
- Variable 'size' overflows in function lcdDrawFinish() when setting the resolution to 320*240 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esp-idf-st7789.