STM32F746G-Discovery display memory problem
Dear community,
I have been looking for a very simple running display minimum example using HAL and BSP interfaces for quite some time. Unfortunately, I did not succeed and tested around. Finally, I found how to interface the display, but I wasn’t able to properly execute drawing functions like the BSP_LCD_DrawRect() function from the stm32746g_discovery_lcd.h library. I always got some strange display behavior when drawing something with those functions. I started to draw the most simple geometry one could think about by using the BSP_LCD_DrawPixel() function. Still, I am running into strange display behavior, which I think corresponds to a memory leak in my code:
Drawing a pixel to positions like (0,0) or (10,0) seems to work correctly. However, the pixels begin to flicker when increasing the x coordinate and especially the y coordinate:
[...] // Draw pixels BSP_LCD_SelectLayer(0); BSP_LCD_DrawPixel(0,0,0xffffffff); BSP_LCD_DrawPixel(5,0,0xff00ffff); BSP_LCD_DrawPixel(10,0,0xff0000ff); BSP_LCD_DrawPixel(20,0,0xffffffff); BSP_LCD_DrawPixel(40,0,0xffffffff); BSP_LCD_DrawPixel(80,0,0xffffffff); // begins to flicker BSP_LCD_DrawPixel(160,0,0xffffffff); // flickers significantly [...]
I would be very happy if anyone could explain me what I am doing wrong here. Please find the simple minimum example attached to this post:
/**
  ******************************************************************************
  * @file    main.cpp
  * @author  Ac6
  * @version V1.0
  * @date    01-December-2013
  * @brief   Default main function.
  ******************************************************************************
*/
//#define USE_HAL_DRIVER // redefined?
#include "stm32f7xx.h"
#include "stm32746g_discovery.h"
#include "stm32746g_discovery_lcd.h"
#include "stm32f7xx_hal.h"
#include 
#include 
using namespace std;
int main(void)
{
	// HAL initialization
	SystemInit(); // task? (not required)
	HAL_Init(); // #include "stm32f7xx_hal.h"
	// LED configuration
	GPIO_InitTypeDef GPIO_InitStruct;
	__GPIOI_CLK_ENABLE(); // GPIO Ports Clock Enable
	GPIO_InitStruct.Pin = GPIO_PIN_1; // Configure GPIO pin : PI1
	GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
	GPIO_InitStruct.Pull = GPIO_NOPULL;
	GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
	HAL_GPIO_Init(GPIOI, &GPIO_InitStruct);
	// LCD configuration
	BSP_LCD_Init();
	uint32_t start_address = LCD_FB_START_ADDRESS; // LCD_FB_START_ADDRESS 0xC0000000
	uint32_t lcd_size = (BSP_LCD_GetXSize() * BSP_LCD_GetYSize()* sizeof(uint32_t));
	BSP_LCD_LayerDefaultInit(0, (uint32_t) (start_address + 0*lcd_size));
	BSP_LCD_LayerDefaultInit(1, (uint32_t) (start_address + 1*lcd_size));
	BSP_LCD_DisplayOn();
	BSP_LCD_SelectLayer(0);
	BSP_LCD_Clear(LCD_COLOR_RED);
	BSP_LCD_SelectLayer(1);
	BSP_LCD_Clear(LCD_COLOR_GREEN);
	BSP_LCD_SetTransparency(0, 255);
	BSP_LCD_SetTransparency(1, 200);
	BSP_LCD_SetLayerVisible(0, ENABLE);
	BSP_LCD_SetLayerVisible(1, DISABLE);
	// Draw pixels
	BSP_LCD_SelectLayer(0);
	BSP_LCD_DrawPixel(0,0,0xffffffff);
	BSP_LCD_DrawPixel(5,0,0xff00ff00);
	BSP_LCD_DrawPixel(10,0,0xff0000ff);
	BSP_LCD_DrawPixel(20,0,0xffffffff);
	BSP_LCD_DrawPixel(40,0,0xffffffff);
	BSP_LCD_DrawPixel(80,0,0xffffffff); // begins to flicker
	BSP_LCD_DrawPixel(160,0,0xffffffff); // flickers significantly
        
        // Check LED to ensure functions were executed properly before
	while(1) {
		HAL_GPIO_TogglePin(GPIOI, GPIO_PIN_1);
		HAL_Delay(250);
	}
}
Thank you very much in advance and best regards.



