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

Setting up STM32 Debug Options

All good projects will eventually need to be debugged. This is a walk through from starting in CubeMX through to setting up debugging using either a UART or the SWO trace cell in the cortex-M ARM core. This was setup and tested on the black STM32F407VET6 development boards that feature a full size JTAG connector. I’m using a Segger J-Link here, however this works the same using the ST STLinkV2 as far as I’m aware. ...

April 12, 2018 · 8 min · Ben V. Brown

STM32 PWMing PWM & Injected ADC

In the new release of firmware for the TS100, I have moved the system from using a software-driven bit-bang of the output to hardware-based timers. The issue here is that we cannot just use normal PWM! Why can’t we just use normal PWM? Soldering Iron drive Schematic The above image shows a small extract from the TS100 schematics, with the PWM signal from the STM32. The soldering iron tip is driven by the back to back MOSFETs(Q1A/B). These are P channel MOSFETs, so they are on when the gate is pulled low relative to the battery input. R11 acts as a pullup to ensure the gate is high whenever it is not being actively pulled down via Q2 and R29. When Q2 is turned on it will pull the gate to half of VBatt (R11/R29 form voltage divider). The filter capacitor in parallel to Q2 acts to provide a turn-off delay on the gate so that the gate will stay low for a period of time after Q2 turns off. (Time constant is approximately 1 millisecond). ...

September 21, 2017 · 9 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

TS100 Soldering Iron

TS100 The ts100 is a portable DC powered soldering iron released by minidso. The unit offers between 25-70W of output power at the tip depending on the input voltage, and has removable tips (Not compatible with other irons as far as I know). Sadly the unit is crippled with their system for changing settings, while the unit supports nice options such as a customizable cutoff voltage; wake on motion, and automatic sleep times. They decided to make these options only available to be changed using the USB connection to the computer. ...

October 1, 2016 · 3 min · Ben V. Brown

STM32 I2C EEPROM with HAL

#Talking to a I2C EEPROM using the STM32 HAL libraries This mostly a note to my future self. This code is based on the excellent answers provided at the ST forums, but combined here as a complete class. This was used to talk to a standard I2C EEPROM, 24LC256. The following header file definitions are required for the class : #define EEPROM_ADDRESS 0xA0 #define EEPROM_MAXPKT 32 //(page size) #define EEPROM_WRITE 10 //time to wait in ms #define EEPROM_TIMEOUT 5*EEPROM_WRITE //timeout while writing #define EEPROM_SECTIONSIZE 64 These setup the I2C address, the maximum page size of the EEPROM (32 used here for compadability). along with the timeouts. Section size is used internally similar to a ‘bucket’ that each object stored, is stored in. ...

August 20, 2016 · 2 min · Ben V. Brown