Better asserts in C with link-time optimization
I've been a fan of link-time optimization for several years. I've been a fan of efficient programming for even longer. I was an early fan of C++ because features like function overloading made it...
View ArticleMeasuring AVR interrupt latency
One thing I like about AVR MCUs is that their datasheets are relatively short and simple. It's also one of the things I don't like, because the datasheets often lack important details. Understanding...
View ArticleA full-duplex tiny AVR software UART
I've written a few software UARTs for AVR MCUs. All of them have bit-banged the output, using cycle-counted assembler busy loops to time the output of each bit. The code requires interrupts to be...
View ArticleGetting started with the WCH CH551 and CH552
When I first read about the CH554 series of MCUs, I thought it would be interesting to test out some day. Part of the attraction is that it's based on the 8051, which is a well-documented an widely...
View ArticleHacker's Intro to USB hardware
Low-speed 1.5Mbps and full-speed 12Mbps USB, while more complicated than a UART, are still hacker-friendly. As the standard approaches 25 years old, I've decided to document some of the more useful...
View ArticleFlashing AVRs at high speed
I've written a few bootloaders for AVR MCUs, which necessarily need to modify the flash while running. The typical 4ms to write or erase a page depends on the speed of the internal RC oscillator....
View ArticleRecording the Reset Pin
The AVR reset pin has many functions. In addition to being used as an external reset signal, it can be used for debugWire, and it is used for SPI and for high-voltage programming. Other than for when...
View ArticleLGT8F328P EDMINI board
Earlier this year I purchased a EDMINI board from Electrodragon. It uses a LGT8F328P chip, which supports the AVR instruction set. The instruction set timings and peripheral registers vary slightly...
View ArticleSTM32 Starting Small
For software development, I often prefer to work close to the hardware. Libraries that abstract away the hardware not only use up limited flash memory, they add to the potential sources of bugs in...
View ArticleTrying to test a "ten cent" tiny ARM-M0 MCU
A few months ago, while browsing LCSC, I found a surprisingly cheap ARM M0 MCU. At the time it was 16.6c in single-unit quantities, with no higher-volume pricing listed. From the datasheet LCSC has...
View ArticleTrying to test a "ten cent" tiny ARM-M0 MCU part 2
After my first look at the HK32F030MF4P6, I wondered if the HK part, unlike the STM32F030 it is modeled after, does not have 5V tolerant IO. I changed the solder jumpers to 3V3 on the CH552 module I'm...
View ArticleGD32E230: a better STM32F0?
On my last LCSC order, I bought a few GD32E230 chips, specifically the GD32E230K8T6. I chose the LQFP parts since I have lots of QFP32 breakout boards that I've used for other QFP32 parts....
View ArticleQuirks of the CH55x MCUs
Over the past several months, I've been been learning to use the CH551 and CH552 MCUs. Learning generic 8051 programming was the easy part, as there is lots of old documentation available, with...
View ArticleWriting USB firmware on the CH55x MCUs
Over the last several months, I've been familiarizing myself with the CH552 and CH551 MCUs. Most recently, I've been learning how to program the USB serial interface engine on these devices. The USB...
View ArticleHoney, I shrunk the Arduino core!
One of my gripes about the Arduino AVR core is that it is not an example of efficient embedded programming. One of the foundations of C++ (PDF) is zero-overhead abstractions, yet the Arduino core has...
View ArticlePi ethernet gadget with reverse SSH proxy
I love my Pi Zeros. I think every hacker should have one in their toolbox. When I got my firs Pi Zero several years ago, I used a USB-TTL serial adapter to connect to the console UART on pins 8 and...
View ArticleFast 1-wire shift register control
One-wire shift register control systems are an old idea, with the benefit of saving an IO pin at the cost of usually much slower speed than standard SPI. I'm a bit of a speed nut, so I decided to see...
View ArticleWriting USB firmware on the CH55x MCUs
Over the last several months, I've been familiarizing myself with the CH552 and CH551 MCUs. Most recently, I've been learning how to program the USB serial interface engine on these devices. The USB...
View ArticleDC Wiring Losses in String and Microinverter Solar PV Arrays
There are two common ways of wiring solar PV arrays. Each panel can be connected to a microinverter, with each microinverter connected in parallel to an AC bus. Alternatively, panels can be connected...
View ArticleKSTAR Single Phase String Inverters
KSTAR New Energy makes single phase grid-tied inverters ranging from 1 kW to 10 kW. I tested a 3000S, a 5000D, and a 6000D that were produced in KSTAR's factory outside of Shenzhen. Their single...
View Article