Driving WS2812 LED's with STM32 DMA+Timer

The WS2812 aka the Neopixel is a very well know LED, it combines a fully self-contained PWM driver ic with RGB led’s in a cheap and (relatively) painless to work with package. The downside to these is their not-very-fun protocol that requires effort to ensure you drive it at the correct timing. Other fantastic people have already done a deep dive into this protocol. The TL;DR is that the protocol works out to encode the bit as 0 or 1 based on the pulse length, with minimum off times between bits. Otherwise, there is a very long off time to latch the data and reset the state machine. Thats it. ...

July 1, 2021 · 12 min · Ben V. Brown

STM32 Hardware & Software Design Part 4

Where we left off Part 1 covered the quick rundown of selecting the STM32 and assigning a rough pinout in STMCube. Part 2 provided a quick through the schematic capture process and PCB layout at a high level. Part 3 covered exporting the PCB for manufacture and a quick run through the ordering process with PCBWay. Disclaimer In this section, I’m using PCBWay for the ordering process example. They have kindly offered to cover the cost of the production of these PCB’s before this series actually went live. They offered some free PCB’s around the time I was writing part two, making it very convenient to use their services for this series of posts. ...

May 26, 2020 · 5 min · Ben V. Brown

STM32 Hardware & Software Design Part 3

Where we left off Part 1 covered the quick run down of selecting the STM32 and assigning a rough pinout in STMCube. Part 2 provided a quick through the schematic capture process and pcb layout at a high level. Part 3 here will cover the exporting the PCB for manufacture and a quick run through the ordering process with PCBWay. Disclaimer In this section I’m using PCBWay for the ordering process example. They have kindy offered to cover the cost of the production of these PCB’s before this series actually went live. They offered some free PCB’s around the time I was writing part two, making it very convient to use their services for this series of posts. ...

April 22, 2020 · 4 min · Ben V. Brown

STM32 Hardware & Software Design Part 2

Where we left off Part 1 covered the quick run down of selecting the STM32 and assigning a rough pinout in STMCube. Part 2 here will run through the schematic capture process and pcb layout at a high level. Schematic Capture I design exclusively in KiCad now, having completely moved off other platforms over the past few years. As such this guide will only cover KiCad related design work. I highly reccomend using hierarchical sheets in your design, to allow for both (some) reuse, as well as make the seperate building blocks clearly definied. Please, please, do not just throw your entire schematic on one page, it makes for a highly unreadable schematic for anyone else who comes along. ...

April 11, 2020 · 8 min · Ben V. Brown

STM32 Hardware & Software Design Part 1

Outline This is a half walkthrough / half hints guide to taking a base concept for a STM32 from idea to (somewhat) working hardware. The goal is to roughly document the path I use, but not bogging down into the details on things that are easier to google. For this series, I’m looking at designing out a small development board, designed to mount to the quite nice ILI9486 LCD unit. I’m designing this mostly so that its in a nicer form factor than other development boards, and so I can use USB-C as I really dislike USB mini-B. ...

April 10, 2020 · 6 min · Ben V. Brown

SD cards with STM32 over SPI

The time has come that I finally need to look into getting SD cards to work with the stm32. Looking online there seems to be a few really great resources for connecting to a SD card over spi from a smaller lower power however I could not find any guides for the STM32 line of chips. I am currently working using the HAL libraries as this allows for flexibility in working with different chips (in theory!). This does come at a cost of performance, however I have found the cost to be fairly low compared to being able to have already setup functions for most things. ...

November 4, 2016 · 10 min · Ben V. Brown

STM32 ADC with DMA

Most of my current projects are using the very, very nice stm32f103 series of chips, as these provide excellent performance per dollar cost. The embedded DMA in these chips is a massive help in getting a project up and running without any struggle for cpu power. I find the DMA documentation to be lacking at best with getting this system up and running using the new HAL drivers from STM. While this is actually quite an easy system to get up and running, I could not find any nice notes on how the system should be setup and things to be aware of. ...

November 2, 2016 · 5 min · Ben V. Brown