Posts

ESP32-S3 SIMD Minimal Example

In my recent blog post , I described the ESP32-S3 SIMD instructions and how I figured out how to use them. This post is to provide the simplest working example to serve as a starting point for your own projects. The code was designed for the Arduino IDE, but will work similarly on Espressif's ESP-IDF. To add assembly language files (.S) to your Arduino project, just place them in the same folder as the .ino file. Here are the 2 files needed for this project, along with the output on the serial terminal of the results when you run it. Simply create an empty project and copy/paste this code into it: The Arduino sketch // // ESP32-S3 minimal SIMD example // Written by Larry Bank // Copyright (c) 2024 BitBank Software, Inc. // // The purpose of this example is to show how to make use of ESP32-S3 SIMD instructions // in your Arduino or ESP-IDF projects. The code is not comprehensive and just provides // a starting point for someone wanting to learn how to use them. I wrote this because

Has RISC-V finally made the 8051 obsolete?

8051 (MCS-51) You can probably tell from the tone of the title that I'm no fan of the 8051. The 8051 is an 8-bit MCU created by Intel in 1980. It has a very simple (aka wimpy) instruction set that was designed to minimize the amount of silicon required. This and the fact that the IP of the 8051 was released as free to the public, made it a popular choice as the CPU core of MCUs from a variety of vendors. Taken from a purely hardware point of view, the 8051 seems like a great way to make low cost MCUs, but from a software developers POV (e.g. mine), it's a productivity killing choice. The reasons I feel this way are: The HW architecture has so many odd quirks and limitations that your code ends up being a specialized mess that has no hope of portability to any other architecture 8-bit ops mean that your code becomes very bulky to do actual work besides blinking some LEDs What you save in HW cost, you pay dearly for in SW cost The available SW tools are very limited (e.g. SDCC -

Surprise! ESP32-S3 has (a few) SIMD instructions

Intro Espressif Systems released their ESP32-S3 SoC a few years ago, but only recently have they released more documentation and support of its full capabilities. Without any changes to your code, the S3 runs about 15% faster than older ESP32 CPUs at the same clock speed. It has a 'hidden' capability that's more difficult to use, but can be worth the effort if you need more speed. This article is aimed at programmers who are already familiar with SIMD instructions on other platforms. I've been optimizing code with SIMD for more than 15 years on Intel, Arm and DSPs (even Cadence's), so when I heard that the S3 had SIMD instructions, I immediately went searching for documentation. When the S3 became available to buy, there was only a promise of documentation and support. In the 2+ years since then, not much has changed. At the end of 2023, Espressif released a document describing the new instructions: S3 Technical Reference Manual The document has a decent level of d

3-Wire SPI Explained

Image
Intro I'm working on a new PCB project with a SSD1306 128x64 OLED display and was curious to try using 3-wire SPI mode. It's not a new subject for me, but I wanted to try using it to gain speed rather than have it slow things down (e.g. bit banging the protocol). Some background information is required before I share the project details. Small Displays Small displays like the SSD1306 and color LCDs like the ST7789 from Sitronix support updating their internal display RAM over a serial (SPI) connection. The display controllers understand "commands" and pixel data. The commands serve to configure the controller and move the write pointer (where the pixel data gets written). In order to know if incoming serial data should be interpreted as commands or pixels, the controllers have a D/C (data/command) signal. This can either be a separate signal wire or encoded into the data stream. When it's a separate signal, this is referred to as "4-wire SPI". The 4 wire

Fast Updates on Sharp Memory LCDs

Image
Background Monochrome liquid crystal displays have been in existence for many years. The original use case was for super low power segmented displays on calculators and watches. Each display segment was directly controlled by the microcontroller and required a tiny bit of power to hold it in the 'on' state. Over time, APA (all points addressable) aka dot matrix displays were created to show images and more complex data. The traditional method of creating a dot matrix LCD display is to have a dedicated controller (simple MCU), RAM and a communications interface. This is how almost all modern dot matrix LCDs are made (see Sitronix LCD controllers). This allows for very high resolution displays to be managed with a simpler command interface and the dedicated controller chip is responsible for scanning the rows and columns to keep the LCD pixels current with the RAM contents. Dedicated dot matrix LCD controllers simplify utilizing these displays in products, but they come at a cos

Building the Pocket CO2 Project

Image
Intro Most of my previous posts have been focused on software topics. I'm going to stray a little into hardware for this article. At the end of 2022 I made a promise to myself to learn how to use KiCad so that I could design my own printed circuit boards. I have some experience with electronics and I thought that I could design some relatively simple PCBs for my own use. I found this 100 minute YouTube tutorial and it provided enough practical info to get me started. This blog post is not about learning KiCad; instead I'm going to walk through all of the steps and equipment necessary to build my Pocket CO2 sensor project. The KiCad files and firmware can be found here . (SMD) Surface Mount Soldering is Easy? After seeing videos of professional makers such as Seon "Unexpected Maker" Rozenblum use pick-n-place machines to build complex PCB boards with impossibly small components, I wrongly assumed that SMD soldering required expensive equipment and lots of expertise.

The "CO2" Project

Image
  The "CO2" Project By Larry Bank Environmental sensing and air quality have always been fascinating to study. I've tested various sensors over the years that, until recently, cost next to nothing. The COVID pandemic increased my curiosity (and concern) about indoor air quality, CO2 levels, and shared air. In the past, I tried to save some money and use the "eCO2" value from several inexpensive sensors, but the results were unreliable and unsatisfying. eCO2 is an "equivalent CO2" value generated by some VOC ( volatile organic compound ) sensors. The idea is that human breath contains lots of VOCs and if you detect them, you're also detecting CO2. The flaw in this thinking is that a lot of other things generate VOCs and have nothing to do with CO2. A good example of a false positive is food preparation. Bring your VOC sensor into the kitchen when you're cooking and it will tell you that the air has a toxic level of "eCO2". I've bee