Skip to main content
HP_it
Senior II
August 8, 2019
Solved

Creating a new task for HW interaction

  • August 8, 2019
  • 2 replies
  • 1446 views

Hello,

I'm trying to extend the example given in 'Method 2 - From other task', given here: https://touchgfx.zendesk.com/hc/en-us/articles/205074561-Connecting-the-UI-to-your-system

I am using the 746-Disco board and the example works just fine on my hardware.

My end goal is to have a task in the RTOS that can handle serial communication and send along info to the screen model (or transmit data entered on the screen).

to get started I have created a new task (serial_task) and placed it in serial.c (and serial.h). Basically I have just copied the 'condenser.c/.h' file combo and renamed the functions.

I have added serial.h to main.cpp and serial.c to the makefile.

I can compile just fine and I can even swap the two tasks around.

what I can NOT do is get them to work side by side.

In my main.cpp I have this:

xTaskCreate(condenser_task, (TASKCREATE_NAME_TYPE)"CondenserTask",
 512,
 NULL,
 configGUI_TASK_PRIORITY+1,
 NULL);
			 
	xTaskCreate(serial_task, (TASKCREATE_NAME_TYPE)"SerialTask",
 512,
 NULL,
 configGUI_TASK_PRIORITY+1,
 NULL);

but when I program the hardware the button is not responsive. If I don't start my serial task The system works just fine.

This is my serial task:

void serial_task(void* params)
{
	
 BSP_LED_Init(LED_GREEN);
 
 for(;;)
 {
 vTaskDelay(1000);
 
 BSP_LED_Toggle(LED_GREEN);
 
 }
}

I have removed the calls to the LED init and toggle from the condenser task.

Funny thing is that even if I don't start my serial task (which should handle the LED blinking stuff) the LED is still blinking (very fast)

I've also included serial.h into the model.cpp. I have no compiler problems but the system freezes.

Does someone know something obvious that I'm missing?

This topic has been closed for replies.
Best answer by Martin KJELDSEN

Oh, it could be something else. We toggle the LEDs in our application templates to visualize performance. VSYNC and RENDER TIME. So you may be seeing that (vsync signal is fast, for instance). You could edit GPIO.cpp to remove any interaction with gpios so that it is only your own task that does anything with leds.

/Martin

2 replies

HP_it
HP_itAuthor
Senior II
August 8, 2019

Ah,

I might have found the answer myself - Heap size.

I changed the TOTAL_HEAP_SIZE to 6600 and reduced the task stack size to 128 - now the RTOS is running.

However - and this might be of importance. Even if I comment out EVERYTHING in my serial_task - that is ALL that should toggle the green LED on the board. it is still blinking happily away. I don't have any references to the toggling function anymore?

Anyone with similar issues?

Martin KJELDSEN
Principal III
August 8, 2019

Hi @HP​,

Doesn't sound like that's the code running on the board, then. Could you reprogram it to verify?

/Martin

HP_it
HP_itAuthor
Senior II
August 8, 2019

I just tried to download another test application and then this one back on. It downloads just fine.

The files i've been messing around with is located in the 'target' folder. I can see that TouchGFX designer continually updates IAR/IAR8.X/KEIL and the simulator builds but only when I press 'program target' the GCC part is invoked.

Therefore I have only updated the makefile to include my own custom task .c file.

That should be enough right?

I have attached the project as well if you want to have a look at it.