MIDIbox Hardware Platform, CORE_STM32F4 Module

MBHP_CORE_STM32F4 is the successor of the MBHP_CORE_STM32 module, and an alternative solution to the MBHP_CORE_LPC17 module.

Main features of the STM32F407G-DISC1 based MBHP_CORE_STM32F4 module:

  • 1MB Flash and 192k RAM (significantly more than previous core modules)
  • The STM32F407G-DISC1 evaluation board is available for 15 EUR at Mouser, 17 EUR at Watterott (Germany), 11 GBP at Farnell (GB) - an meanwhile even at Amazon!
    It will be attached on the MBHP_CORE_STM32F4 PCB, but can also be used standalone for mini applications which only require USB MIDI and a small number of IOs or the Audio DAC.
  • Easily available for private persons in small quantities and no SMD soldering skills required
  • ARM Cortex-M4 CPU is widely supported by the GNU toolchain, accordingly source code can be compiled under Windows/Linux/MacOS w/o spending money for an expensive ARM compiler
  • increased performance compared to STM32F1xx and LPC17xx because of the higher frequency (168 MHz)
  • the enhanced instruction set with DSP operations makes Cortex-M4 very interesting for audio applications (e.g. Synths and Fx)
  • MIOS32 applications are typically running more than 2..3 times faster than on STM32F103RE @72 MHz, and ca. 50% faster than on a LPC1769 @120 MHz
  • Very useful integrated peripherals for MIDI and Synthesizer applications, such as UART, SPI, I2C, USB, CAN, Timers, ADC, DAC
  • The USB OTG (Micro-USB) socket supports MIDI Host, which means that it's possible to connect a USB MIDI Keyboard or Synth (see also this forum article)
  • The on-board Audio DAC predestinates this module for synthesizer projects - it could even be used standalone without the MBHP_CORE_STM32F4 breakout board for this purpose.
  • in distance to STM32F103RE, CAN and USB can be used in parallel
  • It's easy to interface external components like SD Cards and MBHP_ETH
  • STM32F4xx is supplied at 3V, but 5V tolerant inputs allow to access all existing MBHP modules without additional hardware.
  • Performance boost by using the DMA for background operations, such as scanning DIN/DOUT modules, analog inputs but also I2S transfers (Audio Output) w/o loading the CPU
  • Supported by a free available Realtime Operating System: FreeRTOS
  • no external flash programmer required, ST-LINK/V2 is part of the STM32F407G-DISC1 board to program the MIOS32 bootloader into a "virgin" device
  • Fast upload of application code via USB MIDI (ca. 50kb/s) - thanks to the MIOS32 Bootloader

Ok, enough praises for this nice toy. Here a list of issues/imperfections that I don't really like:

  • ADCs cannot be supplied at 5V, 3.3V is the limit, and the STM32F407G-DISC1 board uses an even lower voltage (3V). This decreases the signal/noise ratio. The MBHP_AINSER64 and MBHP_AINSER8 module helps to overcome this by using an external 5V ADC.
  • Pin mapping suboptimal in some cases. E.g., the outputs of the integrated DAC (not the on-board Audio-DAC) overlay SPI1 pins. However, one DAC channel has been freed up with the small drawback that SPI1 can't be used in slave mode.
    The IO pins of the SDIO peripheral (high speed SD Card access) conflicts with the on-board Audio DAC, so that it can't be used.
    Although the chip contains 6 UARTs, only 4 RX and TX pins could be found for MIDI IN/OUT. IN3/OUT3 even have to use two different UARTs.
  • No on-board Ethernet PHY
  • No PHY for the second USB peripheral - would be nice to have, e.g. to support USB MIDI device and host (e.g. for the connection of a USB MIDI Keyboard), USB Memory Sticks or even a USB harddisk in parallel.

However, although some of these limitations are really annoying, the STM32F4 based solution is currently the best choice for future MIDIbox projects. It beats the LPC1769 performance, flash/RAM resources and feature-wise. :-) Only drawback is the missing ethernet interface, but as long as only OSC messages should be sent and received, the external MBHP_ETH module might be sufficient.

Installing the MIOS32 Bootloader

The STM32F407G-DISC1 board is equipped with an on-board debugger (right side) which is called ST-LINK/V2. It has to be connected via a Mini-USB cable to your PC, and allows to program the flash of the target device (the STM32F407VE chip).
We use ST-LINK to install the MIOS32 Bootloader, so that a MIOS32 application can be flashed via USB-MIDI later with the Micro-USB connector at the left side. This approach will allow you to update an application on-the-fly without the need for a second USB port on your MIDIbox, it's even faster than via ST-LINK, and it will work under MacOS and Linux as well by using MIOS Studio instead of the Windows propritary ST-LINK utility.! :-)
STM provides a Windows tool for ST-LINK/V2 which can be downloaded from this webpage. You should also download the Windows driver, and install it before starting the ST-Link utility.
Linux and Mac Users could run the ST-LINK utility on a virtual machine like VirtualBox (this is what I did). Alternatively, they could try alternative debugging tools like OpenOCD or qstlink2. However, using the "official" utility is the most simple solution, especially because it's ready-to-go (no compile orgies, no hunting for missing libraries, etc...).
You only need to install the MIOS32 bootloader once, thereafter you can continue with the platform independent MIOS Studio!
After the STM32F407G-DISC1 board has been connected to your PC, the driver has been installed, and the ST-LINK utility has been opened, try to connect to the ST-LINK by pushing the appr. button.
The target device should be displayed.
Click on the small "Program and Verify" icon. Click on the "Browse" button and search for the project.hex binary of the STM32F407G-DISC1 directory which comes with the MIOS32 Bootloader application.
The success message should show up after the programming procedure.
Finally press the (black) Reset button on the STM32F407G-DISC1 board. The green status LED should flash two times (effect via PWM modulation) - the MIOS32 bootloader is up and running!
The bootloader doesn't work through the USB port of ST-LINK. Instead, a second USB cable has to be connected to the Micro-USB socket at the left side of the board!
After the cable has been plugged in, wait until your operating system has found the interface and installed the legacy USB MIDI driver (typically works immediately under MacOS and Linux, but could take several seconds under Windows).
More informations about the bootloader can be found here.
Now start MIOS Studio, select the correct MIDI IN and OUT ports (called "MIOS32" or "MIOS32 Bootloader"). MIOS Studio should be able to query the device parameters as shown at the left picture.

Required Firmware Update for newer board version

Newer board versions marked with MB997D require a firmware update for STM Link, so that the microcontroller can boot with Micro USB power supply instead of the ST-Link connector. This update can be done with the ST Link Utility:

Using the STM32F407G-DISC1 Board standalone

You've probably already noticed, that the board is powered via the ST-LINK connector CN1, and not via the USB connector CN5 which is used for USB-MIDI. This can be changed by bridging the PA9 pin to the 5V input with a short cable:

In addition, it makes sense to mount dual row pin headers at the bottom of the PCB for P1 and P2:

Two 2x25 SIL headers are required (e.g. Reichelt order number: SL 2X25G 2,54). The usage of such headers has the advantage, that later you can plug the STM32F407G-DISC1 board on the MBHP_CORE_STM32F4 module into the corresponding female sockets - and that you can remove it, e.g. to plug it into another MBHP_CORE_STM32F4 module.

Download

Module Schematic Layout Data Quick-view
MBHP_CORE_STM32F4_V1 mbhp_core_stm32f4.pdf under construction mbhp_core_stm32f4_0.jpg
Additional informations
File Size Description
mbhp_core_stm32f4_orderlist.txt 1k Reichelt orderlist

Available Ports

Following interfaces are provided by the core module:

Name No. of pins Description
J17 2 This jumper enables power supply via USB (it connects PA9 with 5V, the same as recommended for the standalone version above). Before closing the jumper, ensure that any other supply sources (e.g. at J2) are removed to avoid shorts or backcurrents to your PC!
Micro-USB 6 Alternatively the core module can be supplied via USB (prefered solution).
Once multiple LEDs and/or backlit LCDs are connected to the core module, it's recommended to use a "selfpowered" USB Hub like this one from Reichelt. Advantage: it has a power-switch!
Using a hub has another advantage: it can be used to power multiple core modules even when no PC is available - this saves you from buying dedicated PSUs (therefore powering via J1 is obsolete).
The USB port provides the "MIDI USB" protocol by default, which works more than 50..100 times faster than a common MIDI IN/OUT connection. Also protocols like "Mass Storage Device" (MSD) to access a SD Card directly from a computer are provided by most MIOS32 based firmwares.
Applications can be updated quickly via USB port as explained here.
J2 2 When used as +5V output: to supply modules which are not connected to a Jxx port which already provides a 5V output. Note that the 7805 gets very hot when it delivers currents above 500 mA. Maximum current drain is 1A!
When used as +5V input: for supplying the core from an external stabilized Power Supply Unit (PSU).
J4A
J4B
4 Two IIC ports. Interface to BankSticks or to MBHP_IIC_* modules like MBHP_IIC_MIDI.
J5a/b 2*10 Analog sources (like pots) can be connected to this port (8 pots maximum). If more analog pins should be scanned, please use the MBHP_AINSER64 module! There are also some application which use this pin as digital in- or output (mostly described in README.txt file).
Alternatively J5 pins can also be used as digital input and/or output pins (MIOS32_BOARD_J5_*, see tutorial applications). And J5B.A6 (MIDI IN3) and J5B.A7 (MIDI OUT3) provide an alternative MIDI IO port as well if "#define MIOS32_UART_NUM 3" has been added to the mios32_config.h file (defines the number of UART ports).
J8/J9 10 DMA driven SPI port which works at 5V level. J8 is the interface to the DOUT module chain, whereas J9 is the interface to the DIN module chain.
J11E 10 This port provides four MIDI IOs at ca. 5V level (the pin is configured in open-drain mode, so that a resistor connected between the MOx pins and 5V can pull the output level to 3V or 5V. Normally this pull-up resistor is not required if an opto coupler is used at the receiver side)
Interface to the MBHP_MIDI_IO breakout board.
J15a/b 16 Interface to one or two LC display module(s).
Please note that the pinout is different compared to the MBHP_CORE module!
See also special section at the end of this page!
J15_S 3 Allows to select between 5V and 3.3V based LCDs.
For common LCDs (5V based) please stuff the jumper between the middle and 5V pin - the LCD won't be supplied (= won't work) without this jumper!
J16 10 DMA driven SPI port at 3.3V level for SD Card and MBHP_ETH, and additional fast serial interfaces in future. Two chip select lines are available, additional chip selects could be provided by other free pins.
Note: the MBHP_CORE_STM32F4 module has an on-board SD Card Socket, which is directly connected to J16!
J18 2 CAN interface at TTL level as used by MBNet.
J19 8 SPI interface to application specific module extensions at 5V level like the AINSER8, AINSER64 and AOUT module. Two chip select lines are available, additional select lines can be taken from free pins.
J10A
J10B
10 General purpose IO ports with 8 pins each, accessible via MIOS32_BOARD_J10* functions. J10A is mostly used for the "Standard Control Surface" (SCS, see the appr. tutorial application and this schematic) to connect buttons and encoders without the need for a DIN Shift Register.

Soldering Guide

It's always a good idea to start with the smallest components to simplify mounting.
So, start with the resistors and diodes:
  • R7a, R7b, R8a, R8b: 2.2k
  • R11, R13: 1k
  • R12: 10k
  • R33: 4x1k resistor array (polarity!)
  • D1: 1N4148 (polarity!)
Continue with caps, transistor and trimpots:
  • C14, C15 = 100 nF ceramic caps
  • T1: BC337 transistor
  • P1, P2: 10k trimpots
Mount the IC sockets and DIL headers:
  • IC1: 20 pin socket
  • IC2: 16 pin socket
  • 10 2x5 DIL headers
  • 2 2x8 DIL headers
And then the remaining headers:
  • 2 2x25 female SIL headers for the STM32F407G-DISC1 module
  • 3 1x2 male SIL header
  • 1 1x3 male SIL header
  • 2 jumpers stuffed on J17 (USB PWR) and J15_S to select the LCD voltage (5V or 3.3V)
  • SD Card socket
And finally put the ICs, and then the STM32F407G-DISC1 module into the sockets:
  • IC1: 74HCT541
  • IC2: 74HC595
  • STM32F407G-DISC1
The bootloader can be installed on the STM32F4 chip by connecting a Mini-USB cable at the right side of the module (see also description in the "Installing the MIOS32 Bootloader" section of this page) - this only has to be done once, thereafter updates are possible via MIOS Studio. This Mini-USB socket can't be used for USB MIDI based connections!
Applications (and bootloader updates) can be installed via MIOS Studio by connecting a Micro-USB cable at the left side of the module. This USB port is also used for common USB MIDI connections.

In order to add up to 4 MIDI IN and OUT ports, you will need one or two MBHP_MIDI_IO modules. Please follow this page.

Credits

Thanks to Tim aka. SmashTV for creating the PCB layout. PCBs and kits are available in his MIDIbox Shop.



Last update: 2017-04-09

Copyright 1998-2017, Thorsten Klose. All rights reserved.