M0AGX / LB9MG

Amateur radio and embedded systems

  • XMEGA power down mode for battery powered devices

    This post describes how to implement firmware-controlled device power switching on an XMEGA. I am working on a portable device that is powered from a Li-Ion cell, has an USB socket for charging, MCU, couple of LEDs and a button. I wanted to keep the design as simple as possible …

    Read more...

  • Kinetis - relocating variables to upper SRAM

    NXP Kinetis microcontrollers have an inconvenient architectural feature - split RAM. The memory is split into two areas of equal size. You can run into this issue when the size of all RAM variables (data+bss) approaches half size of available SRAM. It manifests itself with a linker error looking similar …

    Read more...

  • Practical NodeMCU endurance with a big NiCd battery pack

    Some time ago I have built a WiFi thermometer with a NodeMCU and a 6Ah recycled nickel-cadmium battery. WiFi is probably the least power-efficient communication methods but I was curious how long could a NodeMCU run from a big battery pack.

    It took some time to get meaningful data... voltage trace

    After …

    Read more...

  • XMEGA USART driver with TX DMA

    This is a quite universal, non-blocking UART driver for XMEGA. It supports both transmission (with optional DMA) and reception. Receive side can deliver callbacks whenever a complete line (terminated with \n) is received or received bytes can be retrieved one-by-one from a ringbuffer (more useful for GPS units). This driver …

    Read more...

  • XMEGA high-performance SPI with DMA

    I developed an universal SPI driver for XMEGA line of MCU for a battery powered device where power efficiency was important. To get anything started on new hardware I have started with a simpler code first which uses interrupts and then I began looking at using XMEGA's DMA controller (that …

    Read more...

  • XMEGA and HD44780 LCD

    Character LCD are one of the easiest and cheapest way of adding output to a microcontroller system. The world of character LCDs has mainly standarized on HD44780 controller chip, which was designed to be interfaced with the rest of the system by a parallel bus but today simple bit-banging does …

    Read more...

  • Making call graphs with GCC, egypt and cflow

    Call graphs are a visual way of showing relations between functions in a piece of code. They can be useful to analyze dependencies and to get basic understanding of a large, unfamiliar codebase. Tracing program flow can also help in finding bugs. I will use my antenna switch and rotator …

    Read more...

  • Antenna switch & rotator controller

    This is a two-in-one device. It can be set up to:

    • switch 7 antenna relays from a PC over USB or using transceiver band output
    • control an antenna rotator using buttons and LCD or from USB

    Assembled powered front PCB

    Hardware features

    • LCD 2x8
    • 5 buttons
    • USB
    • 8-15V DC power input (can also run …
    Read more...

  • Reliable storage of settings in EEPROM

    Embedded systems often require permanent storage of some configuration parameters eg. radio channel, volume in a radio etc. All settings must be saved and read reliably, otherwise the device may become unpredictable. Imagine a variable frequency drive (an "electric motor controller") set to a certain speed, that after a power …

    Read more...

  • Using XMEGA hardware CRC generator for CRC-16 CCITT

    CRCs are useful for checking if data received from outside or read from memory is not corrupted. This is especially important in embedded systems, as it could take just a single bit-flip to drastically change the configuration of the system. I needed to protect configuration structure of my new project …

    Read more...