Skip to main content
kuchura
Associate
July 22, 2016
Question

Bug in BSP_LCD_ReadPixel

  • July 22, 2016
  • 1 reply
  • 601 views
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
    This topic has been closed for replies.

    1 reply

    Technical Moderator
    December 21, 2016
    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

    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks