Skip to content

Microcontroller Peripherals

Thomas edited this page Feb 3, 2018 · 4 revisions

This page details the STM32 peripherals used by the firmware. TODO: figure out relevant register settings and document them here

EEPROM

The firmware stores user settings, calibration data, and log samples in the STM32 EEPROM. Todo: write out address map and such

ADC1

The firmware uses the ADC to read battery voltage and the internal temperature sensor. The battery level detector is connected to channel 1 and the temperature sensor to channel 0.

LCD

The LCD peripheral drives the shiny segment LCD attached to the meter. The screen has 4 commons numbered COM0-3 and 40 segments numbered SEG0-39. The lines are connected as numbered from the LCD to the STM32, except that LCD SEG26 is connected to STM32 SEG40 (STM32's SEG26 is used for SD card access). TODO: figure out what segments it uses and also get a segment map somehow

TIM2

TIM2 overflow is used by the firmware for timing control. The interrupt handler (TIM2_interrupt()) mostly updates a large pile of timers and sets flags when they expire. The overflow interrupt fires and the function executes every 10ms.

TIM3

TIM3 overflow interrupt (TIM3_interrupt()) handles beeping and the boot window (during which e.g. calibration mode can be entered) timer. The overflow interrupt fires and the function executes every 1ms.

USART2

USART2 is connected to the Bluetooth module at 19200 baud. Meter data packets are sent and received raw over this interface. The interrupt puts received packets in a buffer then notifies the main loop.

SDIO

The SDIO interface controls the SD card. The firmware uses it through the FAT driver on top.

Clone this wiki locally