Posts

Really really fast GPIO on Linux

Image
Introduction I started down this latest rabbit hole when looking for a way to get high speed data from the "low speed" GPIO header of a Raspberry Pi. I wanted to see if I could drive a parallel Eink display directly from the RPI's GPIO header instead of using an external controller like the IT8951. This would allow for the creation of a very low cost, high speed Eink display adapter. Spoiler - my idea worked and I created a working board with the help of my friend Martin : I've also used this direct GPIO idea to drive QSPI LCDs from the RPI header (RPI doesn't have native QSPI support): Back to GPIO... The "digital pins" of most MCUs/SoCs are usually controlled from a few memory mapped ports. These exist in a similar form on simple Microcontrollers like the AVR 8-bit series (e.g. Arduino UNO) and on more complex SoCs like the Allwinner A733 (e.g. OrangePi Zero 3W). There are groups of bits to control each pin's function (e.g. simple input/output or s...

ESP32-P4 SIMD Explained

Image
Introduction N.B. - This article is for programmers who are familiar with SIMD. Like the ESP32-S3 before it, the ESP32-P4 includes SIMD instructions - Espressif calls them 'PIE' - processor instruction extensions. Before getting into the details of the P4, it's necessary to go over the history of the ESP32 family. The original ESP32, ESP32-S2 and ESP32-S3 all use Cadence's Xtensa LX CPUs. The release of the ESP32-C3 marked a turning point for Espressif with the use of RISC-V CPUs (no license fee). The ESP32-S3 is the last MCU in their lineup to use an Xtensa CPU. Espressif decided to add SIMD instructions (PIE) to the S3 to support more advanced imaging and machine learning tasks. The PIE instructions on the ESP32-S3 look a lot like Cadence's other SIMD instruction sets on their other CPUs. The ESP32-P4 however, has two 32-bit RISC-V CPUs inside. The RISC-V is an open source CPU design that is unrelated to Cadence's Xtensa CPUs. RISC-V's instruction set has ...

LCDs & C++ & Linux = Beginner-Friendly?

Image
Intro There are many reasons to choose a programming language and environment for your projects and products. C++ has gotten a reputation for being old, outdated, difficult to learn and full of dangers. Python is often proposed as a simpler alternative, especially for people new to programming. These statements all have merit, but I would like to propose an alternate way of thinking about it. Background I started programming in 1979. At that time there were very few choices of programming language and very little access to documentation. The home computer vendors chose to provide a BASIC language interpreter on their machines and include a book with some introductory lessons and examples.  When you turned on the computer, it couldn't do anything except interpret your hand-typed BASIC programs. There were no built-in 'apps' or anything functional. This was enough to get me hooked on computers - the only limit to what you could do was your imagination. The programming world m...

Frustration-free e-paper usage for Linux

Image
Intro E-paper (electrophoretic display technology) has found its way into more and more products and personal projects over the last few years. One thing that hasn't come with this widespread adoption is a way to make them easier to use - they're uniquely difficult and frankly they're frustrating. Why frustrating? There are some aspects of using these displays that offer unique challenges. These tend to be one of the following: They need an external DC/DC boost circuit and 24-pin 0.5mm FPC. Difficult to create on your own Many displays share the same exact size/look, but are incompatible. There are two main families of controller chips (Solomon Systech and UltraChip), but even within those two there are multiple versions that can be incompatible. They behave very differently compared to other all-points-addressable displays. It is unfortunately necessary to learn a bit about the physical properties of them in order to use them correctly. The vendors don't provide good d...

Building a Better Bitmap (font system)

Image
Intro There is a common need in the computer world to display text on dot-addressable displays. As with everything else, there are many ways to accomplish the same task. For computers with sufficient memory and CPU power, a popular solution has been to use vector graphics fonts such as the popular system called  TrueType . This system uses a bit of math (Bezier curves) to define scalable characters. It can also include Kerning information. Another challenge is how to represent the text - e.g. ASCII or UTF-8. TrueType supports the Unicode character set which is composed of thousands of possible symbols. TrueType font files are usually in the range of 30-200K bytes in size. The data size and math don't represent a big challenge for mobile or desktop level systems, but how can you display nice looking fonts on a microcontroller with only 1K of RAM? A Clever Workaround Anyone who works with computers long enough will be familiar with the workaround - a way of getting something done i...

How much power does gzip save on IoT web access?

Image
Intro I've recently been working on an optimized library for deflate/zip/gzip decompression. I released it to Github and the Arduino Library Manager as  zlib_turbo . With zlib_turbo, I've been exploring HTTP GET requests on the ESP32 and enabling gzip compression to reduce the payload size. I assumed that asking the server to compress the content and sending it as gzip would reduce the connection time. I decided to test how much time and energy this could save. When using the ESP32, or other network-capable MCUs, how much power can we save by requesting compressed content? What is gzip compression? Before getting into the project details, a prerequisite is a quick overview of gzip. If you're already familiar with it, you can skip to the next section.  gzip is an ancient (relative to the age of the internet) standard based on the deflate compression algorithm. gzip is a file container used to store a single 'deflated' file. There are simple GUI and command line tool...