cancel
Showing results for 
Search instead for 
Did you mean: 

Bug in BSP_LCD_ReadPixel

kuchura
Associate
Posted on July 22, 2016 at 15:44

Hi,

Using CubeF7 with STM32F746G Discovery board.

Found a weird bug in

STM32Cube_FW_F7_V1.4.0\Drivers\BSP\STM32746G-Discovery\stm32746g_discovery_lcd.c

:

uint32_t BSP_LCD_ReadPixel(uint16_t Xpos, uint16_t Ypos)
{
uint32_t ret = 0;
if
(hLtdcHandler.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_ARGB8888)
{
/* Read data value from SDRAM memory */
ret = *(__IO uint32_t*) (hLtdcHandler.LayerCfg[ActiveLayer].FBStartAdress + (2*(Ypos*BSP_LCD_GetXSize() + Xpos)));
}

The highlighted multiplier of

2

must be replaced with

4

, otherwise the code either returns data for the wrong pixel, or causes hardfault crash trying to access non-existing memory.

Similar changes probably should be made in the code below (for RGB888 format).

#!bug
1 REPLY 1
Imen.D
ST Employee
Posted on December 21, 2016 at 16:56

Dear

‌

,

Thanks for highlighting this issue.

I confirmed this bug and it will be fixed in the coming versions.

Best Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen