Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


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.

Dear all,

is there anybody who can confirm that the code generates timely constant pixels in the top left corner (0,0) and flickering pixels at positions (80,0) and (160,0)? Otherwise, I would expect a hardware bug on my device. To visualize my problem in more detail, I will upload an image of the display.

Stm32f746g Discovery Pixel Flickering

Thanks in advance and best regards,
Sebastian


Dear all,

Unfortunately, this post already has 83 reads at this point of time, but nobody seems to have a solution for the problem. I just wanted to add that I would also really appreciate if anybody would be able to run the code without having any flickering/jumping pixels. Please also add a comment to this post if the code runs without having the abovementioned problem. In this case, I would know that something is wrong with my hardware.

Thanks in advance and best regards,
Sebastian


 

Newest Forum Posts

  1. reservation car service Seattle by Jamesprede, 2025-05-01 10:06
  2. Last day: drone bonus by Danielrug, 2025-04-19 16:55
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Insightful Perspectives on This Subject by davidsycle, 2025-03-04 05:45
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  10. Build a project in "release" mode by tang, 2025-02-20 10:36

Last-Modified Blogs