M0AGX / LB9MG

Amateur radio and embedded systems

  • STM32L4 I2C driver for FreeRTOS without HAL

    I2C remains a popular communication interface between MCUs and all kinds of auxiliary chips like ADCs, digipots and GPIO expanders. I had to make a simple and universal driver for an upcoming STM32L432 project to control Microchip digipots. STM32 I2C peripheral is simple enough to use without the burden of …

    Read more...

  • STM32L4 UART driver for FreeRTOS without HAL

    This is a driver for STM32L432 LPUART. It should also work with the "full" UART. The LPUART is a simple peripheral (compared to the clock tree or ADC). In this case it is easier to master the usage of a couple of registers, than use full-size HAL drivers, as they …

    Read more...

  • Generating signals with STM32L4 timer, DMA and DAC

    Generating arbitrary signals using an MCU is extremely useful. It can be used for example to play back any audio or make a modulator for a modem. The most needed MCU peripheral is of course a DAC but it also needs other peripherals to efficiently play back the samples without …

    Read more...

  • Debugging runtime memory corruption on Cortex-M

    Runtime memory corruption is one of the worst class of bugs a C/C++ application can have. I do not mean design problems like abuse of global variables but seemingly correct code clobbering memory it should never touch (for example due to runaway pointers). Compared to "regular" crashes that are …

    Read more...

  • Preserving debugging breadcrumbs across reboots in Cortex-M

    Debugging embedded systems during development even with the best tools can be hard. Certainly a good debug probe makes life easier but what do you do after the product is shipped? What if the customer complains that something strange is happening sometimes or a bug makes the device reboot but …

    Read more...

  • Reducing firmware size by removing libc

    The C standard library (libc) is a component that gets little attention. It is just there. However for embedded systems it brings some challenges and overhead in terms of code size. As firmware size is often critical, it sometimes makes sense to use a trimmed version of the standard library …

    Read more...

  • Fixing Cortex-M startup code for link-time optimization

    Link-time optimization is a powerful output size reducing feature. Even though (as of 2018) still regarded as somewhat experimental, LTO is worth trying, if the binary size is very important and the application can be reliably tested afterwards, as link-time optimized code is hard to debug. A bootloader can be …

    Read more...

  • Disk space monitoring & e-mail notifications with Bash

    Running out of disk space is a common problem for unattended Linux boxes like database servers or backup storage servers. Usually I would use Zabbix (or Nagios) do to the monitoring but it would be an overkill for a Raspberry Pi or a single NAS so I made a small …

    Read more...

  • Practical FFT on microcontrollers using CMSIS DSP

    Fourier transform is a vast domain of knowledge with many practical applications within signal processing. Virtually all communications protocols use Fourier transform at one step or another (including LTE, GPS and WiFi). Another popular example are the "jumping bars" in music players showing levels of low and high tones in …

    Read more...

  • Bell 202 modem for AVR and other MCUs

    Bell 202 is a quite old modem standard that is still used today in amateur radio for data transmission over VHF (Packet Radio and APRS) and industrial automation (HART). It is a very simple FSK modem. The speed is limited to 1200 baud, which makes it very easy to implement …

    Read more...