====== MBHP Core Module======
====== About ======
The [[:home:mbhp]] Core Module is the heart and brain of every MIDIbox. It holds the PIC microcontroller which runs MIOS and your MIDIbox application. It handles MIDI communication, it drives an LCD (or two, or more), and it connects all the other modules. The main part of this module is the [[:mbhp:pic:18f452|PIC18F452]], a microcontroller manufactured by [[http://www.microchip.com/|Microchip.]] It is clocked at 40 MHz (externally with a 10 MHz crystal) and offers enough performance to handle with all the 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.
A nice outlook for the future is, that Microchip still considers pin compatible devices. The MBHP started with a PIC16F877, in the meantime PIC18F452 is used, and for memory intensive projects like [[:home:project:midibox_seqv3|MIDIbox SEQ V3]] or [[:project:midibox_sidv2|MIDIbox SID V2]] the [[home:mbhp:pic:18f4620|PIC 18F4620]]/[[home:mbhp:pic:18f4685|PIC 18F4685]]. So long this upgrade path is given, a switch to another microcontroller family (like [[http://www.atmel.com/|Atmel]] devices) with all it's advantages, but also disadvantages, is not required, and hard/software compatible applications can still be expected in the next years.
===== Specs =====
One core module, stuffed with a supported processor, can handle:
* up to 128 digital inputs
* up to 128 digital outputs
* up to 64 analog inputs
* character and graphical dotmatrix LCDs
* BankSticks (IIC EEPROMs)
* one MIDI In, one MIDI Out, optionally as to-COM interface
In addition, multiple cores can be linked together to extend these capabilities. [[http://www.midibox.org/dokuwiki/doku.php?id=home:mbhp:module:core#multiple_cores|Linking Multiple Cores]]
====== Getting Started ======
* [[:home:skills:tools| Tools]]
* [[:home:mbhp#parts | Where to buy Parts]]
* [[:home:skills:Soldering]]
* [[:home:skills:etching_pcbs | Etching PCBs]]
* [[:home:skills:terminating_cables | Terminating Cables]]
===== Special Instructions =====
====== Details ======
===== Past Core Revisions =====
(Check on PCB for revision number)
* [[http://www.avishowtech.com/mbhp/mbhp_core.html|Core V2]] SmashTV, pcb-mike, TK, home-etch
* [[http://www.avishowtech.com/mbhp/mbhp_coreR3.html|Core R3]] SmashTV
* [[http://www.avishowtech.com/mbhp/mbhp_coreR4c.html|Core R4c]] SmashTV
===== Pin out list =====
==== Port List ====
| Pins | Description |
^ J1 | Connection to the power supply. Either the output of a 7V-10V transformer, or a wall adapter can be used. 500 mA is recommented, especially if a backlit display is used, 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 | +5V output, can be used to supply other core modules in a multiprocessor environment, so that you only have to mount the parts for the power supply (BR1, 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.|
^ J4 | Interface to the BankStick, to MBHP_IIC_* modules like MBHP_IIC_MIDI, and to the second MIDI IN port for MIDImerger.|
^ J5, J5a, J5b | This is an either-or setup. J5 matches the old (SIL) AIN connection. J5A and J5B match the with newer AIN boards (AIN_R3 up). Obviously with newer AIN boards leave out the SIL pinheader out and load J5A/B, if using older boards leave out J5A/B and load J5. Interface to the AIN module for MIDIbox64 and MIDIbox64E. There are also some application which use this as digital in- or output.|
^ J6 | J6-Interface to the AIN module for MIDIbox64 and MIDIbox64E.|
^ J7 | Interface to the MF module, sometimes also used for the MBHP_AOUT or MBHP_AOUT_LC module.|
^ J8 | Pay attention to this one, it has moved since last rev.... Interface to the DOUT module chain.|
^ J9 | Pay attention to this one, it has moved since last rev.... Interface to the DIN module chain.|
^ J10 | Pay attention to this one, it has moved since last rev.... Do not mistake it for J8 orJ9 since they were in this position on the last rev. Interface to application specific module extensions like the SID module.|
^ J11 | MIDI digital IO port, interface to the LED/Thru/COM module. Can also be used to cascade multiple core modules in a long MIDI chain. Note: Don't plug the optocoupler (IC2, 6N138) into the socket when using the J11:MI (MIDI-IN) pin as an input, otherwise the Rx input will get the data from two different sources, which is not provided by the MIDI protocol (point-to-point). A MIDImerger is necessary to combine multiple MIDI IN sources. In other words: when using the COM module or when connecting the J11:MO of one core module to J11:MI of another core module, or when connecting the core module directly with the Gameport, the optocoupler of the other module should not be plugged into the socket to avoid a corrupted MIDI data stream.|
^ J12 | MIDI OUT port. This is an either-or position, load SIL 3 pin header for wiring to panel mount MIDI jacks, otherwise install a PCB mount MIDI socket in/over the J12 pads. |
^ J13 | MIDI IN port. This is an either-or position, load SIL 3 pin header for wiring to panel mount MIDI jacks, otherwise install a PCB mount MIDI socket in/over the J12 pads.|
^ J14 | Used by MIOS as touch sensor strobe line. Sometimes also used for debugging purposes.|
^ J15 | Interface to LCD display module.|
^ GND LIFT | Can be used to temorarily disconnect the CORE's ground from the ground on J12:Pin2. Leave this alone for normal operation!|
==== Pin List ====
This list gives you an oversight over the pin usage of MIOS.
^ Name ^ Class ^ Core Port:Pin ^ PIC Pin # ^ Direction ^ Additional Information |
| RA0 | A | J5:A0 | 2 | Input | analog pin|
| RA1 | A | J5:A1 | 3 | Input | analog pin|
| RA2 | A | J5:A2 | 4 | Input | analog pin|
| RA3 | A | J5:A3 | 5 | Input | analog pin|
| RA5 | A | J5:A4 | 7 | Input | analog pin|
| RE0 | A | J5:A5 | 8 | Input | analog pin|
| RE1 | A | J5:A6 | 9 | Input | analog pin|
| RE2 | A | J5:A7 | 10 | Input | analog pin|
| RA4 | K | J4:SD | 6 | Input / Output | IIC data pin SD, external 1k pull-up, can be used by an application for other purposes so long MIOS_IIC_* won't be called|
| RC0 | B | J6:RC / J7:RC | 15 | Output | used to address the AIN multiplexers or the MF module. In both cases driven by an interrupt service routine. |
| RC1 | B | J6:SC / J7:SC | 16 | Output | used to address the AIN multiplexers or the MF module. In both cases driven by an interrupt service routine. |
| RC2 | D | J7:SO | 18 | Output | used as serial output to the MF module, driven by an interrupt service routine. |
| RC3 | C | J6:SI / J10:PWM | 17 | Output | used to address the AIN multiplexers, driven by an interrupt service routine / SID PWM. This pin is stuffed with an external 10k pull-up which could be useful for an application which uses this pin as input|
| RD0 | E | J8:SO | 19 | Output | serial output to the DOUT chain, driven by an interrupt service routine if MIOS_SRIO active|
| RD1 | E | J9:SI | 20 | Input | serial input to the DIN chain, used by an interrupt service routine if MIOS_SRIO active|
| RD2 | F | J8:RC / J9:RC | 21 | Output | serial latch output, used by an interrupt service routine if MIOS_SRIO active|
| RD3 | F | J8:SC / J9:SC / J10:SC | 22 | Output | serial clock output, used by an interrupt service routine if MIOS_SRIO active / SID SC|
| RC4 | G | J10:RC | 23 | Output | SID RC / free for applications without restrictions if second CLCD not used|
| RC5 | G | J10:SO | 24 | Output | SID SO / free for applications without restrictions|
| RD4 | E | J14 | 27 | Output | touch sensor strobe signal, used by an interrupt service routine if MIOS_SRIO active and TS_Sensitivity > 0|
| RD5 | H | J4:SC / J10:MD / J15:RS | 28 | Output | clock output to IIC / SID MD / address signal to LCD |
| RD6 | H | J10:MU / J15:RW | 29 | Output | SID MU / RW signal to LCD|
| RD7 | I | J15:E | 30 | Output | enable signal to LCD (exclusive!)|
| RB0 | J | J15:D0 | 33 | Input / Output | LCD data line #0|
| RB1 | J | J15:D1 | 34 | Input / Output | LCD data line #1|
| RB2 | J | J15:D2 | 35 | Input / Output | LCD data line #2 / CAN Tx|
| RB3 | J | J15:D3 | 36 | Input / Output | LCD data line #3 / CAN Rx|
| RB4 | J | J15:D4 | 37 | Input / Output | LCD data line #4|
| RB5 | J | J15:D5 | 38 | Input / Output | LCD data line #5|
| RB6 | J | J15:D6 | 39 | Input / Output | LCD data line #6|
| RB7 | J | J15:D7 | 40 | Input / Output | LCD data line #7|
The pins are divided into following classes:
* Class A: analog inputs, which can be optionally used as digital inputs or outputs like demonstrated in the j5_dout and j5_din example if the MIOS_AIN and MIOS_MF driver are not used
* Class B: digital pin which is free for applications if neither the MIOS_AIN multiplex driver, nor the MIOS_MF driver is active Also free if MIOS_AIN doesn't run in mux mode
* Class C: digital pin which is free for applications if the MIOS_AIN multiplex driver isn't active
* Class D: digital pin which is free for applications if the MIOS_MF driver isn't active
* Class E: digital pin which is free for an application if the MIOS_SRIO driver isn't active. Can also be shared with other devices if the application accesses the pin from an interrupt service routine or if it disables all interrupts for a short time (< 300 uS!). Touchsensor Pin.
* Class F: digital pin which is free for an application if the MIOS_SRIO driver isn't active.
* Class G: free pin which can be used by the application without any restrictions
* Class H: digital pin which can be shared with other modules (LCD/IIC/...) Shouldn't be used from an interrupt service routine
* Class I: digital pin, exclusive for LCD
* Class J: digital IO pin, can be shared with the LCD data lines as IO pins so long J15:E is low (means: MIOS doesn't execute a MIOS_LCD function) Shouldn't be used from an interrupt service routine
* Class K: see description
See also the [[http://www.ucapps.de/mbhp/mbhp_core_v3.pdf|schematic of the MBHP_CORE]] module as reference, or this PCB layout:
{{http://www.ucapps.de/mbhp/mbhp_core_v3.gif}}
This table is based on the original from [[http://www.ucapps.de/mios/mios_pin_list.txt|mios_pin_list.txt]]
===== PCB files =====
* [[http://www.ucapps.de/mbhp/mbhp_core_v3.brd|Core V3 .brd]] -PCB data, can be viewed, modified and converted with [[http://www.cadsoft.de/download.htm|Eagle Light]]
* [[http://www.avishowtech.com/mbhp/coreR3PM.pdf|Core V3 artwork]] Printible artwork for etching your own boards SmashTV
===== Schematic =====
* [[http://www.ucapps.de/mbhp/mbhp_core_v3.pdf|MBHP Core V3]] uCapps.de
==== List of parts ====
Here are suggested part numbers for various distributors for parts for the core V3 board. If you find another site or dealer with a different parts list feel free add it into the list. Also if you’ve successfully used a different part from what was listed here please add the number and/or link to the list.
| Description ^ polarity ^ Soldering Instructions ^ QTY ^ [[http://www.reichelt.de/|Reichelt]] Part# (([[:home:mbhp:reichelt_shopping_cart|Reichelt Shopping Cart Links]])) ^ [[http://www.mouser.com/|Mouser]] Part# ^
^ PIC18F452-I/P | Yes | Don't (use socket) | 1 | PIC 18F452-I/P | [[http://www.mouser.com/search/productdetail.aspx?R=PIC18F452-I%2fPvirtualkey57940000virtualkey579-PIC18F452-I%2fP|579-PIC18F452-I/P]] |
^ Crystal 10 MHz | No | | 1 | 10-HC18 | [[http://www.mouser.com/search/productdetail.aspx?R=XT9S20ANA10Mvirtualkey61300000virtualkey73-XT49S1000-20|73-XT49S1000-20]] |
^ Voltage Regulator 7805 | Yes | | 1 | uA 7805 | [[http://www.mouser.com/search/productdetail.aspx?R=LM7805CTvirtualkey51210000virtualkey512-LM7805CT|512-LM7805CT]] |
^ IC-Socket for PIC | Yes | | 1 | GS 40P | [[http://www.mouser.com/search/productdetail.aspx?R=390262-5virtualkey57100000virtualkey571-3902625|571-3902625]] |
^ Optocoupler 6N138 | Yes | Don't (use socket) | 1 | 6N 138 | [[http://www.mouser.com/search/productdetail.aspx?R=6N138virtualkey61370000virtualkey782-6N138|782-6N138]] |
^ IC-Socket for Optocoupler | Yes | | 1 | GS 8P | [[http://www.mouser.com/search/productdetail.aspx?R=390261-2virtualkey57100000virtualkey571-3902612|571-3902612]] |
^ Transistor BC337 | Yes | quick | 1 | BC 337-16 | [[http://www.mouser.com/search/productdetail.aspx?R=BC337TFvirtualkey51210000virtualkey512-BC337TF|512-BC337TF]] |
^ Resistor 10 kOhm | No | | 3 | 1/4W 10k | [[http://www.mouser.com/search/productdetail.aspx?R=291-10K-RCvirtualkey21980000virtualkey291-10K-RC|291-10K-RC]] |
^ Resistor 5.6 kOhm | No | | 1 | 1/4W 5.6k | [[http://www.mouser.com/search/productdetail.aspx?R=291-5.6K-RCvirtualkey21980000virtualkey291-5.6K-RC|291-5.6K-RC]] |
^ Resistor 1.2 kOhm | No | | 1 | 1/4W 1.2k | [[http://www.mouser.com/search/productdetail.aspx?R=291-1.2K-RCvirtualkey21980000virtualkey291-1.2K-RC|291-1.2K-RC]] |
^ Resistor 1 kOhm | No | | 3 | 1/4W 1k | [[http://www.mouser.com/search/productdetail.aspx?R=291-1K-RCvirtualkey21980000virtualkey291-1K-RC|291-1K-RC]] |
^ Resistor 220 Ohm | No | | 3 | 1/4W 220 | [[http://www.mouser.com/search/productdetail.aspx?R=291-220-RCvirtualkey21980000virtualkey291-220-RC|291-220-RC]] |
^ Resistor 100 Ohm | No | | 1 | 1/4W 100 | [[http://www.mouser.com/search/productdetail.aspx?R=291-100-RCvirtualkey21980000virtualkey291-100-RC|291-100-RC]] |
^ Ceramic Cap 100 nF | No | | 3 | Z5U-2,5 100n | [[http://www.mouser.com/search/productdetail.aspx?R=C412C104K5R5TAvirtualkey64600000virtualkey80-C412C104K5R|80-C412C104K5R]] |
^ Ceramic Cap 330 nF | No | | 1 | MKS-2 330n | [[http://www.mouser.com/search/productdetail.aspx?R=C320C334M5U5TAvirtualkey64600000virtualkey80-C320C334M5U|80-C320C334M5U]] |
^ Ceramic Cap 33 pF | No | | 2 | Kerko 33p | [[http://www.mouser.com/search/productdetail.aspx?R=140-100N5-330J-RCvirtualkey21980000virtualkey140-100N5-330J-RC|140-50N2-330J]] |
^ Polarised Capacitor 10 uF | Yes | | 1 | rad 10/35 | [[http://www.mouser.com/search/productdetail.aspx?R=140-HTRL25V10-RCvirtualkey21980000virtualkey140-HTRL25V10-RC|140-HTRL25V10-RC]] |
^ Polarised Capacitor 2200 uF | Yes | | 1 | rad 2200/16 | [[http://www.mouser.com/search/productdetail.aspx?R=140-HTRL16V2200-RCvirtualkey21980000virtualkey140-HTRL16V2200-RC|140-HTRL16V2200-RC]] |
^ Diode 1N4148 | Yes | quick | 1 | 1N 4148 | [[http://www.mouser.com/search/productdetail.aspx?R=1N4148virtualkey61370000virtualkey78-1N4148|78-1N4148]] |
^ Rectifier | Yes | | 1 | B80C800RUND | [[http://www.mouser.com/search/productdetail.aspx?R=W08G-E4virtualkey61370000virtualkey625-W08G-E4|625-W08G]] |
^ TrimmPot 10 k | Yes | | 2 | PIHER 10-S 10K | [[http://www.mouser.com/search/productdetail.aspx?R=PT6KV-02567-PT6KV-103A2020virtualkey53100000virtualkey531-PT6KV-10K|531-PT6KV-10K]] |
^ MIDI Sockets | Yes | | 2 | MAB 5S | [[http://www.mouser.com/search/productdetail.aspx?R=161-0505virtualkey11180000virtualkey161-0505|161-0505]] |
^ 1-row SIL Headers (about 30 pins) | No | | 1 | STIFTL. 40G | [[http://www.mouser.com/search/productdetail.aspx?R=2340-6111TGvirtualkey51750000virtualkey517-6111TG|517-6111TG]] |
^ 1-row sil female 36 con | No | | 1 | - | [[http://www.mouser.com/search/productdetail.aspx?R=929850-01-36-10virtualkey51750000virtualkey517-850-01-36|517-850-01-36]] |
^ 2-row SIL Headers (about 2*22 pins) | No | | 1 | STIFTL. 2X40G | [[http://www.mouser.com/search/productdetail.aspx?R=2380-6221TGvirtualkey51750000virtualkey517-6221TG|517-6221TG]] |
^ 2-row sil female 25 rows | No | | 1 | - | [[http://www.mouser.com/search/productdetail.aspx?R=929852-01-25-10virtualkey51750000virtualkey517-852-01-25|517-852-01-25]] |
^ Ribbon cable 3 meters | No | | 3 | AWG 28-16G | - |
^ Wall adapter (Power supply) 500 mA | - | | 1 | MW 17-GS/6 | - |
^ Socket for Power Supply | - | | 1 | HEBLM 21 | - |
[[:home:mbhp:reichelt_shopping_cart|Reichelt Shopping Cart Links]]
\\
==== PIC ====
The Microchip PIC18F series chips are used as the main microprocessor in the Core module. Details regarding the chips are as follows:
=== 18F452 (I/P) ===
[[:home:mbhp:pic:18F452]]
* About - This is the original chip used for MIOS/MBHP projects
* Basic Specs -
* Pros/Cons - Simple, widely used, but lacks some features seen in newer PIC18F variants
=== 18F4620 ===
[[:home:mbhp:pic:18F4620]]
* About - Almost identical to the '452, but with expanded codespace and RAM.
* Basic Specs -
* Pros/Cons - Should work wherever a '452 is specified, and also used in other apps such as MBSEQv3 where extra RAM is useful. Beware early revisions of this chip may suffer from the [[:home:mbhp:pic:eusart_bug|EUSART bug]].
=== 18F4685 ===
[[:home:mbhp:pic:18F4685]]
* About - A more recent PIC18F with similar codespace and RAM to the '4620, but with some added peripherals.
* Basic Specs
* Pros/Cons - Contains a CAN buss peripheral for fast inter-processor communications >1Mbps and implementation of [[#MBNet]]. Slightly less codespace and RAM compared to the '4620, to accomodate these features. RAM handling differs from the 452/4620, so not all apps are compatible.
===== Multiple Cores =====
There are different possibilities to have multiple Cores.
* [[http://www.ucapps.de/midibox_link.html|MIDIbox Link]] uCApps //Linking multiple Cores via MIDI (a special configured MIDI forwarding pipe)//
* [[http://www.ucapps.de/midibox_network.html|MBNet]] uCApps //The new MIDIbox Network utilizing the [[:home:mbhp:pic:CAN]] (Controller Area Network) Interface on the brandnew [[:home:mbhp:pic:18f4685|PIC18F4685]] microcontrollers
\\
====== Building it ======
===== Building instructions =====
* [[http://virtualorgan.com/virtualorgan/FileLib/Assembling_a_MIDIbox_Core.pdf|How to assemble a SmashTV Core module kit]] - Link to PDF document VirtualOrgan
===== Loading MIOS and Applications =====
FIXME these pages should be imported into the wiki
==== English Version ====
This page has been split into two pieces:
[[http://www.ucapps.de/mios_bootstrap_newbies.html|Newbie Section]] everything you need to know if you want to upload MIOS and an application to the Core
[[http://www.ucapps.de/mios_bootstrap_experts.html|Experts Section]] this is the old page which discusses some details about the MIOS Bootstrap Loader.
==== French Version ====
Cette page est maintenant structurée de la manière suivante:
[[http://www.ucapps.de/mios_bootstrap_newbies_fr.html|Section "Newbie" (débutants)]] Tout ce que vou s avez besoin de savoir pour uploader le MIOS et une application vers un module Core
[[http://www.ucapps.de/mios_bootstrap_experts_fr.html|Section "Experts"]] C'est l'ancienne page, plus d&eac ute;taillée quant au MIOS Bootstrap Loader.
==== Spanish Version ====
Esta página ha sido dividida en dos secciones:
[[http://www.ucapps.de/mios_bootstrap_newbies_es.html|Sección "Novatos" (newbie)]] Todo lo que debes saber si quieres cargar MIOS y una aplicación en el módulo Core
[[http://www.ucapps.de/mios_bootstrap_newbies_es.html|Sección Expertos]] Esta es la antigua página en la que se discuten algunos detalles del cargador bootstrap MIOS.
====== Testing ======
**How do I test my circuit?**
Before you plug the ICs into the sockets, you should measure the voltage levels at the power pins (Vss and Vdd - Vss means: ground (0V), Vdd means: +5V, you will find the corresponding pins in the schematics). Disconnect the power, plug the ICs into the sockets, turn on the power. Now quickly measure the voltage between any ground and 5V pin again. If you don't see any change (already +5V) you've made the most critical step. Otherwise you have a shorted in your circuit and should disconnect the power as fast as possible to avoid damages.
Continue with the MIDI Out port tests like described at the [[http://www.ucapps.de/howto_debug_midi.html|Troubleshooting]] uCapps.de page.
===== Troubleshooting =====
[[:home:skills:troubleshooting]]
==== References ====
* [[http://www.ucapps.de/mbhp_core.html|Core Module]] uCApps
* [[http://www.avishowtech.com/mbhp/mbhp_coreR4d.html|Core Module R4D]] from SmashTV smashTV