ILI9341_t3n performance problems in the processing of messages via the serial interfa

Hi everyone!!

I'm working in a EFIS emulator project to RC airplanes using the ILI9341_t3n library.
I am having some performance problems in the processing of messages via the serial interface when use updateScreen.
For some reason, when using updateScreen or waitUpdateAsyncComplete, the serial response is slow.
The messages are received by serial using the Mavlink protocol and the sistem process and emulation of YAW, ROLL, PITCH are displayed on the TFT.

The basic operation is:

1. The serial listens (via interruption) to the flight controller via the serial port (57600) and updates the values of the variables.
2. A Thread runs every 50ms to update the TFT with the variable information.
3. Another Thread runs every 500ms to update the second display.

Update messages YAW, ROLL and PITCH are sent by the flight controller every 250ms.
But for some reason, if I use updateScreen or waitUpdateAsyncComplete, the messages are lost through the serial.

I needed to add some procedures in original TFT9341_t3n library.
void drawArc(int x, int y, int r, int startAngle, int endAngle, uint16_t color);
void drawLineByAngle(int16_t x, int16_t y, int16_t angle, uint16_t length, uint16_t color);
void drawLineByAngle(int16_t x, int16_t y, int16_t angle, uint16_t start, uint16_t length, uint16_t color);

I would like your help if possible. !!!

My project is hosted on: https://github.com/paulopilot/MicroEFIS_Mavlink_T4
 
The serial listens (via interruption)
I don't think this is correct - i.e. it is not interrupt driven. You have to arrange your code such that it calls handle_Messages more frequently than the heartbeat timeout, which is ten milliseconds. If, for example, updateScreen takes more than 10ms to execute, the next time you call handle_Messages it will timeout and completely reset the serial link which will throw away anything that might be in the buffer at that time.

One thing I would try is to increase the value of heartbeatInterval_RX (in MavlinkFunctions.h). Maybe try 20ms and see what happens. If it works, try 15ms. If not try 40ms.

Your setup function initializes the default SD card (with CS on pin 10) but your diagram doesn't seem to have a CS specifically for an SD card. Could this be interfering in some way?

Pete
 
Thank you Peter.

I will try to explain the problem better.

The drawEFIS () procedure needs approximately 40ms to complete. It reads the values ​​of the variables, prepares the buffer and displays it on TFT.

The mavlink MAVLINK_MSG_ID_ATTITUDE protocol message is sent by the flight controller every approximately 250ms. (It has the PITCH, ROLL and YAW information)

However, when I use updateScreen ()to update the information on TFT, for some reason I don't know yet, some MAVLINK_MSG_ID_ATTITUDE messages seem to be lost.

I tried to run the handle_Messages () procedure in three different ways:
1. using thread,
2. inside the main loop();
3. using serial interrupt;

But the problem occurred in the three forms used.

The way that it worked correctly was to use the updateScreenAsync() procedure at the end of drawEFIS() and increase the thread time to 50ms to avoid flickers.

About SdCard. In the tests I am not using the SdCard yet.
 
Call handle_Messages from the loop() function and try increasing the heartbeatInterval_RX as I mentioned in #2. When the messages are occurring one every 250ms, there's no need for the receive timeout to be so brief.

Pete
 
Back
Top