- Wed Jun 06, 2018 7:30 am
#76320
Anti Reiljan wrote:Start by connecting 5V to 5V instead of 3,3V
Normally (with other TFT-screens) that isn't actually required.
You can get these displays working at 3.3V if you close a specific jumper, generally J1 (on the boards I have), in this case jumper J2 looks like the one (though I don't own this display).
Please remember that, if you short that jumper, the display can't be used on 5V (unless you un-short the jumper again).This is what the pins do
- 5V - Vcc (required)
- RESET - Reset (optional, but can be connected to the reset-line of the µC)
- RS - Register Select (AKA DC or Data/Command) (required)
- MOSI - Master Output/Slave Input (required)
- SCK - Serial Clock (required)
- CS - Chip Select (AKA SS or Slave Select) (optional)
When you only want to use the display, you can pull this permanently LOW, when you also want to use the SD-card interface (see pin 8) (or when your setup also has other SPI-devices on the same bus) every SPI-device needs its own CS-line - MISO - Master Input/Slave Output (optional, not really needed with displays)
- SD/CS - Chip Select for the SD-card interface
You can pull this line permanently HIGH if you don't want to use it or give it its own CS-line on the µC - BLED - Background LED (required, or you'll see nothing)
If you have a spare port, you can connect it to that port and use PWM so you'll be able to adjust the backlight by software (you ought to use a power-transistor for the current of the LED is usually too high for an ESP).
When you don't have a spare port or don't care for backlight control, just connect it to Vcc. - GND - Power ground (required)
So, where does this bring us:
- 5V -> 3.3V (pin 8)
- RS -> GPIO2 / D4 (pin 17)
- MOSI -> GPIO13 / D7 (pin 7)
- SCK -> GPIO14 / D5 (pin 5)
- CS -> GND / G (pin 15)
- SD/CS -> 5V / 5V (pin USB)
- BLED -> 5V / 5V (pin USB)
- GND -> GND / G (pin 15)
Next, take a demo that comes with the ST7735 library and set the correct define-values for the used GPIO-ports.
Compile and flash... and it *should* work.
If it doesn't, recheck the define-values of the ports and use actual GPIO-numbers (0 ~ 16) instead of port-numbers (D0 ~ D8)
Compile and flash... and it *should* work.
If it doesn't, I might have got the CS-lines wrong (I'm pretty sure, but doing this from the top of my head) and you'll have to set CS (of the display) to HIGH and SD/CS (of the SD-card) to LOW.
Good luck.
Assumption is the mother of all f*ckups. At least: that's what I'm assuming.