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 the job.

One of the obstacles to using HD44780 with XMEGA are different supply voltages. Displays usually require 5V, while XMEGA is 3,3V-only. Continue reading “XMEGA and HD44780 LCD”

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 cut reads bad data from it’s memory and overspeeds an expensive piece of moving machinery leading to physical damage.
Continue reading “Reliable storage of settings in EEPROM”

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 when it is being saved and read from EEPROM. To make sure that the data I read from EEPROM is exactly what I have written I decided to use CRC-16 CCITT across the whole structure.

Continue reading “Using XMEGA hardware CRC generator for CRC-16 CCITT”

AVR fuses for beginners

Fuses in AVR microcontrollers have a bad reputation among beginners, because a wrong setting can lock you out of accessing the chip. With the right tools they are not scary. 🙂

Fuses are just a special name for three bytes of EEPROM-like memory (they are not “conventional OTP” fuses at all) that set the most low-level features of an AVR like:
Continue reading “AVR fuses for beginners”