Skip to main content
abdberkana
Associate
June 11, 2018
Question

STM32F429 Stuck in GUI_init() after generation using STM32cubeMX V4.26

  • June 11, 2018
  • 26 replies
  • 6033 views

Posted on June 11, 2018 at 10:48

Hi guys, I'm using STM32CubeMx V4.26 to configure STM32F429 that is connected to TFT LCD. I m trying to get my TFTLCD to work with StemWin using FreeRTOS. My program compile and link smoothly without problem. Running the program in the hardware leads to an MCU stuck in the function : GUI_init()

I ve checked some similar issues and it looks to be related to the graphic library and RCC clock.

Could any one have guidance for this issue ? are there some sample code ? 

This topic has been closed for replies.

26 replies

Vitaliy Chernobay
Senior
June 11, 2018
Posted on June 11, 2018 at 11:40

Publish yuor .ioc file

abdberkana
Associate
June 11, 2018
Vitaliy Chernobay
Senior
June 11, 2018
Posted on June 11, 2018 at 20:51

very strange parameters for GRAPHICS configurations

Color Conversion

FMC Bank address

Platform Setting

abdberkana
Associate
June 11, 2018
Posted on June 11, 2018 at 21:26

Maybe it is strange, but the problem is in gui_init. had you got some idea about the problem ?

Vitaliy Chernobay
Senior
June 11, 2018
Posted on June 11, 2018 at 21:50

GUI_init()

does not work when its data is incorrect
Self.Glenn
Visitor II
June 11, 2018
Posted on June 11, 2018 at 22:03

Sorry, don't use Cube but should have realised it would turn on the CRC...

do you have sufficient memory allocated for freertos stack?

Have you allocated enough memory for emwin in GUIConf.c

example: ♯ define GUI_NUMBYTES xxxx

Self.Glenn
Visitor II
June 11, 2018
Posted on June 11, 2018 at 21:49

Enabling the CRC clock is required for the stemwin library to function.

Have you done this:

RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE);

       
Vitaliy Chernobay
Senior
June 11, 2018
Posted on June 11, 2018 at 21:51

This is generated automatically by CubeMX

abdberkana
Associate
June 12, 2018
Posted on June 12, 2018 at 02:30

What is the new function name to control CRC clock (enabling and disabling) ?

Self.Glenn
Visitor II
June 11, 2018
Posted on June 11, 2018 at 22:25

Do you have a GUI_X.c with something like this. This version is for a non-rtos system

GUI_TIMER_TIME GUI_X_GetTime(void) {

  //return OS_TimeMS;

    return (GUI_TIMER_TIME)glbMilliSecTick;       

void GUI_X_Delay(int ms) {

  //int tEnd = OS_TimeMS + ms;

  //while ((tEnd - OS_TimeMS) > 0);   

      int tEnd = (GUI_TIMER_TIME)glbMilliSecTick + ms;

      while ((tEnd - (GUI_TIMER_TIME)glbMilliSecTick) > 0);

Finally, do you have GUIDRV_Template.c with functions tailored for your LCD (if required)

Vitaliy Chernobay
Senior
June 11, 2018
Posted on June 11, 2018 at 22:35

For FREERTOS use GUI_X_OS.c no GUI_X.c

Self.Glenn
Visitor II
June 11, 2018
Posted on June 11, 2018 at 22:58

And do you have your LCD_Initialisation code in LCDConf.c (or its Cube+rtos equivalent)

My apologies if this is all very obvious...

int LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, void * p) {

int r;

(void) LayerIndex;

(void) p;

switch (Cmd) {

case LCD_X_INITCONTROLLER: {

LCD_Initialization();                                    //Call your initialisation code here

GUI_SetScreenSizeY(VYSIZE_PHYS);

GUI_SetScreenSizeX(VXSIZE_PHYS);

//

// Called during the initialization process in order to set up the

// display controller and put it into operation. If the display

// controller is not initialized by any external routine this needs

// to be adapted by the customer...

//

// ...

r=0;

break;

}

case LCD_X_SETVRAMADDR:

r=-1;

break;

etc...

Vitaliy Chernobay
Senior
June 11, 2018
Posted on June 11, 2018 at 23:04

�?�ou are absolutely right, you must first initialize the Solomon's display controller 

LCD_Initialization();                                    //Call your initialisation code here

abdberkana
Associate
June 12, 2018
Posted on June 12, 2018 at 07:29

Yes i do have the initialization code '

LCD_Initialization();

' but in main called right before 'GRAPHICS_Init();'
Vitaliy Chernobay
Senior
June 12, 2018
Posted on June 12, 2018 at 19:42

0690X0000060BdsQAE.png

set breakpoint at the function

GUI_ALLOC_AssignMemory

GUI_DEVICE_CreateAndLink....

You can determine the function on which the program hangs

P.S. Bug in CubeMX

https://community.st.com/0D50X00009XkXi3SAF

David George
Associate III
June 14, 2018
Posted on June 14, 2018 at 09:50

emWin Init needs the CRC module enabling as it does a CRC Check on memory - this caught me out once!

Check the CRC Module is clocked and enabled, my STM Code look like this;

/** @note The emWIN GUI_Init() uses the CRC Module to perform a memory

 * check - so the CRC clock must be enabled before calling GUI_Init.

 */

 __HAL_RCC_CRC_CLK_ENABLE();     /* Enable the CRC Module */

David.

Vitaliy Chernobay
Senior
June 14, 2018
Posted on June 14, 2018 at 15:45

CubeMX is set CRC module if use GRAPHICS module

abdberkana
Associate
June 14, 2018
Posted on June 14, 2018 at 15:40

I will check it on the hardware and update you.