Skip to content

Firmware

zukaitis edited this page Oct 16, 2018 · 5 revisions

Firmware for the device is built in SW4STM32 IDE, mostly written in C++. STM32 HAL libraries are used to access hardware, some of the hardware initialization functions are generated using STM32Cube.

.dfu output file generation is included in post-build steps, which uses dfu-convert python script, which can be downloaded from this repository (script shall be put into the Firmware folder).

Implementation

Firmware class structure

Grid

Whole control of the grid - LED refreshing and button state acquisition - is performed by a specifically configured DMA. During one cycle DMA latches column selection outputs, loads timers with desired PWM output values, and reads button input values. After updating all the matrix, DMA generates interrupt, which indicates, that button input values should be checked for changes. Using DMA significantly reduces CPU load, as it does not have to be interrupted every 500us to acquire input values and update outputs.

Block diagram

LCD

LCD is interfaced through SPI, using DMA. LCD backlight is connected on MOSI output of another SPI peripheral, and brightness of backlight is regulated by changing the data, that is constantly transmitted by dedicated SPI controller - this imitates an independent PWM output and does not use any processor resources.

Program

Currently there is only one operating mode, which is used to work with Ableton and Launchpad95g script. In this mode, LED colours are set according to MIDI messages received from DAW, and corresponding MIDI messages are sent to PC, when any of the buttons is pressed or released.

USB

Microcontroller is configured as a MIDI USB device, and interfaced using relatively simple MIDI messages.

Clone this wiki locally