Progress on the video card firmware

A project log for Twitter feed on an old LED marquee

An adventure in '80s electronics and embedded Linux

Enrico GueliEnrico Gueli 05/29/2022 at 09:150 Comments

The firmware development on the "video card" is going along nicely. I took an example project for the FRDM-KL25Z that was sending SPI data with FreeRTOS. Then I modified it to control the LED drivers via SPI.

You can have a look at the source code here:

I created a different task that runs a test animation. The two tasks communicate via a FreeRTOS queue: the queue contains image data (154 bytes to represent a full bicolor bitmap), and is just one item big.

The LED driver task is a loop, that retrieves an item from the queue and copies it into its buffer. If the queue is empty, no copy happens and it just reuses what was previously in the buffer. It then proceeds to display what's in the buffer, row by row, alternating red and green LEDs. It does so by sending the 11 bytes containing enough data to fill all the shift registers (74HC595-like) via SPI, in a format that the '595s are happy with. The task then waits 1ms between each scan (that's what the original circuity was doing). It takes 14ms to do a full scan, leading to slightly more than 60fps.

The task code also has a function that other tasks can use to submit new images. This function simply overwrites whatever is currently in the queue ("drop-oldest"), so the new image will be displayed as soon as the previous one has finished scanning.

The animation task creates an image buffer, fills it with a simple animating pattern of red and green lines, and submits it with the aforementioned function. Then it waits a couple hundred milliseconds before making a new frame. This task will soon be replaced by one that takes image data from SPI configured as slave, controlled by the Linux machine.