I am Huy. Currently, I am working on a project of writing a display module in C language and then translate it into MicroPython modules. On both platform (IDE and Linux), I already compiled and included HAL library as well as BSP Discovery library.
The problem is: with the same .c file, on STM32CubeIDE, I can build and run it smoothly without error. The display on the screen was also the same as expected. However, with that piece of code I cannot run on Linux. To be specific, on the REPL, after i refresh the screen, i cannot type anything and the following lines of code cannot be executed and after a minute, it automatically turns back to the terminal. On IDE, the code is runnable and the following lines can run. My doubt is on the BSP_LCD_Refresh() function because after that, the error appears.
In the BSP_LCD_Refresh(), I can see that the FrameBuffer is set to 0 and DSI will trigger the pin TearOn to 1.
Code: Select all
extern LTDC_HandleTypeDef hltdc_discovery;
extern DSI_HandleTypeDef hdsi_discovery;
static uint32_t *my_fb = (uint32_t*)(0x30000000UL); //GFXMMU_VIRTUALBUFFER0_BASE;
static volatile bool display_inited = false;
bool display_active(void)
{
return display_inited;
}
void LCD_init(void)
{
FMC_Bank1_R->BTCR[0] = 0x000030D2;
//Hardware initialization
BSP_PSRAM_Init();
BSP_LCD_Init();
BSP_LCD_SelectLayer(0);
HAL_DSI_ShortWrite(&hdsi_discovery, 0, DSI_DCS_SHORT_PKT_WRITE_P0, DSI_SET_DISPLAY_ON, 0x0);
BSP_LCD_Clear(0xFFFFFFFF);
display_inited = true; // to check the screen is working
}
void LCD_refresh(void)
{
BSP_LCD_Refresh();
}
void LCD_deinit(void)
{
BSP_PSRAM_DeInit();
BSP_LCD_DeInit();
}
void my_flush_cb(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_p)
{
CopyBuffer((uint32_t*)color_p, my_fb, area->x1, area->y1, lv_area_get_width(area), lv_area_get_height(area));
BSP_LCD_Refresh();
lv_disp_flush_ready(drv);
}
I have no idea Why this happens? My doubt is on the way IDE and Linux run the same code differently.