cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX : FreeRTOS Queues for controlling LED from TouchGFX Button and Hardware Button to TouchGFX Text Area Update:

Karan 123
Senior

Hi,

I am working on below setup:

Software Tool Chain:

STM32CubeMX 5.6.0

STM32CubeIDE 1.3.0

TouchGFX 4.13.0 Designer

Application Template STM32F746G Discovery Kit v3.0.1

I am trying to do send/receive messages with Message Queues.

1) From TouchGFX Toggle Button to LED.

2) From Hardware Button to Text Area

as per below thread.

https://community.st.com/s/question/0D50X0000AU4zodSQB/interfacing-with-hardware-in-touchgfx-applications

Program Successfully Build . But Still not succeeded to Work on Actual Hardware.

1) From TouchGFX Toggle Button to LED.

LED is not OFF/ON with TouchGFX Toggle Button

2) From Hardware Button to Text Area Update

HardFault and/or MemManage_Handler

Because I have changed priorities and Heap .

0693W000000WTJpQAO.png

 Can anybody look attachment ? Guide me What needs to be correct ?

To solve the problem .

--

Karan

22 REPLIES 22

This is not due to a bug, it's a hardware/OS configuration issue - we just have to find it. The GUI isn't even in play yet here.

To make things a bit easier, maybe check out some of the CubeFW GPIO examples or even the example i made for the "Integratiing UI and Hardware" webinar in the top sticky.

E.g. start by sampling directly in the GUI Task ( Model::tick() ) before FreeRTOS is in play. Then move on to interrupt based / FreeRTOS Queue based.

/Martin

Hi,

@Martin KJELDSEN (ST Employee) Thanks for update ..

The below code without TouchGFX Works well..

while(1) 
 { 
	if ( HAL_GPIO_ReadPin (BUTTON_GPIO_Port, BUTTON_Pin) == GPIO_PIN_SET ) 
	 {
 		 HAL_GPIO_TogglePin(LED_GPIO_Port , LED_Pin) ; 
        	 HAL_Delay(300) ; 
		 printf("HELLO \r\n") ; 
            } 
  }

But Code worked on simulator Updating TextArea WildCard Perfectly ..

I have made some changes/correction in code attached at Msg #1.

After doing some experiments cause to Fault Situations.

 ( xQueueReceive(ButtonQueueHandle, &msg , (TickType_t)10) == pdTRUE)

Please Find updated files as works on simulator and touchgfx simulated short video..

as below method.. as per you webinar "Integratiing UI and Hardware"

0693W000000WXrgQAG.png

Please Find attachment ..

--

Karan

Karan 123
Senior

These are updated files here.

Hi,

@Martin KJELDSEN (ST Employee) ..

Please Let me know . How to sort out this problem ..?

--

Karan

HP
Senior III

I think there is an error in your model.cpp

I'm referring to my own example in this video: https://www.youtube.com/watch?v=majcfxr3u2E

The model looks something like this:

extern "C"
{
	xQueueHandle messageQ;
}
 
Model::Model() : modelListener(0)
{
	messageQ = xQueueGenericCreate(1,1,0);
}

So I can see two things different in your setup:

  1. you have a osMessageQId instead of a xQueueHandle. I have no idea if they are actually the same type.
  2. in modelListener I create a queue and assign the handle to it. You don't have that call and that could be why the hardfault occurs?

Lastly you wait 10 ticks for your messages. I don't think that it is needed or it helps anything. I can't recall if the waiting is a blocking call or not. If it is you have reduced your framerate a bit.

Karan 123
Senior

@HP (Community Member)

Many of Thanks for your time , code and link.

1) The Code successfully build .. Without any issue(s) and error(s).

2) From TouchGFX Button to LED .. Works well on Simulator and Board as well .

3) From Hardware Button to TouchGFX TextArea WildCard.. Works well on Simulator but NOT on Board ( Hardfault ) .

I have Listen Integratiing UI and Hardware" webinar from @Martin KJELDSEN (ST Employee) ..

Technically, Your approach in youtube video and mine approach as same (I think).

Did you run your code with Hardware Button on STM32746G-DISCO Board.?

--

Karan

well, I didn't use a button but I did use a queue. your button sampling code looks fine.

Did you try and change the code with my suggestions?

The simulator and hardware is similar but not completely similar so there's a pitfall.

Looking at your model..

walk through it with me.. if you get a message you call btnPressed()

Inside that method you do what? I think you intend to call the 'IncrementUpdate' method in the presenter, but you don't. you call the btnPressed() again? is that right?

Karan 123
Senior

Here are Code snapshots..

Please check updated One

0693W000000WbmGQAS.png

0693W000000WbmBQAS.png

The I did also use xQueueReceive(LEDQueueHandle , &led_msg , 0) worked well on Hardware LED in same (this) application ..

My ADC , UART code working fine with Semaphore (without Queue).

I will check your code suggestion tomorrow.

Thanks

--

Karan

Hi,

@HP (Community Member)

This method works.. Thanks for that ...

@Martin KJELDSEN (ST Employee) 

1) Is it mandatory to create "Queue" inside the Model::Model() in Model.c ?

2) If Yes, Why cmsis syntax complied but same HardFault ...

 osMessageQDef(ButtonQueue, 1, uint16_t);

 ButtonQueueHandle = osMessageCreate(osMessageQ(ButtonQueue), NULL);

Or Any other Issue .. Please Update..

0693W000000WdWoQAK.png

0693W000000WdWyQAK.png

Any Way Thanks..

--

Karan