English Version
Spanish Version
French Version
MIDIbox Hardware Platform, PIC based Core Module
The core module is the brain of most projects which are based on the MIDIbox hardware platform. Upcoming applications (which are currently under development) will use the 32bit version.
Main part of this module is the PIC18F452, a microcontroller manufactured by Microchip. It is clocked at 40 MHz (externaly with a 10 MHz crystal) and offers enough performance to handle analog and digital modules with latencies below 1ms. The PIC is a "system on chip" (SoC), this means, it contains not only a CPU, but also an integrated 32k flash program memory, 1536 bytes data memory, 256 bytes data EEPROM, and a lot of usefull peripherals like AD-converter and UART (for MIDI). I decided to use PIC controllers for my MIDI applications many years ago, and I stayed by this product family because of the low prices and worldwide availability for hobbyists. In distance to other (more modern) microcontrollers, the PIC is easy to program, requires no external memories, is almost non-destroyable and comes in a handy DIP package, so that also electronic beginners can work with this chip without the danger of damaging small SMD pins within some seconds with their soldering iron.
Please note that the memory intensive projects MIDIbox SEQ V3/MIDIbox 808 require a PIC18F4620, and MIDIbox SID V2 a PIC18F4685 instead of PIC18F452. These are pin compatible devices.
If you are planning to program your own application, it's recommended to use a PIC18F452 for highest compatibility with existing MIDIboxes, a PIC18F4620 for RAM intensive projects (64k flash, 1k EEPROM, 3968 bytes RAM), or a PIC18F4685 for code intensive projects (96k flash, 1k EEPROM, but only 3328 bytes RAM - provides CAN interface), or to go for the brand new MBHP_CORE_LPC17 module, which gets use of a LPC1769 microcontroller (512k flash, 64k RAM - provides integrated USB interface, Ethernet and much more!).
MBHP_CORE_V3
-
In the meantime, the core module has reached it's third version. There are some minor improvements in the circuit and layout. However, the old modules can still be used. For the convenience of users who haven't populated an old board yet, a special webpage has been created which contains the old documentation.
Download
-
PCB data, can be viewed, modified and converted with Eagle Light. The .pdf based schematic has been created with xcircuit. There are no special eagle schematics available, since components have been netlisted in the .brd file directly! |
Module |
Schematic |
Layout Data |
Quick-view |
MBHP_CORE_V3 |
mbhp_core_v3.pdf |
mbhp_core_v3.brd |
mbhp_core_v3.gif |
Available Ports
-
Following interfaces are provided by the core module:
Name |
No. of pins |
Description |
J1 |
2 |
Connection to a powersupply unit (PSU). A 7V-10VAC transformer, or a wall adapter could be used. At least 500 mA is recommended, especially if a backlit display is connected, but MIDIfilter and MIDImerger work also with ca. 100 mA. 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. |
J2 |
2 |
When used as +5V output: to supply other core modules in a multiprocessor environment, so that you only have to mount the parts for the power supply (X1, IC3, C5, C6) on one core module. Restriction: the 7805 gets very hot when it delivers currents above 500 mA, so only core modules without backlit display like MIDIO128, MIDImerger, MIDIfilter should be supplied over this port.
When used as +5V input: for supplying from J2 of another core module, or from an external stabilized Power Supply Unit (PSU). In both cases the voltage regulator (IC3) should not be connected, also the rest of the voltage stabilization circuit between J1 and J2 (X1, C5, C6) 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 C5 directly to J2 (a small cable between the outer soldering pads of the left-out 7805 will do this). Please note that supplying multiple core modules from one "main" core is only recommended if the overall circuit doesn't consume more than ca. 500 mA, otherwise the 7805 will get too hot! Especially if LEDs and/or LCDs with backlight are connected to all cores, it's better to spent one 7805 for each core.
Examples for J2 wiring can be found in the SID interconnection diagram and in the MIDIbox LC PSU example. |
J3 |
3 |
obsolete since v3 |
J4 |
4 |
Interface to the BankStick, to MBHP_IIC_* modules like MBHP_IIC_MIDI, and to the second MIDI IN port for MIDImerger. |
J5 |
10 |
Analog sources (like pots) can be connected to this port (8 pots maximum). If multiplexed via AIN module, up to 64 pots can be scanned. Remember that All unused analog inputs must be conncted to ground. There are also some application which use this pin as digital in- or output (mostly described in REAMDE.txt or setup_*.asm file) |
J6 |
5 |
Interface to the AIN module for MIDIbox64 and MIDIbox64E |
J7 |
5 |
Interface to the MF module, sometimes also used for the MBHP_AOUT or MBHP_AOUT_LC module. |
J8 |
5 |
Interface to the DOUT module chain. |
J9 |
5 |
Interface to the DIN module chain. |
J10 |
8 |
Interface to application specific module extensions like the SID module. |
J11 |
4 |
Provides the MIDI IO 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 |
3 |
MIDI OUT port. See the schematic, how to connect a MIDI socket to this port. |
J13 |
3 |
MIDI IN port. See the schematic, how to connect a MIDI socket to this port. |
J14 |
1 |
used by MIOS as touch sensor strobe line. Sometimes also used for debugging purposes. |
J15 |
16 |
Interface to a LC display module. |
Used Components
-
Here a list of the used components. A complete orderlist for Reichelt can be found here, Mouser partlist for the US: see SmashTV's Website, if you have a orderlist for a distributor on your country, feel free publish it on this page!
Part Name |
Value |
Description |
IC1 |
PIC18F452 (or PIC18F4620 or PIC18F4685) |
The PIC microcontroller, which is running under MIOS. |
C1, C2, Q1 |
2*33pF 10 MHz for PIC18F* derivatives |
The resonant circuit for the internal oscillator of the PIC. Note: a 10 MHz crystal with parallel cut has to be used. There are also crystals for serial resonant circuits available (mostly used in radio applications) which will not deliver the correct frequency in connection with the PIC oscillator. |
R1 |
100 |
This resistor connects the low-active reset input of the PIC (MCLR#) with +5V. During power-on, a "slow" flank on this input guarantees that the PIC will be reset correctly. You can plug a Reset button to the PIC if you want, this button has to be connected between the MCLR#-Pin and Vss (ground). In this case, the resistor avoids a short during reset. |
R2, R12 |
1k |
These 1k Resistors to +5V (Pull-Up) are necessary for the IIC interface. Without this resistor the MIDIbox could hang up, frequently reset or send invalid MIDI data once it tries to access an IIC device - therefore please never omit these parts! |
R3 |
10k |
not really necessary ,-) |
T1 |
BC337 |
controls the current through the LCD backlight |
R4 |
1k |
protects the base of the BC337 from high currents. |
P1 |
10k |
With this trimmpot the backlight luminance can be controlled. |
P2 |
10k |
This trimmpot controlls the LCD contrast |
IC2 |
6N138 |
Every MIDI device comes with such an optocoupler which isolates the MIDI Input from the device on the other side, just to avoid any damage. For the case that you don't find a 6N138, you can also use a 6N139 (it's pin compatible). Also the 6N136 has been sucessfully tested, but it requires a modification in the circuit (thanks Arto for testing!) |
R5, R6 |
5.6k, 1.2k |
Pull-Ups/Downs for the optocoupler, values suggested by Bjorn Julin. |
D1 |
1N4148 |
Protection diode for the MIDI Input which avoids damage on the optocoupler if the MIDI In pins are swapped by fault. |
R7, R8, R11 |
220 |
protection resistors for the MIDI ports, they limits the current if the MIDI ports are shortened by fault. |
R9, R10 |
10k |
Pull-Ups for digital inputs, they ensure defined signals if the DIN modules are not connected. |
IC3 |
7805 |
A voltage regulator which regulates the incoming voltage to clean 5V independent from the current load and temperature. It allows over 1.0A load current if adequate heat sinking is provided, without heater up to 500mA are ok. |
C5, C6 |
2200uF, 330nF |
For ripple rejection on the input side of the regulator. |
C3, C4 |
10uF, 100nF |
For ripple rejection on the circuit side. |
C7, C8 |
100nF |
The additional bypass caps have to be placed on the bottom side of the PCB, as close to the power pins of the PIC as possible. |
X1 |
B40C800 |
A bridge rectifier for 40V/800mA in a round package. Normaly such a rectifier is only necessary if the board is supplied with AC, but it is recommended to use it also with DC in order to prevent damage if the power lines are twisted. Optionally this rectifier can be replaced by 4 1N4001 diodes like shown in the circuit diagram. |
J* |
* |
All connectors are optional, the cables can also be soldered directly into the board. Otherwise I suggest SIL headers (header sockets), known from PC motherboards. They are cheap and usefull. |
DIL |
SOCKETS |
Don't forget to buy sockets for the PIC and the optocoupler. The PIC requires a 40 pin DIL socket, the optocoupler a 8 pin DIL socket. |
MIDI |
SOCKETS |
2 MIDI sockets are required for MIDI In/Out. |
Programming the PIC
-
The PIC microcontroller needs a firmware, at least the:
- Primary Bootstrap loader
- MIOS (which also includes the secondary bootstrap loader)
- MIOS Application
Today (anno 2015) it became difficult to DIY a PIC programming device, since historic programmer solutions rely on a RS232 (such as MBHP_JDM) or LPT port (such as MBHP_BURNER), which isn't available on modern PCs anymore. There are USB based solutions, but they are not straightforward to build and error prone.
Therefore here an updated list of recommended options:
- buy a pre-programmed PIC from SmashTV or Mike
- contact TK (the author of this page) in the MIDIbox Forum via PM (higher lead time of up to 1 month, but can program the PIC + install MIOS and the application)
- buy a PICkist2 (clone). See also this page. But this option only makes sense if you plan to program multiple PICs in future.
Typically the bootloader will be programmed into the PIC. Thereafter MIOS and the MIOS application have to be installed via MIOS Studio. See also this page for more informations. This requires a reliable MIDI interface, in best case one of the interfaces listed Whitelist and none of the Blacklist!
For those who find this too scary: consider to build one of the more modern core modules (such as MBHP_CORE_STM32F4) which come with an integrated programmer, and can be updated via USB MIDI. Or contact TK in the MIDIbox Forum via PM (higher lead time of up to 1 month, but can program the PIC + install MIOS and the application based on your request).
Soldering Guide
-
|
Start with soldering the 4 bridges which save you from creating a 2-layer board. You can use the cutted legs of caps and resistors, before you throw them away after you finished all the modules! :-) The 1k resistor R12 should also be soldered very early, because it will be covered by the 40 pin socket later. |
|
Start with mounting the parts. Please keep in mind, that for the electrolytic caps C5 and C4, for the diode D1, for the transistor T1 and for the two ICs (PIC and optocoupler) you have to take the polarity into account. If you are unsure, just compare the schematic, or open the .brd file with Eagle. |
|
The 7805 can be bended a little like shown at this picture. This is required, if you are using a DIL plug for the LCD socket J8 |
|
Two isolated cables have to be added at the bottom of the PCB (see also quickview). They are only required by special modules (e.g. IIC devices, SID module). So long you are sure, that the uploaded programs will never access such devices, then you can left these bridges out. |
|
Apply power to the module after all parts except the PIC and the optocoupler are mounted. Check the voltage levels between the most important pins with a multimeter (analog or digital doesn't matter) before plugging the PIC and the 6N138 into the socket:
IC1:MCLR(1) - IC1:Vss(12) = 5V
IC1:Vdd(11) - IC1:Vss(12) = 5V
IC1:Vdd(32) - IC1:Vss(31) = 5V
IC2(8) - IC2:(5) = 5V |
|
A picture of a finished board - you will notice some differences between this and the other core modules at my website, this is because I've built a lot of variations in the meantime. The picture shows the latest version.
The next step is to upload MIOS, and if this doesn't work, to troubleshoot your MIDI connections. |
Cable Soldering Addendum (due to requests)
-
|
first cut the cable ends with a cutter |
|
the cable ends should be tinned to ensure proper junctions |
|
also the connectors should be tinned |
|
now you can solder the cables to the connectors very easily without additional tin |
Last update: 2024-05-08
Copyright © 1998-2023, Thorsten Klose. All rights reserved.
|