Skip to content

LCD co5300 sometimes fails to init after reset, need extra delay in lcd_hw_open #216

@lizhaoming634

Description

@lizhaoming634

Answers checklist.

  • I have read the documentation SiFli-SDK Programming Guide and the issue is not addressed there.
  • I have updated my SiFli-SDK branch (main or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

SiFli-SDK version.

2.4.4 build 706cb10

SiFli SoC revision.

sf32lb58

Operating System used.

Windows

Development Kit.

sf32lb58-lcd_a128r32n1_dsi

What is the expected behavior?

I expected the LCD on sf32lb58-lcd_a128r32n1_dsi to initialize reliably on every reset when running the official watch demo.
sifli-sdk\example\multimedia\lvgl\watch

What is the actual behavior?

On power-on the LCD usually initializes correctly and the LVGL UI is shown.

However, if I am scrolling / sliding on the LVGL UI and then press the hardware RESET button, there is a random chance that the LCD stays black after reset.
In this bad case the UART log shows messages like draw_core timeout and [INITIALIZED] -> [TIMEOUT], but the system itself is still running (RT-Thread shell works).

Only pressing the RESET button again (sometimes several times) can bring the LCD back to normal.

Steps to reproduce.

  1. Build and flash the official wacth for board sf32lb58-lcd_a128r32n1_dsi.
  2. Power on the board. Wait until the LVGL demo UI is displayed on the LCD.
  3. Continuously scroll / slide on the screen so that the UI is moving.
  4. While the UI is still scrolling, press the hardware RESET button on the board.
  5. Repeat step 3–4 several times. In some resets (not every time, e.g. ~20–30%) the LCD does not light up and the screen remains black, while the UART log prints LCD timeout errors.
  6. Press RESET again and the LCD will usually recover and display the UI normally.

Debug Logs.

Serial:c2,Chip:2,Package:0,Rev:1  Reason:00000000
NAND ID 0xc891c8
det bbm table with 1, 1, 2
detect result 2
V1 1 in block 992, V2 0 in block 994
Latest version 1
V1 1 in block 993, V2 0 in block 995
Latest version 1
v1 1 in blk 992, v2 1 in block 993
BBM MEM: ctx 20036eb4, map1 20036aa4, map2 20036cac 
sif_bbm_init done

 \ | /
- SiFli Corporation
 / | \     build on Dec  7 2025, 2.4.4 build 706cb10b
 2020 - 2022 Copyright by SiFli team
mount /dev sucess
[D/USBD] No class register on usb device
[1368] I/drv.rtc main: PSCLR=0x80000100 DivAI=128 DivAF=0 B=256
[1393] I/drv.rtc main: RTC use LXT RTC_CR=00000000

[1413] I/drv.rtc main: Init RTC, wake = 0

[1577] I/drv.audprc main: init 00 ADC_PATH_CFG0 0x924

[1598] I/drv.audprc main: HAL_AUDPRC_Init res 0

[1618] I/drv.audcodec main: HAL_AUDCODEC_Init res 0

[1638] I/TOUCH main: Regist touch screen driver, probe=0x10007b81 
lvsf_font_load: faces 1 ft_cache_size 300000
call par CFG1(35bb)
fc 11, xtal 2000, pll 1993
call par CFG1(35bb)
fc 9, xtal 2000, pll 1992
[2125] I/drv.lcd app_watc: [NONE] -> [OPENING]
[2144] I/drv.lcd lcd_task: open
[2156] I/drv.epic lcd_task: drv_gpu opened.
[2173] I/drv.lcd lcd_task: HW open
[2187] I/drv.lcd lcd_task: Try registered LCD driver...
msh />
CO5300_ReadID 0x331100 
[4499] I/co5300 lcd_task: LCD module use CO5300 IC 


CO5300_ReadID 0x331100 
[10757] I/co5300 lcd_task: LCD module use CO5300 IC 

[10777] I/drv.lcd lcd_task: Found lcd co5300 id:331100h
[10798] I/drv.lcd lcd_task: HW open done.
[10814] I/drv.lcd lcd_task: [OPENING] -> [INITIALIZED]
[10835] I/drv.lcd lcd_task: open done.
[10852] I/drv.lcd_fb app_watc: drv_lcd_fb_init
[10871] I/drv.lcd_fb app_watc: drv_lcd_fb_init done.
[10897] I/TOUCH app_watc: Open
[10911] I/TOUCH tp_init: Find touch screen driver...
[10931] I/TOUCH tp_init: Probe 10007b81
[10947] I/TOUCH tp_init: touch screen found driver  0x200366c4, ft6146
[10974] I/TOUCH app_watc: Opened.
[11046] I/LVGL app_watc: [littlevgl2rtt] Welcome to the littlevgl2rtt lib.
[11097] D/APP.FWK app_watc: send msg[GUI_APP_MSG_RUN_APP] [Main] to gui_app_mbx tick:298.
[11132] I/APP.FWK.INT app_watc: [Main]
[12066] I/drv.lcd lcd_task: Auto turn on display.
[12085] I/drv.lcd lcd_task: set brightness 50
[12103] I/drv.lcd lcd_task: display on
[12118] I/drv.lcd lcd_task: [INITIALIZED] -> [ON]
[12137] I/drv.lcd lcd_task: set brightness 100
[12155] I/drv.lcd lcd_task: display on
[12170] D/APP.SCHE app_watc: ----------------app_schedule_task---------------start
[12201] I/APP.SCHE app_watc: >>Execute msg[GUI_APP_MSG_RUN_APP] tick:298
[12229] I/APP.SCHE app_watc: app[Main] do LOAD, 2004c460
[12250] I/APP.FWK app_watc: finding Main in builtin apps...
[12273] D/APP.SCHE app_watc: app[Main] tgt_state [LAUNCHED] -> [RUNNING]
[12300] I/APP.SCHE app_watc: app[Main] do START, 2004c460
[12322] I/APP.FWK.INT app_watc: [Main]
[12338] D/APP.FWK app_watc: send msg[GUI_APP_MSG_OPEN_PAGE] [0x2004c460] to gui_app_mbx tick:336.
[12374] I/APP.SCHE app_watc: >>Execute msg[GUI_APP_MSG_OPEN_PAGE] tick:336
[12402] D/APP.SCHE app_watc: app[Main] create page[root] 2004c52c
[12427] D/APP.SCHE app_watc: page[Main][root] tgt_state [CREATED] -> [RESUMED]
[12456] D/APP.SCHE app_watc: Stop all app, and return to main app
[12486] I/APP.SCHE app_watc: page[Main][root] do ONSTART, 2004c52c
[13645] I/APP.SCHE app_watc: page[Main][root] do ONRESUME, 2004c52c
[13671] I/APP.SCHE app_watc: Try setup trans-anim
[13689] I/APP.SCHE app_watc: Trans-anim is OFF, skip.
[13710] D/APP.SCHE app_watc: app_schedule_task done.
[13734] E/drv.ft6146 tp_init: ft6146 id_H=64
[13756] E/drv.ft6146 tp_init: ft6146 id_L=56
app mainmenu icon clickd
[10369279] E/drv.lcd lcd_task: draw_core timeout
[10369298] E/drv.lcd lcd_task: Error, Clear p_drv_ops 100abf5c, sem_v=0
[10369325] E/drv.lcd lcd_task: irq_en=0
[10369340] E/drv.lcd lcd_task: LCDC1_irq_en=1, active=0, pending=0
[10369365] E/drv.lcd lcd_task: hlcdc errcode=0, lock=0, state=2
[10369389] E/drv.lcd lcd_task: LCDC STATUS=1,TE=3
[10369407] E/drv.lcd lcd_task: HAL dbg cnt 3, 3, 2
[10369427] E/drv.lcd lcd_task: DRV dbg cnt 3, 2, 2
[10369446] E/drv.lcd lcd_task: LCDC CANVAS TL=0,BR=1c10185,SETTING=a0141,IRQ=0
[10369475] E/drv.lcd lcd_task: LCDC LAYER0 CFG=14498ff0,TL=0,BR=1c10185,SRC=62000000,DEC=30c0c5
[10369510] E/drv.lcd lcd_task: LCDC LAYER1 CFG=0,TL=0,BR=0,SRC=0
[10370491] E/drv.lcd lcd_task: Error, Clear p_drv_ops 100abf5c, sem_v=0
[10370518] E/drv.lcd lcd_task: irq_en=0
[10370533] E/drv.lcd lcd_task: LCDC1_irq_en=1, active=0, pending=0
[10370558] E/drv.lcd lcd_task: hlcdc errcode=0, lock=0, state=2
[10370582] E/drv.lcd lcd_task: LCDC STATUS=1,TE=3
[10370600] E/drv.lcd lcd_task: HAL dbg cnt 3, 3, 2
[10370620] E/drv.lcd lcd_task: DRV dbg cnt 3, 2, 2
[10370639] E/drv.lcd lcd_task: LCDC CANVAS TL=0,BR=1c10185,SETTING=a0141,IRQ=0
[10370668] E/drv.lcd lcd_task: LCDC LAYER0 CFG=14498ff0,TL=0,BR=1c10185,SRC=62000000,DEC=30c0c5
[10370703] E/drv.lcd lcd_task: LCDC LAYER1 CFG=0,TL=0,BR=0,SRC=0
[10370728] I/drv.lcd lcd_task: [ON] -> [TIMEOUT]
[10370746] E/drv.lcd lcd_task: lcd_timeout_error draw_core, 1822
Assertion failed at function:draw_core, line number:1823 ,(0)
Previous ISR enable 0
===================
Thread Info        
===================
         pri  status      sp      top     stack size max used left tick  error
-------- ---  ------- ---------- ---------- ----------  ------  ---------- ---
tpread    10  suspend 0x200167a0 0x200168ac 0x00000400    44%   0x0000000a 000
lcd_task  12  ready   0x20016308 0x200164ac 0x00000800    45%   0x00000006 000
app_watc  19  ready   0x20045cf8 0x20045ee0 0x00004000    07%   0x00000003 -02
tshell    20  suspend 0x2004a888 0x2004aa08 0x00001000    16%   0x0000000a 000
epic_tas  13  suspend 0x200171a8 0x200174ac 0x00000c00    78%   0x00000006 000
tidle     31  ready   0x00026f10 0x00026f68 0x00000200    19%   0x0000001f 000
timer      4  suspend 0x20027f40 0x20028044 0x00000400    25%   0x00000009 000
===================
Mailbox Info       
===================
        entry size suspend thread
------- ----  ---- --------------
appfwk  0000  0010 0
===================
MessageQueue Info  
===================
         entry suspend thread
-------- ----  --------------
drv_lcd  0000  0
drv_epic 0001  0
===================
Mutex Info         
===================
           owner  hold suspend thread
-------- -------- ---- --------------
tplck    (null)   0000 0
rtc      (null)   0000 0
ulog loc (null)   0000 0
fslock   (null)   0000 0
i2c_bus_ (null)   0000 0
i2c_bus_ (null)   0000 0
i2c_bus_ (null)   0000 0
i2c_bus_ (null)   0000 0
spi1     (null)   0000 0
===================
Semaphore Info     
===================
         v   suspend thread
-------- --- --------------
app_sche 001 0
lv_data  001 0
tp_ctrl  001 0
lv_lcd   000 0
lcd_msg  000 0
lcd_draw 000 0
drv_lcd  000 0
btn      001 0
shrx     000 0
epic_rl  000 0
epic     001 0
ft6146   000 1:tpread
app_ft_m 001 0
app_mess 001 0
app_imag 001 0
app_imag 001 0
aes_drv  001 0
drv_eDma 001 0
nandlock 001 0
flash5   001 0
i2c4     000 0
i2c3     000 0
i2c2     000 0
i2c1     000 0
spi1     000 0
heap     001 0
===================
Memory Info     
===================
total memory: 1723156 used memory : 43432 maximum allocated memory: 48552
===================
MemoryHeap Info     
===================
          pool size  max used size available size
-------- ---------- ------------- --------------
app_ft_m 400000     9328          390672
app_mess 96000      72            95928
app_imag 50000      72            49928
app_imag 1100000    72            1099928
=====================
PSP: 0x0x20016384, MSP: 0x0x20001fe0
=====================
 sp: 0x200163e0
psr: 0x40000000
r00: 0x00000000
r01: 0x00001c1f
r02: 0x0001b0a2
r03: 0x30000000
r12: 0x1006dd75
 lr: 0x10058053
 pc: 0x10058053
=====================
fatal error on thread: lcd_task?

More Information.

I found a workaround in the LCD driver.

File:
sifli-sdk/rtos/rtthread/bsp/sifli/drivers/drv_lcd.c

Function lcd_hw_open():

static rt_err_t lcd_hw_open(void)
{
    LOG_I("HW open");
    BSP_LCD_PowerDown();
    rt_thread_mdelay(10);
    BSP_LCD_PowerUp();
    rt_thread_mdelay(10);  
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions