ILI9341_t3n reentrancy?

mborgerson

Well-known member
I'm working on a camera application where I use an ILI9341 display as a viewfinder. That part is working well and I can update the viewfinder at 15FPS completely in the background.

That part works like this:

Each camera frame collected by the CSI generates and End-of-Frame interrupt.

1. The EOF handler shuts off the CSI and starts an interval timer with a period of 33.33mSec (one frame time at 30FPS).

2. Now that the CSI is shut down, the interrupt handler starts a Pixel Pipeline process to scale the camera VGA image to
QVGA and convert from the camera YUV color space to the RGB565 color space of the ILI9341. The QVGA output
buffer is in DTCM. I've found that I have to shut down the CSI while the PXP is reading the frame buffer in EXTMEM because
the PXP and CSI don't play well together when competing for EXTMEM access.

3. While the PXP is running in the background and the program returns to the foreground (loop) until the interrupt at the end of
the PXP operation.

4. At the end of the PXP operation (which takes about 20 to 25mSec) the PXP interrupt handler starts a TFT_UpdateAsynchronous
operation and returns to the foreground loop.

5. When the interval timer expires, it's handler restarts the CSI to collect the next frame.

The result of all these interrupts is that I only lose about 1% of the CPU processing time while the background stuff updates the ILI9341
display.

Now here's the catch: I would like to shrink the viewfinder display a bit and use some of the free LCD area to display file names and manage
a simple GUI. I've already found out that I can't access the touch screen controller while the TFT_UpdateAsynchronous is in progress---they compete
for the SPI. I now handle that by reading the touch controller in the EOF interrupt handler, just after I start the PXP.

I still have to figure out when to update the GUI. I have to figure out how to update the GUI part of the LCD display without interfering with the
background viewfinder
updates.

I have two possibilities in mind:

1. Maintain the GUI display in a separate buffer, and use tft.writerect to merge that buffer into the image buffer before updating the display. I suspect that foreground
operations on the GUI buffer may mess up background update operations because I will have to switch tft to use the other buffer. I think I can manage that by instantiating a
second tft2 object and using that to draw the GUI in the foreground while the other tft transfers the image buffer to the LCD after a writerect from the GUI buffer to the image buffer.

2. Synchronize the foreground GUI operations to the end of the asynchronous LCD updates. When the asynchronous updates are finished, I will have at least a frame time to update the GUI
into its buffer. The background LCD updates will have to restore the buffer pointer to point to the merged image buffer.


Are there other ways to handle the mixture of continuous viewfinder updates and intermittent GUI updates?
 
Since you are already using the Pixel Pipeline and you should have enough memory with EXTMEM you could use a separate buffer for the GUI and use the color keying option to blend the two together, I believe that adding the AS layer doesn't add any extra time to the pipeline process. The separate GUI buffer means you don't have to redraw every control with every update unless they change so you can save some processing time there.
 
Back
Top