stm32f429+LTDC+SDRAM

Description

What MCU/Processor/Board and compiler are you using?

STM32F429IGT6

What do you want to achieve?

Running LVGL on my board

What have you tried so far?

So far I have created a project with stm32cubemx on IAR compiler. I can use LTDC and sdram simultaneously. But when I follow the porting guide, I wasn’t able to use on my board. Hardfault Handler. other GUI libraries were usable (EMWIN and Touchgfx). Unfortunately the forum doesn’t allow to upload the total project.

https://drive.google.com/file/d/10GoENbOY1h6PcCFXlBew0pEyC_Vooa8X/view?usp=sharing

Code to reproduce

Add the relevant code snippets here.

The code block(s) should be between ```c and ``` tags:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

Hi @vahid_ajalluian,

Looking at your code you don’t seem to have an LVGL driver for your configuration as yet.

I would suggest looking at @kisvegabor 's / @embeddedt 's project here.

The hardware is not identical but pretty similar, I believe this will point you in the right direction to create the project successfully.

I hope that helps.

Kind Regards,

Pete

Hi @pete-pjb
What is lvgl driver?

The code you mentioned doesn’t really seem to help neither there is no from scratch guide on porting lvgl.

I have reviewed the code before posting this thread on the forum

Hi @vahid_ajalluian ,

Are you using custom hardware or one of ST’s development boards?

When you looked at the porting guide did you see this section? You will need to provide some code for these functions which make up the LVGL driver code. The code you need should be very similar to the contents of this file in the repository I shared with you in my last post.

If you are using a standard ST development board there may be with a google search an example somewhere that can be downloaded. If that is not the case you will have to write the code or copy and paste the relevant parts and glue them into you code from the aforementioned repository.

I’m sorry if my help is a little vague as I haven’t worked with this device in quite a few years (I can’t remember much about it now!) The one project I did with it, at the time, I used STemWin pre-compiled library for the GUI paired with FreeRTOS and a modified HAL library all compiled using the free System Workbench for STM32 compiler as I found the STM32CubeMX program very poor back at that time.

Hope this helps…

Kind Regards,

Pete

Thank you @pete-pjb
Copied these files contents, and changed accordingly. No success. my board is a custom board. I said I have been able to port other GUI libraries in advance.

Code project
At debugging time, the code stucks at lv_obj_set_pos and then goes to hardfault handler.

Hi @vahid_ajalluian ,

I’m really sorry but I don’t have time to go deeply into this right now as I have many work commitments at the moment.

All the pieces you need are in your project and the repository I referenced. You will need to work out how to integrate the two projects to make it work, paying close attention to the differences between your hardware and the repository hardware during the initialisation at the beginning of the application. You need to do things in the same order as the repository project but use parts of your own code to initialise the specific parts of your hardware. Also changing the repository driver code to match things like your LCD parameters etc. I’m sure you can work it out. :slight_smile:

Kind Regards,

Pete

Well, I am willing to do so, but to be honest the hands-on tutorial is not really a breakthrough catalog. Compare your documentation with that of Segger Emwin and ST Touchgfx. Although Lvgl seems to be more beautiful with more widgets, there is not enough HOW TO guide. The main problem is with engaging Hardware gears to LVGL gears.

Hello
After some changes, now the problem is that the area variable end (y2) is always -1

How can this problem be solved? What is the source of problem?
Zipped Project

  static void tft_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_p)
{
int16_t x1, y1,x2,y2;
x1=area->x1;
	x2=area->x2;
	y1=area->y1;
	y2=area->y2;
	if (x2>799)
		x2=799;
	if (y2>479)
		y2=479;
	if (y1<0)
		y1=0;
	if (y2<0)
		y2=0;	
	if (x1<0)
		x1=0;
	if (x2<0)
		x2=0;		
	lcd_fb = ( uint16_t*) (0xC0000000);					
for(int y = y1; y <= y2; y++)	
		for(int x = x1; x <= x2; x++)	
				{
                      lcd_fb[x+x2*(y+y1)+x1]=(color_p++->full);  //pixelColor;
				}
	lv_disp_flush_ready(drv);

}

It seems your sdram’s bit is wrong.

16bit or 32bit is important.

SDRAM is configured to be in 16-bit mode and as color_p->full has been set in lvgl configuration it is also 16 bit wide.

uint32_t Have a try.

Nothing changed. :no_mouth: :slightly_frowning_face:

/* Color depth:

    • 1: 1 byte per pixel
    • 8: RGB233
    • 16: RGB565
    • 32: ARGB8888

*/

#define LV_COLOR_DEPTH 32

Nothing Changed
Its not the matter of SDRAM but somewhere else.
y2=area->y2;
y2 always returned as "-1"


This is my code.
You can consult it .

The problem is area->y2 is "-1"

I wonder if it is possible for you to send a simple ported project of yours (LTDC+SDRAM+LVGL). So that I can compare other files.

Sorry ,my project hasn’t finished and it is so big.I have no simple project now. :slightly_frowning_face:

Google Drive is a good place or if you can mail it

Hi @vahid_ajalluian ,

Your flush function I think should be modified to:

static void tft_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_p) {
    int16_t x1, y1,x2,y2;
    x1=area->x1;
	x2=area->x2;
	y1=area->y1;
	y2=area->y2;
	if (x2>799)
		x2=799;
	if (y2>479)
		y2=479;
	if (y1<0)
		y1=0;
	if (y2<0)
		y2=0;	
	if (x1<0)
		x1=0;
	if (x2<0)
		x2=0;		
	//lcd_fb = ( uint16_t*) (0xC0000000); This line is not needed as you assign it globally at the top of main					
        for(int y = y1; y <= y2; y++)  {	
		    for(int x = x1; x <= x2; x++) {
                         lcd_fb[x+(y*MY_DISP_HOR_RES)]=(color_p++->full);  //pixelColor;
		    }
        }
	lv_disp_flush_ready(drv);
}

If area->y2 is always -1, I would suspect some kind of memory corruption. This could be lack of stack or something of that nature… Is it possible for you to post your linker file?

Kind Regards,

Pete

1 Like

Thank you
The whole project is here.
https://drive.google.com/file/d/1CPrz4iI_IjUUXzpCXIKF7jtDN8Brha2t/view?usp=sharing
Should I send the mentioned file in a single file?