machine.lightsleep() makes my ILI9341 display dead

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
Lixas
Posts: 10
Joined: Fri Aug 21, 2020 9:09 am

machine.lightsleep() makes my ILI9341 display dead

Post by Lixas » Fri Aug 21, 2020 9:25 am

Hello

I'm playin' around with ILI9341 screen and trying to build simple environmental sensor battery powered so i wish to use sleep. Light sleep at first, later i'll work on deepsleep

Simplified code:

Code: Select all

from ili934x import ILI9341  # , color565
from machine import Pin, SPI, lightsleep
import config as LCDPin


power = Pin(LCDPin.LED_PIN, Pin.OUT)
power.value(1)

spi = SPI(
    1,
    baudrate=51200000,
    miso=Pin(LCDPin.MISO_PIN),
    mosi=Pin(LCDPin.MOSI_PIN),
    sck=Pin(LCDPin.CLK_PIN))

display = ILI9341(
    spi,
    cs=Pin(LCDPin.CS_PIN),
    dc=Pin(LCDPin.DC_PIN),
    rst=Pin(LCDPin.RST_PIN),
    w=320,
    h=240,
    r=1)

while True:
    # do stuff
    # display data on screen
    # ---> lightsleep(10000) # sleep for 10 seconds
    # screen is dead
bellow is my SPI config

Code: Select all

from micropython import const

LED_PIN = const(21)
DC_PIN = const(5)
CS_PIN = const(2)
RST_PIN = const(4)

CLK_PIN = const(14)  # 18
MOSI_PIN = const(13)  # 23
MISO_PIN = const(12)  # 22
So my question is: Is it something wrong with my wiring, my code or something else? Why do my screen goes dead if I use lightsleep? If i comment out lightsleep()- everything works as expected

Version: MicroPython v1.12 on 2019-12-20; ESP32 module with ESP32 WROOM board

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: machine.lightsleep() makes my ILI9341 display dead

Post by jimmo » Thu Sep 03, 2020 5:46 am

lightsleep is a low power mode.. I don't know on ESP32 what this does to the pins, but perhaps the RST pin is going low?

Post Reply