2025-06-01 4:00 AM
I have tried the BSP example from the STM32CubeN6 package, and the LCD works correctly. However, I am trying to create the smallest possible code to make the screen work, and I started a project from scratch using STM32CubeMX and STM32CubeIDE.
What I did was to enable the minimum amount of peripherals to make LCD work in CubeMX, and the code generator added the necessary HAL files, etc..
Then I added the discovery_lcd BSP for this board among other needed files like stm32_lcd and the fonts...
The code compiles, and the LED1 and LED2 blink as part of the while loop I coded.
However, the LCD is blank (but I can see that is active because the backlight is on). I am expecting to see a white background with some text.
You can find my code here: https://github.com/jpcano/STM32N6-digits/tree/lcd
Do you have any ideas?
Solved! Go to Solution.
2025-06-01 2:51 PM - edited 2025-06-01 2:52 PM
I answer myself. The issue was that I did not configure RIF (Resource Isolation Framework) for the DMA2D and LTCD peripherals.
I added the following code right after HAL_Init(), and now the LCD works as expected. It took me a while to understand that this was the problem because there is no compilation error when using the LCD BSP as it does not depend on RIF hal at compilation time.
HAL_Init();
/* Update the RIF config for the used peripherals */
RIMC_MasterConfig_t RIMC_master = {0};
RIMC_master.MasterCID = RIF_CID_1;
RIMC_master.SecPriv = RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_PRIV;
HAL_RIF_RIMC_ConfigMasterAttributes(RIF_MASTER_INDEX_DMA2D, &RIMC_master);
HAL_RIF_RIMC_ConfigMasterAttributes(RIF_MASTER_INDEX_LTDC1 , &RIMC_master);
HAL_RIF_RIMC_ConfigMasterAttributes(RIF_MASTER_INDEX_LTDC2 , &RIMC_master);
HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_DMA2D , RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_PRIV);
HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_LTDC , RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_PRIV);
HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_LTDCL1 , RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_PRIV);
HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_LTDCL2 , RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_PRIV);
I committed a minimum working CubeMX example that uses the LCD with the BSP libraries here, just in case other person has the same issue: https://github.com/jpcano/STM32N6-digits/tree/lcd
2025-06-01 4:27 AM
Ensure that you're calling the necessary BSP functions in the correct order. For example:
BSP_SDRAM_Init();
BSP_LCD_Init();
BSP_LCD_LayerDefaultInit(0, LCD_FRAME_BUFFER);
BSP_LCD_DisplayOn();
BSP_LCD_Clear(LCD_COLOR_WHITE);
BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"Hello, World!", CENTER_MODE);
2025-06-01 5:59 AM
I called the same BSP functions and the same order that appears in the BSP example in the STM32CubeN6 MCU Firmware Package.
I tried your suggestion but I could not find the function BSP_LCD_LayerDefaultInit in the stm32n6570_dicovery_lcd.c.
At the end this is what I tried but the LCD is still blank:
BSP_LCD_Init(0, LCD_ORIENTATION_LANDSCAPE);
UTIL_LCD_SetFuncDriver(&LCD_Driver);
BSP_LCD_DisplayOn(0);
UTIL_LCD_Clear(UTIL_LCD_COLOR_WHITE);
UTIL_LCD_SetFont(&UTIL_LCD_DEFAULT_FONT);
UTIL_LCD_SetBackColor(UTIL_LCD_COLOR_WHITE);
UTIL_LCD_SetTextColor(UTIL_LCD_COLOR_DARKBLUE);
UTIL_LCD_DisplayStringAt(0, 10, (uint8_t *)"STM32N6 Discovery LCD test", CENTER_MODE);
2025-06-01 2:51 PM - edited 2025-06-01 2:52 PM
I answer myself. The issue was that I did not configure RIF (Resource Isolation Framework) for the DMA2D and LTCD peripherals.
I added the following code right after HAL_Init(), and now the LCD works as expected. It took me a while to understand that this was the problem because there is no compilation error when using the LCD BSP as it does not depend on RIF hal at compilation time.
HAL_Init();
/* Update the RIF config for the used peripherals */
RIMC_MasterConfig_t RIMC_master = {0};
RIMC_master.MasterCID = RIF_CID_1;
RIMC_master.SecPriv = RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_PRIV;
HAL_RIF_RIMC_ConfigMasterAttributes(RIF_MASTER_INDEX_DMA2D, &RIMC_master);
HAL_RIF_RIMC_ConfigMasterAttributes(RIF_MASTER_INDEX_LTDC1 , &RIMC_master);
HAL_RIF_RIMC_ConfigMasterAttributes(RIF_MASTER_INDEX_LTDC2 , &RIMC_master);
HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_DMA2D , RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_PRIV);
HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_LTDC , RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_PRIV);
HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_LTDCL1 , RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_PRIV);
HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_LTDCL2 , RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_PRIV);
I committed a minimum working CubeMX example that uses the LCD with the BSP libraries here, just in case other person has the same issue: https://github.com/jpcano/STM32N6-digits/tree/lcd