2020-07-21 04:45 AM
I’ve always wanted to use my large TV screen as a graphics display for my projects. Just in case others are wanting to do the same I thought I would share this...
After a lot of messing around, I have found that it is possible to display a full screen image (mono) on a HD TV display using an STM32L4.
Since most TVs these days don’t have VGA connectors, I have had to resort to using a VGA-to-HDMI adapter. I bought one from Amazon (“Gana�? brand) - it works well. The only problem is that most VGA resolutions don’t fill the entire screen, the only resolution that fills the entire screen is 1920x1080@60Hz (my original plan of using a 640x480 resolution had to be ditched)
1920x1080@60Hz requires a pixel clock of 148.5MHz - fairly demanding. But if you reduce the resolution by a factor of four to 480x270@60Hz you can get away with a pixel clock of 37.125Mhz. 480x270 resolution also allows you to get two buffers into 64K of RAM.
I used a 27MHz crystal to provide the system clock of 74.25 MHz and SPI/pixel clock of 37.125MHz (27/2=13.5, x11=148.5, /2=74.25...)
Each of the 270 vertical lines in memory had to be repeated 4 times to fill the 1080 vertical lines on the TV.
This required some very time critical interrupt routines and DMA. I used Timer 2 (multiple channels) to provide Hsync pulse and to sync DMA bursts. Timer 15 was driven by Timer 2 to provide Vsync.
The display is rock solid (no jitter) and the resolution is quite usable for my applications.