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
SimonF
Senior

Hello @Community member​ , @Martin KJELDSEN​ ,

I'm facing the same problem with the STM32L4R9-discovery.

I have a file called app_main.c in which there is the function "app_main_task" which is called from the mainTask in main.c

In the function "app_main_task" I do :

if(newMessage == true)
{
		newMessage = false;
		msg = 1;
		if(osMessageQueuePut(queueToUIHandle, &msg, 0, 0)  != osOK)
                {
		//DO stuff
	        }
}

My queue is defined as : extern osMessageQueueId_t queueToUIHandle;

In Model.cpp I'm doing :

if (osMessageQueueGet(queueToUIHandle, &msg, NULL, 1) == osOK)
{
		//uint8_t i = 8; // Dummy code
		//i = i + 1; // Dummy code
		if(msg == 1)
		{
 
		}
	}

If I use uint8_t or bool or whatever there is no problem but if I use the osQueue the HardFault_Handler is called.

The Fault Analyser is telling me that : "Bus, memory management or usage fault (FORCED)" and "Attempt to switch to invalid state "INVSTATE". And sometimes I get instead "Attempt to execute an undefined instruction (UNDEFINSTR). If I put code in my if or not, if I add dummy code or not, the behaviour is different : not always the same usage fault, in some case program is working but screen is stucked, etc.

I can create a new issue but it seems to be the same problem !

Thanks,

Simon

Did you check your FreeRTOS heap settings before you started adding more tasks?

/Martin

Hello Martin,

You are right, if I put it in a default task it seems to work but not in my defined task.

However I don't understand why my own task does not work ^^.

If you mean the "FreeRTOS Heap Usage" in CubeMX, it is correct (I still have 6000 bytes of space left).

The behaviour is the same if I create my task as static or dynamic. It is also the same if my size is 128 or 512 or even 1024.