Pi Zero Video Card Via Bare Metal Programming

Rolling your own synthesizer is no small feat, which is what [Thomas] has taken on with his project “Nerdsynth”. [Thomas] has an impressive amount of data on his site covering the overall design and progress of the project, but that isn’t what piqued our interest. [Thomas] has an on-board TFT display to navigate the versatile Nerdsynth’s menu nerdsynth-sketchbut he wanted to add video output to  do some video sequencing. After some investigation and poking around the available options he decided to tackle yet another sub-project (textbook scope-creep).

[Thomas] chose to do to some bare metal programming on the Pi Zero to use it as a video card for video output. By following a tutorial  from Valvers and modifying an SPI driver from Microelecroniki he was able to clone the video on an external monitor. This is a step in the right direction and we’ll have to keep an eye on his site for updates about video sequencing on the external display.

You can check out a recent demo of the Nerdsynth in action after the break, sadly you’ll have to settle for a pic of the cloned screen (below) until [Thomas] posts another update.

nerdsynth_tv-942x707

https://www.youtube.com/watch?v=Uy1dT0vTwQE

If you aren’t familiar with the term “Bare Metal Programming”, it refers to writing code that runs directly on the hardware. In fact we have discussed bare metal assembly on the Pi before. So think of “bare metal” as code running without an underlying operating system, as close to the machine language as possible, short of writing the program in machine language. The next closest language (that’s more than 7 years old, sorry Rust) would be assembly language. Assembly is that code you’ve noticed in datasheets but they never really say: “These instructions are in assembly language”. Another popular alternative is C, which will allow inline assembly if you really need it.

10 thoughts on “Pi Zero Video Card Via Bare Metal Programming

    1. You think a propeller would be better for this? Why exactly? Because the mention of assembler? Did you watch the video? I simply cannot imagine a propeller working nearly so well.

      1. All he’s using the Pi for is bit-banging video, and because that takes all of the processor’s single core for most of the day that’s ALL it can do. You can’t service interrupts while bit-banging video so most of the rest of the Pi hardware is useless. But the Propeller was designed to do this kind of thing. Of course, you can’t get a whole board for $5 like the pizero gimmick, but you’d probably be using at most three cogs to do the video leaving five for other uses like bit-banging SPI or other I/O.

        1. There is no video bitbanging involved here. I just fill the framebuffer and the pi + gpu are doing the rest. In fact the only point i use processor ressources is the incoming SPI data processing and when writing to the framebuffer. So for static screens the core is practically idle.
          And in the example there are also interrupts serviced.

    2. Yes i checked that option, too. But i dropped VGA in favour to at least composite. And here we got a video card for $5, more than enough memory for the framebuffer and it even got HDMI + doesn’t require soldering parts in small packages.

      1. You’re right, the price is unbeatable.
        I really like the idea of using a microcontroller for the hard realtime tasks, and letting a Pi Zero handle the user interface, network and mass storage. Cheap, powerful and clever. Imagine having a ready made image for that, plus a powerful library for the micro (did anybody say Arduino?).

  1. Wow.. Really cool: a dedicated MOD tracker box! Ambitious also! This could easily have a commercial future – many people want a device like this, and no manufacturer has really tried. There are some similar things, but by the time they hit the market they are often nudged more towards general purpose groove box type use.

    Also love the VU meters for individual tracks (sounds?)!

Leave a Reply to ChrisrianCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.