Dear all,
Platform Description:
- EW 9.10 Free, on FreeRTOS 10.1.1. + cmsis_os2 (wrapper).
- STM32F429 + External RAM on Custom Hardware
- 800x480 LCD display RGBA8888
- 4-Wire resistive touch screen interface.
The routines for touch measurement are executed on a separate thread on FreeRTOS, which does not belongs to the Gui Task.
ew_Task = osThreadNew( GuiThread, NULL, &ew_Task_Attrs);
tsTask = osThreadNew( touchTask, NULL, &tsTaskAttrs);
Can this cause any issue?
The logic of the reading of the adc are:
1. Config pins for touch event.
2. When event occured a osEvent is triggered and the thread from suspended become active.
3. Do the ADC measurement (adc compelted generate an event too)
4. Once there no more pressure on the display the task reconfigure the pin for touch event and so become suspended again, without draining any system resources.
5. At the end of the conversion & transformation in display coordinate the data are saved into a struct, protected by a semaphore(mutex one).
The EwBspGetTouchPosition call a function which retrive the converted data, Also this function is protected by a mutex with 0 timeout, so the EwBspGetTouchPosition will not be blocked.
bool isTouched(tsAdcValues *ptr)
{
if ( osMutexAcquire(semTS, 0 ) == osOK )
{
memcpy(ptr, &tsEWCopy, sizeof(tsAdcValues));
osMutexRelease(semTS);
return tsEWCopy.isTouched;
}
return false;
}
We are experiencing sometimes that the task in charge of the touchScreen measurements is like suspended while the Garbage Colelctor is running (specifically in Core.c, around line 3413, the function is CoreRoot_Mark(CoreRoot _this) ).
Are we doing something wrong ? Is this a good way to integrate a custom touch screen controller?
Thanks in advance
Davide