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

1 ACCEPTED SOLUTION

Accepted Solutions
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.

View solution in original post

22 REPLIES 22
Romain DIELEMAN
ST Employee

Hi I have not looked at your code, but please look at this video and the channel. He uses the F746G disco board as well. This might really help you. If not I'll try to have a look when I have more time sorry.

/Romain

HP
Senior III

I've made a video series on exactly this functionality. they're based on the same tutorial you were following:

https://www.youtube.com/watch?v=43qQhrXc3n4&list=PLibkEAAdgBQ-d4LvImVNNDlYKCX0tj6aH

Especially look at video 4 and 5 in the playlist, the describe how to update the GUI from other tasks (using a queue) and updating other tasks from the GUI (using the same queue structure.

HP
Senior III

Also you could try to set a few breakpoints during the init process. how far do you go before you get an error?

How bit is your total stacksize in the RTOS config? it have to be larger than the combined size of your tasks (equal is not enough)

Karan 123
Senior

Hi,

@Romain Dieleman (ST Employee) and @HP (Community Member)

Many of Thanks for Update and video links. I have already seen that videos .

First Let you know I am able to PC send UART to TextArea ,

ADC analog values to to TextArea with Semaphores..

I am trying to do as per below but with STM32MXCube .

https://www.youtube.com/watch?v=jQO7zhX0e0Q&t=2062s

Only with Queues Generated by STM32MXCube 

@HP (Community Member)

In the video, I think you have not used STM32Cube for defining or configuring Tasks and Queues . Right ??

@HP (Community Member)

Yes, I can try .. I have not seen/configure stack size RTOS Config. But Sending Value UART and ADC are working perfectly without changing and looking in Total Stack Size.

--

Karan

Karan 123
Senior

Hi,

After doing some experiment , I found with

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

 {

 // Queue is used as a flag, so don't check msg.

  // Full = PRESSED, Empty = Do nothing.

   btnPressed() ;

 }

Cause HardFault or MemFault..

0693W000000WUrOQAW.png

And Queue is created in main.c and not in Modal.c inside the Model::Model().

0693W000000WUuSQAW.png

--

Karan

Which line causes a hardfault? What does btnPressed() do? Later versions of EWARM have the ability to tell you the offending instruction following a hard fault

 

/Martin

@Martin KJELDSEN (ST Employee)

Thanks for Update ..

1) When I Button Hardware Button HardFault Occurs.

2) When I TouchGFX Toggle NO Response from LED .

3) I am using STM32CubeIDE 1.3.0 .

0693W000000WV1nQAG.png

Can you review my extracted code as attached Msg #1 .. ?

--

Karan

Karan 123
Senior

@Martin KJELDSEN (ST Employee)

1) When I used Toggle Button from TouchGFX - LED ON , OFF Worked

Actually, I missed interaction part from your webinar.

0693W000000WVjzQAG.png

2) When I pressed HardButton - HardFault Still Occurs.

(Hardware Button Just Increment the value in TextArea WildCard )

0693W000000WVlvQAG.png

Can you review my extracted code as attached Msg #1 .. ? Do I need to set / Increase total stacksize in the RTOS config ?

Thanks

--

Karan

Karan 123
Senior

Hi,

When I pressed Hardware Button - Hard Fault Still presists.

(Hardware Button - Just Increments the value in TextArea WildCard )

But Code worked on simulator Updating TextArea WildCard Perfectly ..

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

Is there any issue in code or bug..? Specifically Below line responsible Hard Fault or Memory Fault.

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

 {

  // Queue is used as a flag, so don't check msg.

  // Full = PRESSED, Empty = Do nothing.

   btnPressed() ;

 }

--

Karan