Skip to content
This repository has been archived by the owner on Nov 23, 2020. It is now read-only.

thi-ng/ws-ldn-7

Repository files navigation

thi.ng/ws-ldn-7

./assets/ws-ldn-4-synth.jpg

Contents

DIY Synth & GUI workshop with STM32F7 (ARM Cortex-M7)

Video documentation

Examples / exercises

ex01 - Hello Blinky

Simple LED blink example and GPIO (push button) handling, polling vs. EXTI interrupt

ex02 - Timers & interrupts

Introduction to timers, configuration and custom interrupt handlers. Useful for basic multi-tasking.

ex03 - LCD, multitouch & GUI

Introduction to LCD driver, HAL BSP drawing functionality, state machines, GUI components & multi-touch handling. Press blue user button to switch between modules.

ex04 - Synth, DSP & GUI

Complete synth, GUI controls & timer integration. See video above.

Oscillator types

Oscillator types are set via the following 3-bit patterns:

SpiralSinSquareSawSawsinTriString
[ ][x][ ][x][ ][x][ ]
[ ][ ][x][x][ ][ ][x]
[ ][ ][ ][ ][x][x][x]

Filter types

Filter types are set via the following 2-bit patterns:

LPFHPFBPFPEQ
[ ][x][ ][x]
[ ][ ][x][x]

This demo only makes use of biquad filters, though other filter types are possible (IIR, Formant, 4pole…)

ex05 - MIDI step sequencer

MIDI example ported from previous workshop (then using STM32F401), implementing a 2-track, 8-step MIDI sequencer using buttons of the Korg Nanokontrol2. The MIDI configuration (in ex05/main.h) is still set for the Nanokontrol and I’ve also uploaded a configuration file (nanokontrol2.nktrl2_data) which you can use with the Korg Kontrol Editor app (can be downloaded from here: http://www.korg.com/uk/products/controllers/nanokontrol2/ - further down on that page).

The Nanokontrol is configured as follows:

  • the first row of buttons (“S”) is used as 8 step sequencer for track 1
  • the second row of buttons (“M”) => track 2
  • 2 leftmost sliders control filter cutoff freq for sequencer tracks 1 & 2
  • 2 leftmost dials controls resonance for each filter
  • 3rd dial => delay feedback
  • 4th & 5th dial => attack time for track 1 & 2
  • Marker left/right => change waveform for oscillator 1 (all tracks)
  • Track left/right => transpose current sequence by -12, -5, 0, +7 or

+12 semi-tones

  • Rewind, Stop & Play do as expected (when the app starts, it is in

Pause mode - you’ll need to press Play and activate at least one “S” or “M” button)

The notes played in each sequencer track are randomly chosen from a musical scale defined in the source code. If you don’t like a note, simply de-activate and then press the “S” or “M” button again to get another semi-random note. See the live video recording (link above) for reference…

If you have a different MIDI controller, you’ll have to edit the MIDI control message IDs in the ex05/main.h file for this example. Note, that your controller MUST be able to emit MIDI CC messages. With a bit more work this can of course also be extended to proper MIDI Note On/Off messages…

Building the exercises

This repo contains a complete Eclipse CDT project and can be built with GNU ARM Eclipse plugin. Furthermore, the ARM GCC toolchain is required outside Eclipse.

Within the project, you can find several build configurations, one per example/exercise. Build profiles can be switched by clicking on the little triangle next to the hammer (build) icon in the main toolbar. Once a profile has been built, you’ll find the resulting .bin file in the profile’s subfolder of this project. E.g. ex04’s binary will be located in {$PROJECT_DIR}/ex04/ws-ldn-7.bin.

Important: The build profile called “base” is only a template and is NOT buildable. However it is the default profile after importing the project into Eclipse. So if it starts building the project automatically and you get lots of errors, let it finish and then select one of the example profiles (“ex01”…) as described above.

The STM32F746-DISCO board is mbed enabled and therefore can be programmed/flashed via simple drag & drop. Simply move a .bin file onto the USB volume the board shows up as in OSX Finder or Windows Explorer. Under Linux, please use the st-flash tool and invoke like this:

cd ws-ldn-7
st-flash --reset write ex04/ws-ldn-7.bin 0x8000000

Other tools

License

This project is open source and licensed under the Apache Software License 2.0.