2023-03-11 07:44 AM
Facts: I can program/debug very simple things so the problem is not there.
It is my first attempt to work with STM32cubeIDE and i find it somewhat challenging.
I have a STLinkV2 programmer/debugger that works fine.
The dev kit i bought is: https://www.waveshare.com/open429i-c-standard.htm
More info here: https://www.waveshare.com/wiki/Open429I-C
Schematic of the board here: https://www.waveshare.com/w/upload/8/8c/Open429I-C-Schematic.pdf
The LCD i bought is: https://www.waveshare.com/4.3inch-capacitive-touch-lcd.htm
Resources: https://www.waveshare.com/wiki/4.3inch_Capacitive_Touch_LCD
Sample code (for STM32cubeIDE): https://www.waveshare.com/wiki/File:4.3inch_Capacitive_Touch_LCD_code.7z
Datasheet: https://www.waveshare.com/w/upload/5/55/SH430HI50-43050L-C.pdf
Manual: https://www.waveshare.com/w/upload/0/00/4.3inch_Capacitive_Touch_LCD_user_manual_en.pdf
I tried to import the sample code but it imports only the ioc file. Replacing .c & .h files helped but there are still error during compilation.
I am not sure if i need to install some of the packages in Menu: Help->Embedded Software Packages Manager or in the ioc GUI under Middleware & Software Packes.
I installed X-CUBE-DISPLAY and X-CUBE-TOUCHGFX but without any success.
Can any one help me make the lcd work?
If i start from scratch (create a new STM32cube project) and therefore have to setup peripherals myself i end up where i can program & debug, toggle the dev kit leds which means that there is nothing wrong with the board. Later after searching a bit i saw that i have to setup FMC which i do not know exactly how to do it and finally use BSP to init LCD, draw lines, shapes etc.
So i need some guidance there. If anyone is willing to dedicate a few hours to provide code that works in STM32cubeIDE 1.12 i would be glad to pay up to $50.
Regards
Manos
Solved! Go to Solution.
2023-03-12 12:59 AM
Steps to get it compiled (I use cubeIDE 1.11.0 but I think this works also with latest):
Then it should compile OK , but it may need some adjustments to get working on the device :grinning_face_with_sweat:
2023-03-12 03:01 AM
i got it compiled ...also . download an copy to your workspace...
https://link.storjshare.io/jvnke5tud46xyfqhdxaknozq6cbq/demo-bucket%2Flcd-test.zip
2023-03-12 03:09 AM
Thanks to all of you!
I will characterize this thread as SOLVED.
I would like to thank you all for your time. What i was doing wrong is that i was not setting the imported folders as "source folder". I can now see on top of the imported folders a "c" sign just like JTP suggested.
After some tweaking it compiled. However the lcd is still not working. This is a matter of code now.
You cannot possibly help since you obviously do not have the related h/w.
Many thanks.
Stay safe.
Manos
2023-03-12 04:29 AM
Good that it helped you forward :thumbs_up: It still may need to define symbol 'DATA_IN_ExtSDRAM' in project properties to get SDRAM initialized properly at system_stm32f4xx.c.
Then there seem to be also fputc- funtion at /src/usart.c. If you copy that from downloaded usart.c, the printf to Usart will probly work.
One other option is to copy all files to core/inc and core/src from downloaded project and test that also. But make backup of project before and use that for testing. For some reason it will then need to add '#include <stdio.h>' to usart.c. Then it compiles ok. Note that if you regenerate the code from CubeMx it will overwrite the inc and src files.
2023-03-12 05:15 AM
I repeat 7z file from waveshare is created for KEIL MDK ARM compiler. Ask waveshare why dont place builded bin in 7z. Other is your idea migrate code into CubeIDE .
Step by step create new empty project based on ioc, And try activate LTDC and init display only.
2023-03-12 07:59 AM
Thanks MM..1,
After struggling a bit i was able to compile the sample code. It was mostly a matter of inexperience with STM32cubeIDE. Despite the fact that the sample code, as you suggest, is targeting Keil compiler the real issue is still here which doesn't let me work with the lcd.
I debugged the first few lines and noticed that the execution stops at Paint_DrawLine();
Didn't dig in there because using only the first 3 lines was still not enough for the lcd background to get the RED color as per Paint_Clear(RED); When i used the 3 first lines, the execution was able to reach the while() loop but the lcd was still showing nothing. I can see that the backlight is ON so i am guessing it is a matter of s/w setup. With all 4 lines in place the execution does not reach the while() loop because, as i said, it stops at Paint_DrawLine().
BSP_LCD_Init();
Paint_NewImage(LCD_WIDTH, LCD_HEIGHT, 0, WHITE);
Paint_Clear(RED);
Paint_DrawLine(300, 230, 200, 330, MAGENTA, LINE_STYLE_SOLID, DOT_PIXEL_2X2);
After debugging deeper i saw that the execution reaches the code:
void BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint32_t RGB_Code){
/* Write data value to all SDRAM memory */
if(hLtdcHandler.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_RGB565){
/* RGB565 format */
/* EXECUTION STOPS ON THE NEXT LINE */
*(__IO uint16_t*) (hLtdcHandler.LayerCfg[ActiveLayer].FBStartAdress + (2*(Ypos*BSP_LCD_GetXSize() + Xpos))) = (uint16_t)RGB_Code;
}
else {
/* ARGB8888 format */
*(__IO uint32_t*) (hLtdcHandler.LayerCfg[ActiveLayer].FBStartAdress + (4*(Ypos*BSP_LCD_GetXSize() + Xpos))) = RGB_Code;
}
}
Not sure if there is anything i can do.
Maybe it is a matter of FMC or LTDC or DMA. No idea what to change...
I have contacted waveshare, hopefully they will share some working code for this lcd.
Manos