cancel
Showing results for 
Search instead for 
Did you mean: 

Background redraw problem

guidoglorioso01
Associate II

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 .

 

guidoglorioso01_0-1696780507394.png

guidoglorioso01_1-1696780517356.png

guidoglorioso01_2-1696780534651.png

guidoglorioso01_3-1696780552366.png

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).

guidoglorioso01_0-1696960296409.png

guidoglorioso01_1-1696960325947.png

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.

void drawRGBBitmap(uint16_t x, uint16_t y, uint16_t *bitmap, uint16_t w, uint16_t h){
    setAddrWindow(x, y, x + w - 1, y + h - 1);
    CS_ACTIVE;
    WriteCmd(_MW);
    uint8_t hi , lo;
    uint16_t cant;
    const uint32_t total_data = h * w;
    for(cant = 0;cant < total_data ;cant++) {
hi = bitmap[cant] >> 8;
lo = bitmap[cant] & 0xFF;
write8(hi);
write8(lo);
}
    CS_IDLE;
}

#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

guidoglorioso01_2-1696961811267.png

And for the background i make an container so i garante that al the backgrounds are the same.

guidoglorioso01_3-1696961912999.png

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

void TouchGFXSYNC_process(void *arguments){
extern void touchgfxSignalVSync(void);
 
while(1){
touchgfxSignalVSync();
vTaskDelay(pdMS_TO_TICKS(5));  
}
}
 
void Touchscreen_process(void *arguments){
 
while(1){
mde_TS(); // State Machine to work with the touch controll reducing debouncng and so on.
vTaskDelay(pdMS_TO_TICKS(10));
}
}
// Conection with TOUCHGFX drivers
static uint8_t isTransmittingData = 0;
 
uint32_t touchgfxDisplayDriverTransmitActive(void)
{
return isTransmittingData;
}
 
void touchgfxDisplayDriverTransmitBlock(uint8_t* pixels, uint16_t x, uint16_t y, uint16_t w, uint16_t h)
{
isTransmittingData = 1;
drawRGBBitmap(x,y,pixels, w, h);
isTransmittingData = 0;
DisplayDriver_TransferCompleteCallback();
}
 
I do not tell it sooner beause i also try the display without FreeRTOS and the results were the same so i discard this as a problem.

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

14 REPLIES 14
MM..1
Chief II

Your info is zero technical info. 8pin plus ... isnt serial interface. 
Start with speed of rendering your screen and used bus info

Osman SOYKURT
ST Employee

Hello @guidoglorioso01 ,

Which transition do you have when changing between your screens? 

OsmanSOYKURT_0-1696853293029.png

Osman SOYKURT
ST Software Developer | TouchGFX
Panchev68
Senior

If you use SPI (partial buffer), TouchGFX does a great job. There is no delay. Give more information about the interface you are using, because I can only guess! And also the settings of the interface.

 

Hi @MM..1 , you are right. Sory for the poor information i am really new in forums. I added all the information i think relevant in the post. Thanks you.

Hi @Osman SOYKURT , i am using none transitions betwen screens. 

Thanks for the help.

Hi @Panchev68 , thanks for the advise, but i am using this screen and i cant change it :( . In a future i will have this present. 

..and what is : PIN_LOW(xxx) ?

HAL ..LL or what then?  this is about speed of access, did you test your timing ? screen shot on DSO ?

at 380x420 pix , you get about 300k 8bit accesses; what is minimum access time of your display ?

because 1us -> 0,3 sec full screen update... you see the problem ?

 

If you feel a post has answered your question, please click "Accept as Solution".
MM..1
Chief II

Your code seems be sw emulation of 8080 interface. F4 have types with hw support this mode, i dont remember if 401 have FMC. As ASha writes how is your one write8() time?

All the functions touch directly the registers. In this case PIN_LOW() implementation is the next:

#define PIN_LOW(port, pin) (port)->BSRR = (1<<((pin)+16)) 
#define PIN_HIGH(port, pin) (port)->BSRR = (1<<(pin))

also the implementation of write8() is the next:

#define write_8(d) { \
GPIOA->BSRR = 0x0700 << 16; \
GPIOB->BSRR = 0x0438 << 16; \
GPIOC->BSRR = 0x0080 << 16; \
GPIOA->BSRR = (((d) & (1<<0)) << 9) \
| (((d) & (1<<2)) << 😎 \
| (((d) & (1<<7)) << 1); \
GPIOB->BSRR = (((d) & (1<<3)) << 0) \
| (((d) & (1<<4)) << 1) \
| (((d) & (1<<5)) >> 1) \
| (((d) & (1<<6)) << 4); \
GPIOC->BSRR = (((d) & (1<<1)) << 6); \
}

I do not use HAL functions in this case to gain some extra time in execution.

For other side i did not checked de timming, i will do in next days and attach the results. But i think it could be the problem.  Because of the timming in data transfer is why i asked if it is posibble to not send all the time the background, so i gain time not sending the same data.

Thanks for the help!!