MIDIbox Hardware Platform, CORE_LPC17 Module

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

Main features of the NXP LPC1769 based MBHP_CORE_LPC17 module:

  • 512k Flash and 64k RAM like MBHP_CORE_STM32
  • The prebuilt LPCXPRESSO is available for 20 EUR at Embedded Artists (+ VAT + shipping - in total ca. 30 EUR with "First Class Mail" option). News: now also available directly in Germany for 24 EUR + Shipping from Watterott, in France from Lextronic, and in the USA from Mouser (#924-EA-XPR-003)!
    It will just be attached to the MBHP_CORE_LPC17 PCB
  • Easily available for private persons in small quantities and no SMD soldering skills required
  • ARM Cortex-M3 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
  • Much better performance - compared to PIC or ATMega, the LPC17xx really plays in a different league because of the higher frequency (120 MHz), higher data width (32bit), hardware multiplier and division unit, etc.
  • MIOS32 applications are typically running ca. 30..50% faster than on STM32F103RE @ 72 MHz
  • Very useful integrated peripherals for MIDI and Synthesizer applications, such as UART, SPI, I2C, USB, CAN, Timers, ADC, DAC, Ethernet
  • in distance to STM32F103RE, CAN and USB can be used in parallel
  • the integrated ethernet interface leads to ca. 3 times higher throughput compared to the MBHP_ETH based solution. Performance could even be better by improving the uIP driver.
  • It's easy to interface external components like SD Card and I2S Audio DACs
  • LPC17xx is supplied at 3.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 programmer for flash required, LPC-Link is part of the LPCXPRESSO board to program the MIOS32 bootloader into a "virgin" device
  • Fast upload of application code via USB MIDI (ca. 20..40kb/s) - thanks to the MIOS32 Bootloader
  • Due to improved performance, it allowed me to program MIOS32 and some first applications completely in C. This finally makes MIDIbox applications portable, e.g. it is possible to emulate a MIDIbox on a PC/Mac.

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. This decreases the signal/noise ratio. The MBHP_AINSER64 and MBHP_AINSER8 module helps to overcome this by using an external 5V ADC.
  • all DMA channels share a single interrupt. Request flags have to be checked by the interrupt handler, this consumes some cycles (however, the high CPU frequency somehow compensates this drawback)
  • DMA doesn't support decrement address function, so that SRIO (serial shift register input and output) streams have to be reversed by software.
  • output pins can't be used in open drain mode if a peripheral function like SPI or UART is assigned to it. This seems to be a design bug, because it isn't mentioned in the user manual (in distance: the description of the IO configuration implies that it should work, but it doesn't) - NXP support contacted, no reply yet!
  • accordingly, such peripheral output functions can't be pulled to 5V, 74HCL based buffers are required (part of MBHP_CORE_LPC17 module).
  • this limitation especially hurts for the MIDI OUTs, which can't be supplied at the (commonly used) 5V anymore. As a counter measure, R21, R22, R26 and R27 resistors are 47 Ohm instead of 220 Ohm to achieve a current of more than 5 mA for driving the optocoupler of the MIDI target device.
  • RTC can only be clocked at 1 Hz by an external 32kHz crystal. Accordingly it isn't possible to use it at mS accuracy (no possibility to clock it by the main oscillator)
  • RAM splitted into two 32k halves, there is a gap between the two SRAM ranges which makes it difficult for a code developer to locate variables in GCC. This will lead to unwanted dependencies for bigger MIOS32 applications (large arrays have to be assigned to RAM sections in the C code)

However, although some of these limitations are really annoying, I find the LPC17xx family a good alternative to STM32F4 for the MIDIbox Hardware Platform, especially due to the inexpensive LPCXPRESSO boards with on-board Ethernet PHY.

Installing the MIOS32 Bootloader

The original LPCXpresso board consists of a debug interface (left side) and the so called target (right side), which we will attach on the MBHP_CORE_LPC17 module later.
Before a MIOS32 application can be uploaded via USB-MIDI, it's required to install the MIOS32 Bootloader. This can be done with the freely available LPCXpresso IDE.
Please note that the IDE got changes in the last months which make it more difficult to upload the precompiled binary as described below.
Therefore it's recommended to download version 5.2.6 from the Code Red Technologies webpage.
Note that a registration is required to get access to the IDE installation package. A version for Windows and Linux is available. Mac Users can run the Windows or Linux version on a virtual machine like VirtualBox (this is what I did - both variants are working fine!).
Once the IDE has been installed, another registration has to be done to enable the LPC-Link interface - ready!
After the LPCxpresso IDE has been opened, create a new "FreeRTOS project" for LPC1700 controllers.
This project is only used as a dummy to enable the flash programmer - you don't need to change something in the code template, it won't run under MIOS32 anyhow!
(You will transfer a precompiled binary into the flash)
Select the LPC1769 target. It's red marked because it isn't fully supported by the evaluation version of this IDE - but again: for application development you wouldn't use this IDE anyhow!
Click on the small "Program Flash" icon
Click on the "Browse" button and search for the project.bin binary of the MBHP_CORE_LPC1769 directory which comes with the MIOS32 Bootloader application. Note that you've to explicitely change the file search mask to "*.bin", since this isn't done by default (-> project.bin file not displayed)
Click on the "OK" button to program the bootloader into the flash.
Finally disconnect the USB plug, connect it again.
The red status LED should slowly fade three times (effect via PWM modulation) - the MIOS32 bootloader is up and running!
Please note that the bootloader doesn't work through the USB port of LPC-Link! Instead, a second USB socket will be required, which is directly connected to the LPC1769 target, and which is part of the MBHP_CORE_LPC17 module. But before we can use it, some additional preparations are required as explained in the next sections.

Preparing the LPCXpresso module

The next step is optional!!! and only recommended for experienced DIYers.
We will split the LPCXpresso module into two pieces for aesthetical reasons. Once this has been done, the LPC-Link can still be connected to the target via headers, or optionally a standard JTAG interface could be connected via J3 of the MBHP_CORE_LPC17 module to allow access via alternative debug software (and to overcome the 128k limit for debugging purposes).
Several methods can be found on the web, here I propose an alternative solution. You need a veroboard, a 1-row SIL header with 8 pins, and a so called Stanley knife (carpet knife, german "Teppichmesser").
Stick the SIL header at the border of the vero board; no soldering required (because you want to re-use the SIL header later for other purposes).
Now stick the other side of the SIL header into J4 of the target board - again: no soldering required!
Now you have to cut a deep groove between the two PCB halves. The veroboard will perfectly guide the knife. The PCB material is quite robust, so that it will require multiple (and especially strong!) cuts. The first time it took me more than 10 minutes to get a sufficient groove, the next time (with some practice and less patience) maybe two minutes.
Now you can gently try to separate the boards. Continue with the previous step if it doesn't work - period!
Finally separated. The sharp ends could be beveled with a file!
Now add male headers at the bottom of the target board. You will need:
  • two 27-pin SIL headers for the upper/lower side
  • one 2x6-pin DIL header and a 6-pin SIL header for the right side (pin 19 not used, no need to add a header there)
  • Please note, that some people might prefer to solder female sockets instead - see also the "Making the LPCXPRESSO module removable" topic below!
A 8-pin SIL header should be soldered at he bottom of the left side if a standard JTAG debugger will be connected via J3 of the MBHP_CORE_LPC17 module.
If you are planning to use the LPC-Link instead, the 8-pin SIL header should be mounted at the top...
...so that it can be attached via a SIL female header like shown in this picture.

IMPORTANT: Preparations if LPC-Link not separated

If you decided not to separate the LPC-Link from the LPCXpresso module, it's mandatory to cut the 3.3V line from the two parts!
As long as the 3.3V is connected to the LPCXpresso, the core module won't boot!!!
You could use a knife or a screwdriver to do this. Note that the 8-pin SIL header and the JTAG socket don't have to be stuffed as well if the LPC-Link is available. On the other hand you don't need to remove them to get the core module working!
(click on picture to enlarge)
Background: the 3.3V line between LPC-Link and target powers the core if an USB cable is connected to the LPC-Link module.
But usually we want to power the core from the USB socket of the MBHP_CORE_LPC17 module. As long as the 3.3V connection is available, the LPC-Link will be powered as well, and it forces the LPC1769 chip into reset as long as no debugger connection has been opened by the LPCXpresso IDE.
Once the MIOS32 Bootloader has been programmed, you don't need to use this IDE anymore to program an application, therefore the 3.3V connection can be safely removed.


Module Schematic Layout Data Quick-view
MBHP_CORE_LPC17_V1 mbhp_core_lpc17.pdf mbhp_core_lpc17_pcb_v1_0.zip mbhp_core_lpc17_pcb_v1_0.png
Additional informations
File Size Description
mbhp_core_lpc17_orderlist.txt 1k Reichelt orderlist
mbhp_core_lpc17_midi3_midi4_extension.pdf 10k Optional MIDI IN3/OUT3 and MIDI IN4/OUT4 extension for MBHP_CORE_LPC17 module (must be explicitely enabled by firmware)
mbhp_core_lpc17_output_buffers.pdf 10k Optional 3.3V->5V level shifters at various IO pins

Available Ports

Following interfaces are provided by the core module:

Name No. of pins Description
J1 2 Optional connection to a powersupply unit (PSU). A 7V-10V transformer, or a wall adapter could be used. At least 500 mA is recommended, especially if a backlit display is connected. AC or DC doesn't matter, since the rectifier behind J1 converts to DC anyhow. Also the polarity has not to be taken into account.
Note that the prefered solution is to power the module via the USB socket (see below) - in fact J1 only exists due to historical reasons.
J22 4 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.
J17 2 This jumper enables power supply via USB. Before closing the jumper, ensure that any other supply sources (e.g. at J1 or J2) are removed to avoid shorts or backcurrents to your PC!
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). The voltage regulator (IC6) doesn't need to be connected, also the rest of the voltage stabilization circuit between J1 and J2 (X1, C8, C9) can be left out. If the core module (and all connected modules to this branch) drains more than 100 mA, it's recommended to mount C8 directly to J2 (a small cable between the outer soldering pads of the left-out 7805 will do this).
J3 20 Standard 20 pin interface to JTAG Wiggler, see this page for details.
J4A 4 IIC port. Interface to BankSticks or to MBHP_IIC_* modules like MBHP_IIC_MIDI.
J4B 4 A second IIC port, which can also be used as an additional MIDI IN/OUT port (MIDI IN4/OUT4) if enabled in MIOS32 (add "#define MIOS32_UART_NUM 4" to the mios32_config.h file).
MIDI IN4 will be available on the J4B.SC. If a 6N138 based optocoupler circuit should be connected, replace the 2.2k pull-up R10 by 1k, or add a second 2.2k in parallel to get 1.1k effectively.
MIDI OUT4 will be available on the J4B.SD pin, it isn't required to remove R9 if already soldered - it doesn't hurt.
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).
Sidenote: if MIDI IN4/OUT4 should be enabled, but J5B.A6/A7 should be used for other purposes - e.g. as pot inputs - just write "#define MIOS32_UART_NUM 4" and add "#define MIOS32_UART2_ASSIGNMENT 0" to the mios32_config.h file.
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.
This port provides two MIDI IOs at TTL level, interface to the LED/Thru/COM module. Can also be used to cascade multiple core modules in a MIDI chain (see MIDIbox Link). Note: It's possible to distribute the Tx (MIDI Out) signal to multiple cores, but it isn't allowed to connect more than one Tx output to a Rx input. Instead, a MIDImerger is necessary to combine multiple MIDI IN sources.
J12/J20 3 MIDI OUT port 1 and 2. See the schematic, how to connect a MIDI socket to this port.
J13/J21 3 MIDI IN port 1 and 2. See the schematic, how to connect a MIDI socket to this port.
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 additional fast serial interfaces in future. Two chip select lines are available, additional chip selects could be provided by other free pins.
See the MBHP_SDCARD page for cheap SD Card adapters.
J18 2 CAN interface at TTL level as used by MBNet.
This port can also be used for measuring frequencies as demonstrated in this example.
J19 8 Interface to application specific module extensions at 5V level like the AINSER64 and AOUT module. Prepared for serial interfaces (although not driven by an integrated SPI), two chip select lines are available, additional select lines can be taken from free pins.
J27 2 Bootloader HOLD Mode jumper. The application will be started when this jumper is NOT connected! Bootloader entry will be forced with connected jumper (fallback solution if the application crashes during initialisation).
J28 10 I2S (Audio DAC) Interface as documented at the MBHP_I2S page. Can also be used as general purpose IO port with 4 IO pins by using the MIOS32_BOARD_J28* functions.
J10 10 General purpose IO port with 8 pins, accessible via MIOS32_BOARD_J10* functions. 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.

Minimal Circuit to get USB running

Following minimal circuit is helpful for impatient builders who want to do some experiments with the LPCXPRESSO running under MIOS32 without using the complete MBHP_CORE_LPC17 module. Interaction with the application is possible via the MIOS Studio Terminal and via MIDI of course!

It provides:

  • USB Socket for USB-MIDI and to connect to MIOS Studio
  • jumper for disconnecting the USB power supply
  • 3.3V voltage regulator LF33, 100 uF and 100 nF caps
  • an optional Bootloader Hold jumper which could be useful if the application hangs up due to a programming error (if this happens: close this jumper and reconnect the On/Off jumper to reboot the core - the bootloader stays active and a new .hex file can be uploaded).
    Note that code upload is possible w/o this HOLD jumper if the application is working properly. In other words: the jumper is only a fallback solution for developers.

Other components such as MIDI IN/OUT sockets, MagJack for Ethernet, SRIO ports or whatever can be added successively if required.

Click on the images for higher resolution:

Soldering Guide for the complete MBHP_CORE_LPC17 module

It's always a good idea to start with the smallest components to simplify mounting.
So, start with the resistors and diodes:
  • R7, R8, R9, R10 = 2.2k
  • R11, R13, R18, R23 = 1k
  • R12 = 10k
  • R19, R24 = 4.7k
  • R20, R25 = 220
  • R21, R22, R26, R27 = 47
  • D1, D2, D3 = 1N4148 (polarity! Check the black ring!)
Continue with the resistor arrays.
Take care that they are "polarised"! The dot marks the common pin which has to be soldered into the appr. square pad of the PCB:
  • R2 = 4x10k
  • R33 = 4x1k
Now solder the caps.
Pay attention for the polarity of the El.Caps! The positive leg of an El.Cap is longer than the negative leg. The negative leg is also marked on the cap case. Put the positive into the pad which is marked with "+".
  • C11, C13, C14, C15 = 100 nF
  • C10 = 47 uF (El.Cap - polarity! Plus leg shows to border)
  • C12 = 100 uF (El.Cap - polarity! Plus leg shows to border)
  • C9 = 330 nF
  • C8 = 2200 uF (El.Cap - polarity! Plus leg shows to border)
Solder the special components:
  • T1 = BC337 (polarity!)
  • P1, P2 = 10k Pots
  • IC6 = 7805 (polarity! see picture)
  • IC7 = LF33 (polarity! see picture)
  • X1 = rectifier (polarity!)
And add IC sockets and jumpers:
  • IC1, IC2, IC4, IC5 sockets
  • J17, J15_S, J27 jumpers
  • J1, J2, J4A, J4B, J18 sockets
  • USB socket
Optional step: before continuing, it makes sense to do a basic voltage check: plug in the USB cable, and mount the "USB Power" jumper on J17. Thereafter you should measure ca. 3.3V between GND (lower left corner in this picture) and the 3v3 (lower right corner) supply pins to the LPCXPRESSO module.
Note that USB Power Jumper J17 has to be removed when the core is supplied externally via J1!
Add the remaining sockets:
  • 2x5 pin sockets J5A, J5B, J19, J8/9, J16, J10
  • 2x8 pin sockets J15A and J15B
  • 2x10 pin socket J3 (optional for JTAG)
  • 4 MIDI Sockets
And the optional female (or male) sockets for the LPCXPRESSO module if you want (see also the "making the LPCXPRESSO module removable" topic below).
Plug the LPCXPRESSO into the board and solder all pins.
Finally plug the ICs into the sockets:
  • IC1 = 74HCT541
  • IC2 = 74HCT595 if LCD should be supplied at 5V, otherwise 74HC595 for 3.3V option
    Note: 74HCT595 not available at Reichelt - take 74HC595 instead, it will work properly anyhow!
  • IC4, IC5 = 6N138
If you decided not to separate the LPC-Link from the LPCXpresso module, it's mandatory to cut the 3.3V line from the two parts!
As long as the 3.3V is connected to the LPCXpresso, the core module won't boot!!!
You could use a knife or a screwdriver to do this. Note that the 8-pin SIL header and the JTAG socket don't have to be stuffed as well if the LPC-Link is available. On the other hand you don't need to remove them to get the core module working!
(click on picture to enlarge)
Since the LPCXPRESSO module doesn't provide dedicated pins for the two Ethernet Socket LEDs, you have to solder them directly from the appr. on-board SMD LEDs to J26 of the core module with two wires (click on picture to enlarge).

DONE! :-)

Hint: making the LPCXPRESSO module removable

Ilmenator demonstrates in this forum posting how you can make the LPCXPRESSO module removable by using female sockets. Unfortunately it's hard to get perfectly matching female sockets with at least 27 pins, and the 20-pin sockets available at Reichelt are slightly too long. Therefore some file work is required to combine multiple sockets.

Using sockets for the LPCXPRESSO module is recommended, but not required if you are sure what you are doing.

It's also up to you if you prefer to use these female sockets for the LPCXPRESSO module, or for the MBHP_CORE_LPC17 module. Since female sockets are more expensive, you have to consider if you would like to use the LPCXPRESSO module on multiple boards, or if you want to get the possibility to replace the LPCXPRESSO module by another (pin compatible) one in future.

Special Guide: Connecting a 2x20 (or 2x40) LCD

The pinning of the 2x8 LCD connectors J15A and J15B is mirrored to simplify the cabling of common 2x20 and 2x40 displays (and partly due to historical reasons - it's originated from the so called "UltraPCB").
Note also that in difference to the MBHP_CORE_STM32 module, the J15 ports have been rotated by 180 degrees! But the polarity is the same, which means that you can re-use the LCD cables which you made for the MBHP_CORE_STM32 module.
J15 Pin 1 (labeled with Vs) goes to Pin 1 of the LCD (normaly named "Vss").
Following pictures illustrate the orientation of the IDC connectors:

See also this schematic.


A big thank-you goes to Sebastian Kulik, who pushed me to evaluate a new microcontroller and who created the layout. He used Altium Designer for this task and wants to thank the company for the very friendly support.

Last update: 2016-05-22

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