Register / Login  |  Desktop view  |  Jump to bottom of page

tcMenu Designer UI » Menu rendering issue w. the Generator for AdafruitGFX quick start on ILI9341 LCD shield (Adafruit Product ID 1651)

Author: atmosphericengineering
27/11/2022 09:21:30
Hi, I'm a new user and first let me congratulate Dave Cherry et. al. for some fantastic software engineering.
Last week I had quick project success using an Arduino Mega with 16x2 LCD shield with built-in cursor and enter buttons. Now I'm trying my previous project with a rotary encoder (which I've tested as ok) and a 320x240 LCD shield, which has a built-in resistive touchscreen which I'm not using here.
I've tried all reasonable combinations of themes but the best result I get is my project title rendered at the top of the LCD with all subsequent menu items missing. Operating the rotary encoder and selection button has no effect with this ILI9341 LCD. I realise this Adafruit 1651 LCD shield is old hardware but its good value and all I've got atm. I've spotted that your website documentation describes the ILI9341 as "no frame buffer". However the Adafruit documentation describes the 1651 shield as "This display shield has a controller built into it with RAM buffering".
My hardware is all OK as the Adafruit graphicstest example works fine.
Has anyone had any success using an Arduino Mega board with an Adafruit 1651 LCD shield (ILI9341) and/or any ideas to try and make the menus appear and render properly? Thanks for reading.

Author: atmosphericengineering
27/11/2022 12:42:57
UPDATE: I should have done this earlier but I've gone down to an empty user application and I do get menu rendering using the Dark Mode Traditional for small to medium color displays theme. Even with this empty user applications there are some issues such as during editing the Use sliders for analog items appearing ragged and the numeric values can overlay earlier values so that they cannot be easily read e.g. changing from a 3 to a 4 renders the 4 over the previous 3 and produces a corrupted character. Also I have colour palettes seemingly randomly changing and the Mega / Display crashing, sometimes every few minutes. Any ideas on how to proceed / debug? Or is this Adafruit 1651 LCD shield going to be unusable with tcmenu?

Author: davetcc
27/11/2022 13:53:06
We’ve never really tried to generate a high resolution Color TFT graphic display onto an 8bit device but at least theoretically nothing should stop it from working. That display is probably the one we test with the most. What you describe doesn’t sound right. Could you take a photo of the screen with the faulty characters please and attach here. I’ll look into the other issues later. Please also could you zip up the empty project and attach that too so I can take a look at that too.

Author: atmosphericengineering
28/11/2022 15:00:30
Thanks for your reply. Apologies. My previous "empty" application wasn't completely empty and I was also attaching a servo on D9. This clashed with the LCD shield. Once this was removed my empty application now renders tcmenu correctly and reliably.
I'll get to work on what is causing my full application stopping tcmenu from rendering and report back.

Author: atmosphericengineering
02/12/2022 15:03:12
Hi Dave, its interesting that you say that the 320x240 ILI9341 LCD is one you've tested with. I'm using the SPI version, have you tested with this one and/or the parallel interface version?

I've modified my application to run with tcmenu with hardware interrupts on D2 and D3 to detect two reed switches, and a single FreeRTOS task to read and write on Serial at 9600 baud. I can observe my app Serial print output ok, but so far I cant get any Serial reading to work at all. Do you have any ideas or comments about being unable to do Serial reads on a single FreeRTOS task? Thanks.

Author: davetcc
03/12/2022 09:29:25
To be honest we only test with the SPI version on Arduino, with modern hardware and the TFT_eSPI library extremely high speeds can be obtained. On mbed we have an example that uses the STM32F4 LTDC frame buffer hardware (it acts as an ARM peripheral with DMA and memory mapping), the results as you would expect are exceptional, and the boards "STM32F429 DISC1" are pretty cheap with an inbuilt hardware debugger. We also test with Adafruit GFX as well, as a lot of users use that library.

Using FreeRTOS on a Mega 2560? That would seem quite a small board to use a multithreaded OS with, personally, I only use FreeRTOS on much larger boards (STM32F4, ESP32, RPI Pico). Something to bear in mind, some parts of Arduino are not thread-safe, using the Serial object on another thread I've not tried, you'd certainly not want to use it ever on any more than one thread, and there could well be assumptions about what thread it is running on. Especially on a MEGA 2560. I would just use a regular task manager task instead and use Serial.available() to check if anything is there, it does not block.

Something like

taskManager.scheduleFixedRate(10, [] {
    while(Serial.available()) {
        // read a byte from serial here and process..
    }
});


Even within TcMenu, the assumption is that the core rendering code always runs on the main thread. Task manager integrates pretty well with FreeRTOS, so run a task manager loop on the main thread, and then you can offload work using CircularBuffers to be done on other threads.

Author: atmosphericengineering
05/12/2022 14:14:06
SOLVED: Thanks Dave for your great advice. I moved my FreeRTOS serial task to the tcmenu taskManager schedule as you suggested and I can now read from Serial ok. I also restored the baud rate from 9600 to my original 115200 and all was still ok. I haven't tried optimisation like CircularBuffers yet and it still works ok. Thanks again. I'll report back on any optimisations I try later.




Register / Login  |  Desktop view  |  Jump to top of page