I will use GPIO3_19 to control LCD POWER ON. So I add below red code to turn on the power of LCD blacklight
but when run below red code, the wince system will stop. I don't why? How to control GPIO3_19?
Lcdc.c (platform\am33x_bsp\src\bsp_common\lcdc)
BOOL SetBacklightLevel_GPIO(UINT level)
{
DWORD rc = TRUE; HANDLE g_hGpio = NULL; RETAILMSG(1,(TEXT("SetBacklightLevel_GPIO=============+++++\r\n"))); if(!g_hGpio) { // Configure Backlight/Power pins as outputs g_hGpio = GPIOOpen(); if (g_hGpio == NULL) { RETAILMSG(1, (L"AM33x:Failed to open GPIO driver")); return FALSE; } }
/* turn on backlight non-zero level */ if (level) { GPIOSetBit(g_hGpio, BSP_LCD_BACKLIGHT_GPIO); GPIOSetMode(g_hGpio, BSP_LCD_BACKLIGHT_GPIO, GPIO_DIR_OUTPUT ); } else if (level == 0 ) { GPIOClrBit(g_hGpio, BSP_LCD_BACKLIGHT_GPIO); } RETAILMSG(1,(TEXT("SetBacklightLevel_GPIO 2222222222+++%d++\r\n"), level)); GPIOSetMode(g_hGpio, ((3<<5)|(19)), GPIO_DIR_OUTPUT ); RETAILMSG(1,(TEXT("SetBacklightLevel_GPIO —–111—-\r\n"))); GPIOSetBit(g_hGpio, ((3<<5)|(19))); RETAILMSG(1,(TEXT("SetBacklightLevel_GPIO —–222—-\r\n")));
if(g_hGpio) GPIOClose(g_hGpio); return rc; }
Gino E:
你好,
这个现象应该是你在初始化GPIO3口的时候,只是初始化了GPIO3模块,而忘了初始化controlmodule模块,这种情况下访问GPIO3模块,会导致系统假死。正常流程是要将使用的pin脚先设置为GPIO mode。如何配置寄存器可以参考TRM control module模块。