2023-10-08 08:59 AM - edited 2023-10-10 11:26 AM
Hi, i am making a project with the ST NUCLEO F401Re using a TFT display of MCUFRIEND (not so good display), and the implementation is running with touchGFX 4.22.0.
The display works with data serial using 8 pins of data and 4 to control (just for context).
I have been making the entire UI and it works fine, but the problem is each time i need to swap from one screen to other, the refresh delays quite much in update all the screen (you can see the screen updating from top to buttom maybe like half second or less).
I am not sure but i think the problem might be my display.
For other side i noticed that if i am in one screen, and change widgets like buttoms, slider and so one the response is good and one cant notice the refresh.
Because i have the same background in all the screens (i attached the images of some of them) i was wondering if it is posible to not update the bockground but the widgets and texts only .
If someone have any idea or suggestion it will be very appriciate.
More info about the project:
Display
I am using a TFT display of 3,5'' and 380x420 dimensions . The product was made by a company called "MCUFRIEND" and its a module with a touch screen, TFT displays and SD card slot (wich i am not using).
The display works with paralel 8 data pins, being the data format of 16 bits (most of the comands are 8 bits but to write on the display you send 16bits data).
To control the display i have been working with MCUFRIEND library which is used for many types of displays controlers. In my case i found that i my controler was an RM68140.
The touchscreen has a 4 wire controller, so it´s use 2 wires for each axes. For other side, the display also have 5 pins to control betwen comands and other kinds of data. Because the board use the same 4 pins to check the touch screen and controll the display, is necesary to make an multiplexation betwen each function. (I make it changing pins direction, readding the ADC to know the position press and going back to display control).
I addapted the code to works with my controller and only use the drivers functions that i need for my aplication (so i reduce code and ejecution times).
The drivers i use are the following (i only add waht i think is relevant code, but if you need all the code or another function tell me and i add the rest).
// Function that i pass to touchGFX to write on the display.
#define write8(x) { write_8(x); WRITE_DELAY; WR_STROBE; WR_IDLE; }
#define CS_ACTIVE PIN_LOW(CS_PORT, CS_PIN)
#define CS_IDLE PIN_HIGH(CS_PORT, CS_PIN)
#define WR_STROBE { WR_ACTIVE; WR_IDLE; }
#define WRITE_DELAY { WR_ACTIVE; }
#define WR_ACTIVE PIN_LOW(WR_PORT, WR_PIN)
There is an init function and so on but i think they don´t have any to do with my actual problem.
Note that i know (now) that spi is better than this scheme to send data , i really do, but now i am working with that display and i could not change it.
TOUCHGFX info:
About touchGFX i am using none transition betwen screens
And for the background i make an container so i garante that al the backgrounds are the same.
RTOS SO
I know that i have mentioned this at begging, but i am using RTOS to work with TouchGFX. Those are the task and configurations that i have make:
//TASKS CREATES
xTaskCreate(TouchGFXSYNC_process, "GFX SYNC", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL);
xTaskCreate(Touchscreen_process, "UPD TS", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL);
xTaskCreate(TouchGFX_Task, "UPD GFX", 2000, NULL, tskIDLE_PRIORITY + 2, NULL);
// TASKS
I think i tell you all the relevant but if i forgot something don't hesitateto tell me i will add all you need.
Best regards Guido
2023-10-10 04:49 PM
As i responded to @AScha.3 , i did not checked the timming. I will do it in next days.
I think a good option is to not update al the screen so i reduce the number of pixel i have to send. But i have no idea if it is posible to do with TouchGFX.
Thanks for your help!
2023-10-10 10:52 PM
while(1){
touchgfxSignalVSync();
vTaskDelay(pdMS_TO_TICKS(5));
}
Change vTaskDelay(pdMS_TO_TICKS(1)); or
2023-10-12 11:42 AM
@Panchev68 well changing that time i gain some time in each transition. Anyway the laggi animation persists. Thanks for the advise.
2023-10-12 11:51 AM
@MM..1 The time of write8() is 78 clock cycles. In this case is about 0.976uS for each 8 bit write.
Analysing the time per line update the measure was about 3,18mS.
So in this case (380 pixels hight display) is 1,2 seconds, wich correspond to refresh update that i see
So in 380 hight displays is 1,2 seconds wich correspond to refresh update that i see.
2023-10-13 06:18 AM - edited 2023-10-13 06:21 AM
For good displaying you need pixel16bit transfer around on 10MHz . You now have 0,5MHz. Required speed up 20x
But primary i dont understand your 78clock cycles ?
Secondary your MCU is underpower for your LCD size. Partial buffer with some DMA is solution.
uint16_t cant;
const uint32_t total_data = h * w;
for(cant = 0;cant < total_data ;cant++)