2019-08-08 10:25 AM
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?
Solved! Go to Solution.
2019-08-09 03:55 AM
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
2019-08-08 10:42 AM
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?
2019-08-08 12:21 PM
Hi @HP,
Doesn't sound like that's the code running on the board, then. Could you reprogram it to verify?
/Martin
2019-08-08 01:57 PM
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.
2019-08-09 01:54 AM
Hi,
Yes, updating projects is a part of the "Post generate"-command. You can see the entire command inside your .touchgfx file towards the bottom. And yes, any custom files should just be added to the
include_paths :=
source_paths :=
2019-08-09 02:13 AM
Thanks for that info!
I'm still unsure if I have checked properly if my project loads as it should.
I've added my extra file to the source files list:
source_files += $(os_wrapper) $(makefile_path_relative)/gccstubs.cpp target/main.cpp $(board_cpp_files) \
$(bsp_path)/source/BoardConfiguration.cpp \
$(bsp_path)/source/GPIO.cpp \
target/condenser.c \
target/serial.c
It's located in the same folder as condenser.c so I shouln't need to add any paths to this.
There is only one reference to condenser.c so I can't see anything else missing. could it be caused by some hardware not being reset properly?
when I run the example as-is the LED is blinking very fast (50Hz-ish) and dim. when I push the button to activate the animation the LED gets brighter but still blinks very fast. I guess the 100 tick delay in the task is not milliseconds (as fas as I understand the RTOS docs) so it's just a symbol of how fast the messages gets passed along the queue.
2019-08-09 03:55 AM
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
2019-08-09 04:18 AM
Nice, thank you!
Now I have a separate task that toggles the LED. I know it's not much but running alongside the TouchGFX demo I feel that I have just done a Hello world example.
Much rejoice, such happy!
Now I will go on and try interfacing with the serial port.
2019-08-09 04:23 AM
That's definitely a good hello world example =) Great! If there's anything else don't hesitate to ask.
/Martin