STM32: Problems Connecting a Display via LTDC.
In one of my previous articles I described how to connect a display to an STM32 microcontroller using the LTDC interface. The article ended with a video showing an image on the display built into the DISCOVERY board. Naturally, my next wish was to run something bigger and connect it myself, so that I'd have a complete picture in my head. I ordered a 7-inch display with an RGB interface and a capacitive touchscreen from China.
While it was on its way, I studied the documentation for the driver that controls it, and on forums I kept seeing questions like "If STM32 has a built-in display controller, why do we need a driver?" The thing is, controlling the liquid crystals, or more precisely the gates of the FETs that drive them, requires two voltages, VGH and VGL, 19V and -5.5V respectively. The MCU itself can't output such voltages; it only sends signals to the driver according to the RGB interface, and the driver replicates them at the required voltage.
The display arrived, and connecting it raised no questions. Getting it to start wasn't difficult either, but it refused to work properly. The problem was that when using two layers, the image on the display periodically jittered. After rereading AN4861 once more, I realized that the problem was the pixel clock.
The thing is, the display I bought in China has a resolution of 1024x600, and for the image to refresh 60 times per second the pixel clock must be in the range of 45 to 63 MHz.
At the same time, AN4861 has a table on page 37 showing that when using 16-bit SDRAM, which is exactly what is installed on the DISCOVERY, and two display layers with each color encoded in 16 bits, the maximum pixel clock is 39MHz.
Going by the display datasheet, I had pushed the pixel clock to the maximum. After the pixel clock was lowered to 37MHz and the second layer was reduced to 320x320, the display worked without artifacts. When the second layer was enlarged, the artifacts reappeared; and yes, I forgot to mention that the first layer occupies the entire visible area.
There are three ways out of this situation: use one layer with a color depth from 8 to 24 bits, use two layers with a lower color depth, which lets you reach the required pixel clock for the display, or replace the RAM with a 32-bit one.
And the conclusion from this situation is as follows: before buying a display, you need to check whether the RAM bandwidth will be enough to drive it.
While it was on its way, I studied the documentation for the driver that controls it, and on forums I kept seeing questions like "If STM32 has a built-in display controller, why do we need a driver?" The thing is, controlling the liquid crystals, or more precisely the gates of the FETs that drive them, requires two voltages, VGH and VGL, 19V and -5.5V respectively. The MCU itself can't output such voltages; it only sends signals to the driver according to the RGB interface, and the driver replicates them at the required voltage.
The display arrived, and connecting it raised no questions. Getting it to start wasn't difficult either, but it refused to work properly. The problem was that when using two layers, the image on the display periodically jittered. After rereading AN4861 once more, I realized that the problem was the pixel clock.
The thing is, the display I bought in China has a resolution of 1024x600, and for the image to refresh 60 times per second the pixel clock must be in the range of 45 to 63 MHz.
At the same time, AN4861 has a table on page 37 showing that when using 16-bit SDRAM, which is exactly what is installed on the DISCOVERY, and two display layers with each color encoded in 16 bits, the maximum pixel clock is 39MHz.
Going by the display datasheet, I had pushed the pixel clock to the maximum. After the pixel clock was lowered to 37MHz and the second layer was reduced to 320x320, the display worked without artifacts. When the second layer was enlarged, the artifacts reappeared; and yes, I forgot to mention that the first layer occupies the entire visible area.
There are three ways out of this situation: use one layer with a color depth from 8 to 24 bits, use two layers with a lower color depth, which lets you reach the required pixel clock for the display, or replace the RAM with a 32-bit one.
And the conclusion from this situation is as follows: before buying a display, you need to check whether the RAM bandwidth will be enough to drive it.


