Midi Interface

Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

4099MEE Planning Report - Low-cost USB MIDI Controller

Paul Harvey

4099MEE IAP2 planning report


Title:

Low-cost USB MIDI controller

Date:

20. Feb. 2004

Version:

0.3

Name:

Paul Harvey

GU ID:

1733426

Table of Contents
1. Introduction.....................................................................................................................2
2. Program Justification and Development..........................................................................2
Figure 1: High level conceptual schema diagram...........................................................3
3. Program Schedule............................................................................................................4
4. Initial Cost Estimate........................................................................................................6
5. Assessment of Potential Benefits....................................................................................6
6. Risk Assessment and Ethical Considerations..................................................................6
7. Control Procedures..........................................................................................................7
8. Technical Specifications..................................................................................................7
Figure 2: A concept 3D drawing of a MIDI controller...................................................8
Firmware.........................................................................................................................9
8.1 Minimum outcomes.......................................................................................................9
8.2 Additional outcomes......................................................................................................9
9. Quality Schedule............................................................................................................10
10. Wider Engineering Issues............................................................................................11
11. Learning Contract - Skills expected to be gained during this project:.........................11
Appendix A: MIDI technology summary..........................................................................12
Appendix A2: Current MIDI controller market summary.................................................13
Figure 4: A competitor's product similar to the Analogik MIDI controller concept.....13
Appendix A3: Reasons for dropping early PICmicro based prototype.............................13
Appendix B: Current design decisions..............................................................................14
Appendix C: Project Gantt chart.......................................................................................15
Appendix D: Early Original prototype partial Bill Of Materials ......................................16
Appendix F: USB MIDI Controller Test Plan...................................................................17
Appendix F2: MIDI Controller Test Jig setup...................................................................18
Appendix Z: Changelog.....................................................................................................19

Modified: 20. Feb. 2004

Version: 0.3

Page 1 of 20

4099MEE Planning Report - Low-cost USB MIDI Controller

1.

Paul Harvey

Introduction

Analogik (http://www.analogik.com) is a Brisbane based electronic music and multimedia


group. They have recognized a market for, and require the design, of a low cost Musical
Instrument Device Interface (MIDI) controller. Analogik hopes that at conclusion of this
Industrial Affiliates Program 2 (IAP2) subject, a working prototype from which a production
version can be derived will be created.
There are four main persons involved with this project. Paul Harvey (Project
leader/developer), Dr. Yongsheng Gao (University supervisor), Dr. David Rowlands
(Technical supervisor), Dejan Petrovic (Representative from Analogik, may perform final
independent testing/verification).
This project has already had some work done prior to the beginning of Industrial Affiliates
Program 2 (IAP2). This has consisted primarily of research into MIDI technology, suitability
of various Micro Controller Units (MCUs), and Universal Serial Bus-First In First Out
[buffers] (USB-FIFOs) Integrated Circuits (ICs). See Appendix A3 for more details.
A MIDI controller is used by electronic music enthusiasts and professionals to assist in the
composition and editing stages. Generally, a typical unit will have a number of continuous
controls such as knobs and sliders, a few octaves of keyboard keys, as well as digital
triggers in the form of buttons. Some units have feedback in the form of motorized sliders,
LEDs, and LCDs. Sophisticated models have specialized input devices like pitch wheels and
joysticks for sound effect creation. See Figure 2 for an example.

2. Program Justification and Development


As technology becomes increasingly affordable, powerful and accessible, the public use it
more and more for their creative works. As PC software has rapidly replaced all the physical
MIDI hardware that traditionally used to do the final synthesis into audio, MIDI controllers
are now an integral part of electronic music creation, live performances and studio work.
The cheapest existing product that is almost in direct competition with the Analogik MIDI
controller concept is the Evolution UC33E, with 47 knobs/sliders and 14 assignable buttons.
Priced at $649 AUDi, shown in Appendix A2, Figure 4, along with more information.
Analogik hopes to initially sell 50 100 units of a device with similar specifications and that
is no more expensive than the UC33E. If necessary, a production unit for Analogik may
incorporate an extra feature such as 16 bit audio line in/out ports. However, this is beyond the
scope of the IAP2 project.
The minimum deliverables are described in Section 8, Technical Specifications - Minimal
Outcomes. A working demonstration to Dejan Petrovic and/or Dr. David Rowlands would
confirm the completion of the minimum deliverables.
Modified: 20. Feb. 2004

Version: 0.3

Page 2 of 20

4099MEE Planning Report - Low-cost USB MIDI Controller

Paul Harvey

Figure 1: High level conceptual schema diagram


E.G.
Drum Synth Device
PC

E.G.
Keyboard Device

4
MIDI
source
device

USER

User Input

CHANNEL 5
PATCH 3

PC USB
Host Controller

MIDI 1.0
ports

MIDI-over-USB

THRU IN OUT

User output

MIDI
sink
device

US
IN ER
PU
T

USB type 'B'


socket

ER
US PUT
T
OU

MCU

USB
FIFO

NB: USB, MIDI 1.0 IN/OUT are all digital serial-bus type interfaces.

Figure 1 above shows a simplistic data flow diagram of a typical MIDI controller setup. The
user interacts with the device using input controls such as knobs, sliders and buttons (block
1), and also monitors output in the form of an LCD and status LEDs (block 2). For actual
input/output specifications, see Section 8.1. This I/O is relayed via the MIDI controller
circuitry (block 3, where the entire scope for this project lies) to a PC running MIDI capable
software (block 4) via USB, MIDI-over-USB. The MIDI source/sink blocks demonstrate
the ability for the MIDI bus to be expanded with more MIDI devices. The MIDI 1.0 bus
traditionally connects via a legacy 15 pin d-sub gameport connector on a PC with an adapter,
however, modern laptops and PCs often do not have this so USB is used instead.
Project goals
1. Create a prototype low-cost MIDI controller, where at the conclusion of this IAP2 project a
functioning PCA to which the specified user I/O (See 8.1) will connect as test jigs
2. A MIDI IN port will be implemented to which a MIDI source can be attached (see Fig. 1)
3. A MIDI OUT port will be implemented to which a MIDI sink can be attached (see Fig. 1)
4. A USB port will be implemented to which a PC will be attached, communicating MIDI
messages (See Fig. 1, block 3-4 connector)
5. Actual form factor of input panel controls is not within the scope of this project
ergonomics, economics, and manufacturing issues need to be addressed. Hence the usage
of test jigs for user input/output they are not to be considered part of the assessed project.
Currently, the HC9S12A64CFU MCU from Motorola has been chosen, as has the FTDI
FT8U245AM USB FIFO/UART IC. See Appendix B: Current Design decisions for
justification and driver software issues.
Modified: 20. Feb. 2004

Version: 0.3

Page 3 of 20

4099MEE Planning Report - Low-cost USB MIDI Controller

Paul Harvey

3. Program Schedule
Refer to Gantt chart in Appendix C. All work is to be carried out on a standard PC
workstation under the GNU/Linux platform with Internet connection. Even if not listed, this
resource is assumed to be used throughout the entire project.
Work breakdown major milestones are marked in bold
Week Item
0.

Research. Items:

MIDI 1.0 specification must be acquired through library or purchased from


the MIDI manufacturer's association

Further investigation into USB technology and MIDI over USB

Develop block diagram of all significant components in the MIDI controller

Resources required:

1-2.

Complete MIDI 1.0 Detailed Specification v96.1 (second edition) (2001);


available from library OR the MIDI Manufacturer's Association at
http://www.midi.org/about-midi/specinfo.shtml for US$19.00 per book

Design and develop HC12 RTOS firmware using simulator

Implement input reading and LCD routines using simulator

Start the design of full (all I/O present) schematic, decide on which
MCU pin will do what

Items:

Resources required:

3-4.

PCB CAD software; University's copy of Protel (NB: voids use of PCB
design for commercial purposes)

Items:
Milestone: Implement firmware on a real HC9S12DP256 evaluation board

Test code should show evidence of working input routines on debug port

Add (breadboard) MIDI ports, LCD

Set up a testing environment for MIDI.

Resources required:

5-6.

HC9S12 evaluation board (provided by Paul Harvey)

Breadboard, MIDI DIN sockets, MIDI -> legacy PC game port adapter,
cables, opto-coupler, misc. components (may be provided by Paul Harvey)

Workbench space, CRO, lab PSU, multimeters (supplied by the University)

Firmware milestone: LCD, MIDI 1.0 IN and OUT ports functional

Correct MIDI messages via legacy gameport generated in response to input

LCD shows (hex) controller ID and value of last potentiometer change

Project Confirmation
Modified: 20. Feb. 2004

Version: 0.3

Page 4 of 20

4099MEE Planning Report - Low-cost USB MIDI Controller

7-9.

Paul Harvey

Items:

Add all input circuitry to breadboard circuit

Create a FT8U245 PCB test jig (to adapt QFP IC for breadboard use)

Develop & test input scanning firmware routines

Resources required:

Test jigs for: 64 LEDs, 64 buttons, 16x2 LCD (provided by Paul Harvey)

2x FT8U245 USB FIFO ICs; supplied by Gigatechnologies, Gold Coast.


See http://www.gigatechnology.com/chipprod.html. Cost: $10 AUD.

Misc. components, incl. USB type 'B' socket

University's PCB fabrication services for FT8U245 test jig

University's copy of Protel PCB CAD software

Workbench space; Software: VMWare Workstation 4 (provided by Paul


Harvey) USB driver development

Finalize hardware/schematics INCLUDING choosing one model of HC12

Design PCB

Have PCB fabricated

10-11. Items:

Resources required:

University's PCB fabrication services (est. $70) OR

BEC Manufacturing Brisbane (http://www.becman.com) offers new jobs,


bare/double sided, 10x16 panels for $202 AUD ex GST.

University's copy of Protel PCB CAD software

12-13. Firmware/driver milestone: MIDI over USB functional


Correct MIDI messages via USB in response to test input

Resources required:
14-15. Items:

Workbench space

Assemble, debug, test.

Prepare prototype for verification

Demonstrate working; verification of project minimum deliverables

Resources required:

Workbench space incl. CRO

Technical supervisor and Dejan Petrovic for demonstration purposes

Modified: 20. Feb. 2004

Version: 0.3

Page 5 of 20

4099MEE Planning Report - Low-cost USB MIDI Controller

Paul Harvey

4. Initial Cost Estimate

Components - Although the MCU selected so far is priced at ~ $10 ex GST, Arrow
electronics has a minimum order of $100 + shipping. An alternate supplier or a coordinated purchase with others at the University may be required.

In total, judging from the PICmicro based original prototype, total component costs
excluding MCU/USB FIFO may approach $100 (See Appendix D: Early PICmicro
prototype component list). For a full test input panel to be created, the cost will be more.

Total: $200 approx.

PCB - There are two SMT ICs to be loaded onto the final PCB. This may not possible
with the University's PCB workshop. In this case, at least $224 should be allocated for
manufacturing at BEC.

An SMT soldering/rework station may be necessary to install the SMT ICs.

Total: $300 approx.

Labour (in-kind) - Project manager (Paul Harvey) $15/hr x 50hrs/wk x 12 wks = $9000

Technical Supervisor (Dr. David Rowlands) $120/hr x 0.5hrs/wk * 12wks = $720

Academic Supervisor (Dr. Yongsheng Gao) $120/hr x 0.5hrs/wk * 12wks = $720

Total: $10440 approx.


Total costs of creating the prototype should be within the $900 offered by the University for
this IAP2 incubator project. Any costs exceeding this amount will either result in renegotiation of the project plan or be covered by the project manager (Paul Harvey).

5. Assessment of Potential Benefits

Direct cost savings due to donation of labour (>$10,000)

Cost savings via usage of University laboratories (free use of $1k's worth of test equip.)

Prototype savings via University resources including academic licensed CAD software
(Protel 2004 is >$10,000 RRP) and will provide solid starting point for production version

6. Risk Assessment and Ethical Considerations


Issues affecting project completion:

Drivers - The 2.6 Kernel may have an unforeseen problem due to it being a newly released
kernel; emulation of existing controllers may not be feasible, taking more work

USB - The FT8U245 may have some limitation preventing it working MIDI over USB

PCB Delays in fabbing. the PCB may occur; it may be defective or designed with errors

MIDI over USB implementation may have latency issues making MIDI OUT inadequate

Ordering cheapest MCU that meets requirements exactly could take longer than expected

The MCU ordered has some difference that causes it to behave differently with same code

Modified: 20. Feb. 2004

Version: 0.3

Page 6 of 20

4099MEE Planning Report - Low-cost USB MIDI Controller

Paul Harvey

Ethical risks risks to society and/or the company

This is a consumer device that is to be powered with an external 3rd party PSU; there is
little chance this device could physically harm a human being

Could cause expense to Analogik if a production had to be recalled due to a design flaw

Patent and Intellectual Property issues

A device advertised to be USB/MIDI compatible must undergo USB consortium and MIDI
Manufacturers Association registration, which must pass expensive Logo testing.

It is believed that apart from USB and MIDI, the technologies used in the prototype are
royalty-free. However without doing a patent search it is difficult to be 100% certain.

7. Control Procedures
Changes to the final deliverables and/or the approach to achieve them will be documented in
this report. Whilst a version number and a date will identify which version of the planning
report a certain copy may be, all changes will be recorded in Appendix Z Changelog.
Each change must be approved by all parties mentioned in the introduction of this report. If a
major schedule slippage has occurred, and the final delivery deadline will be missed, the
action mentioned under Failsafe Notice in Section 8, Technical Specifications may be used.

8. Technical Specifications
Connections
1. Standard MIDI 1.0 IN/OUT/THRU ports
- Mechanical: 5 pin DIN sockets
- Electrical: 5mA opto-isolated current loop, 31250 bits per second as specified by MIDI
1.0. Voltage (non-cable) side of the opto-coupler should have test points on the PCB.
2. USB 1.1 port, as provided by FTDI 245 USB FIFO IC
- Mechanical: USB type 'B' socket (peripheral device socket)
- Electrical: NRZI, 3.3V differential 1.5Mbps as specified by USB 1.1 Low-Speed
specification and supported by the FTDI FT8U245 USB-FIFO IC. Testpoints for D- and
D+ should be provided on the PCB.
3. Power input 9V DC
4. TTL debug I/O port header (a TTL <-> RS232 adapter would be used to connect a PC)
User-input/output See Appendix F2 for test jig setup details
1. 64 digital push-buttons (8x8 scanned matrix, debounce in firmware) and 64 LEDs
Of those 64, four will be reserved for LCD menu navigation buttons: left, right, enter, esc.
A further 16 will be reserved for patch changes (input association maps). The rest will be
assignable MIDI triggers.
2. 48 potentiometers configured as voltage dividers (linear; can be either knobs or sliders.
MIDI 1.0 allows for coarse controllers to have 127 levels, fine to have 16,384 levels)
Modified: 20. Feb. 2004

Version: 0.3

Page 7 of 20

4099MEE Planning Report - Low-cost USB MIDI Controller

Paul Harvey

3. Table 2: Input Assignments (over page)


Of the 48 knobs/sliders, the following
standard controller types will appear:

Of the 64 trigger buttons, the following


standard triggers will appear:

0 Bank Select (coarse)

64
65
66
67
68
69
80
81
82
83
120
121
122
123
124
125

1
2
4
5
6
7
8
10
11
12
13
16
17
18
19
32
33
34
36
37
38
39
40
42
43
44
45

Modulation Wheel (coarse)


Breath controller (coarse)
Foot Pedal (coarse)
Portamento Time (coarse)
Data Entry (coarse)
Volume (coarse)
Balance (coarse)
Pan position (coarse)
Expression (coarse)
Effect Control 1 (coarse)
Effect Control 2 (coarse)
General Purpose Slider 1
General Purpose Slider 2
General Purpose Slider 3
General Purpose Slider 4
Bank Select (fine)
Modulation Wheel (fine)
Breath controller (fine)
Foot Pedal (fine)
Portamento Time (fine)
Data Entry (fine)
Volume (fine)
Balance (fine)
Pan position (fine)
Expression (fine)
Effect Control 1 (fine)
Effect Control 2 (fine)

Hold Pedal (on/off)


Portamento (on/off)
Sustenuto Pedal (on/off)
Soft Pedal (on/off)
Legato Pedal (on/off)
Hold 2 Pedal (on/off)
General Purpose Button 1
General Purpose Button 2
General Purpose Button 3
General Purpose Button 4
All Sound Off
All Controllers Off
Local Keyboard (on/off)
All Notes Off
Omni Mode Off
Omni Mode On

(on/off)
(on/off)
(on/off)
(on/off)

4. 16x2 character alpha-numeric LCD (as provided by HD44780 compatible LCD), to display
MIDI channel the controller is on at startup, and the ID + value of the last moved control.
Figure 2: A concept 3D drawing of a MIDI controller

Illustration 1 (C) 2002 Dejan Petrovic


Approx. dimensions of theoretical production unit: 400mm x 250mm

The final arrangement of these inputs is subject to change, since enclosure design (probably at
least dust proof) and other production issues have not been considered. However, it is trivial
to change input assignments; the controller ID is merely modified in the firmware code.
Additionally, the MIDI software package can assign any arbitrary MIDI input to any arbitrary
action in the program.

Modified: 20. Feb. 2004

Version: 0.3

Page 8 of 20

4099MEE Planning Report - Low-cost USB MIDI Controller

Paul Harvey

Firmware
1. Scan all controller input and generate correct MIDI messages on the MIDI OUT port and
IN USB endpoint in response to changing input
2. Set the state of each LED as necessary either by responding to MIDI IN or OUT USB
endpoint messages, or the toggle state of an associated digital push-button
3. Respond correctly to MIDI IN messages or OUT USB endpoint. That is, forward messages
on to the MIDI OUT port if necessary, respond to MMC codes, reset requests, and so on.
4. Provide a facility utilizing the LCD and some of the digital push-buttons to implement a
menu system to configure the unit's MIDI channel number, edit a controller mapping and
loading controller mappings.
5. Control and maintain the USB FIFO IC
6. Control and maintain the LCD
Linux kernel driver
1. Allow a user-land application to receive MIDI messages given an appropriate /
dev/midiXX node which would be registered with the driver
2. Allow the user-land application to send MIDI messages to the MIDI controller, such as
program changes, sync and timing information

8.1 Minimum outcomes


1. Each potentiometer input reflects a full-scale linear response in the MIDI output it
produces. Further, each potentiometer input produces output for a unique MIDI control.
2. Each digital push-button causes either a unique MIDI trigger or patch change response
3. Each LED either reflects the toggle-state of a MIDI trigger associated with a button or
identifies which patch is selected
4. The LCD displays the current MIDI channel the unit is on during power-on, and the hex ID
and value of the last moved controller input is shown, showing that the LCD is functional.
5. All of the above functions when a PC is connected via the legacy MIDI 1.0 ports,
demonstrating MIDI firmware functionality

8.2 Additional outcomes


1. All of that described in 8.1 above functions when a PC is connected via USB,
demonstrating USB circuitry and driver functionality.
2. Failsafe notice: If the project is two weeks or more behind at around week 8, USB
firmware/driver development should stop and work should concentrate on getting the PCB
design completed on schedule. Even then, there is possibility that an untested USB
implementation may still work after the PCB has been fabricated and assembled.

Modified: 20. Feb. 2004

Version: 0.3

Page 9 of 20

4099MEE Planning Report - Low-cost USB MIDI Controller

Paul Harvey

9. Quality Schedule
This project will be considered successful for the purposes of the purposes of IAP2 if:
1. A working prototype is developed, and approved as per 8.1 Minimum outcomes.
2. The prototype is completed by the required date, and
3. The prototype is useful as a starting point for further commercial development.
Generic useful development practices will include logging changes made to each project file;
storing each version as they are modified; and updating this project plan as new problems and
circumstances arise. Specific best-practice engineering methods include, for C coding running code past a code checker (such as lclint); for PCB design, setting each design rule
possible to known fabrication parameters and have the CAD package check the design; for
code performance, an ELF binary profiling tool has already been created (bytewise.pl) that
shows a function-by-function, file-by-file breakdown of code space usage in a C project.
Further with PCB design, general prototype design practices will be used to ensure maximum
correctability of the first PCB. Jumper blocks or solder pads can be used to isolate certain
circuits easily. Test points can be created on critical I/O lines and other signals such as the
MCU CLK pulse. If at all possible, signal lines traveling exclusively in the top layer will
avoid the underside of DIP ICs. Also, as a matter of component flexibility, component
footprints that cater for more than one pin-out profile should be used (eg. capacitors,
switches, sockets).
Verification and Validation Plan
All five milestones in the project plan can be independently verified. For a complete test plan,
see Appendix F. An outline is listed below:
Wk

Milestone

3.

Implement firmware on a real HC9S12DP256 evaluation board

4.

Firmware milestone: LCD, MIDI 1.0 IN and OUT ports functional

8.

Show debug output in response to test input such as slider movement


Show MIDI software on PC-side:

Respond linearly with full range on each of the potentiometer inputs

Respond to digital triggers with each of the buttons

Show breadboard-prototype respond to MIDI events from PC-side software or


patch changes/trigger button toggle states with LEDs

Show CRO waveform indicative of correct bit rate and 5mA current specification

Show LCD displays controller ID and value of last potentiometer to have moved

Firmware/driver milestone: MIDI over USB functional

Show the same points verified in wk. 4 using USB-over-MIDI ONLY

Show CRO waveform indicative of USB MIDI OUT messages present on

Modified: 20. Feb. 2004

Version: 0.3

Page 10 of 20

4099MEE Planning Report - Low-cost USB MIDI Controller

Paul Harvey

breadboard-prototype's legacy MIDI 1.0 port


10.

Have PCB fabricated

12.

Demonstrate working; verification of project minimum deliverables

Show the same points verified in Wk. 4 & Wk. 8 for final prototype PCA

Confirm all points outlined in Section 8.1 satisfied

At each validation point, the supervisor may operate the controls and/or observe the PC-side
software, LCD, and LED activity for themselves. However, it is expected that the bulk,
exhaustive testing of each input will be performed by the project manager/student. Each
milestone is to be demonstrated to the technical supervisor, except for the week 12 (final)
demonstration which may also be demonstrated to Dejan Petrovic.

10. Wider Engineering Issues


Marketing
Analogik believes that as part of the marketing push, the sourcecode to the firmware and
drivers could be released to the public under the GNU GPL. Such licensing may provide free
additional publicity, and also guaranteed opportunity for updates if Analogik drop support.
Copyright will still always reside with the author (Paul Harvey) unless specifically transferred
in writing. However, there is a risk that a competitor will pick up the firmware and use it in
their own directly competing product (legally, of course with restrictions). By the same
token, any improvements made to the codebase must be made accessible and hence could be
reclaimed back into the code distributed with the Analogik product.
Design for manufacturability
Unfortunately with a consumer device such as this project, a great deal of effort must go into
sourcing of proper components (of suitable quality, cost and ease of assembly). This may
affect the interfacing circuitry in the final electronic design and the enclosure setup. Also,
enclosure design and custom plastics for the various controls may be necessary. Development
and tooling for these activities is extremely costly, far more so than the electronic design
aspects. In other words, PCB layout would probably be in the final stages of a production
version's development cycle.
Product support
Although not directly an ethical issue, many consumers become emotional when they receive
less than satisfactory support for their product after purchase. Warranty and general support is
perhaps a large hidden cost in any device when the Recommended Retail Price (RRP) is
being calculated.

11. Learning Contract - Skills expected to be gained during this project:

USB internals, driver development, MIDI internals, PCB design with SMT components

Advanced C coding with the HC12 MCU, Linux Kernel internals

Ability to judge complexity and work involved in a given engineering task

Modified: 20. Feb. 2004

Version: 0.3

Page 11 of 20

4099MEE Planning Report - Low-cost USB MIDI Controller

Paul Harvey

Appendix A: MIDI technology summary


MIDI controllers often connect to a PC or other MIDI devices via MIDI 1.0 ports. Many
MIDI controllers offer USB connectivity to a PC, since USB is cheaper than MIDI cables,
plugs and adapters.
Inputs from the various controls on the device are sent to a computer software package
running on a PC for interpretation using the MIDI protocol. Although there is a set of
standard MIDI control/message types declared by the General MIDI specification that the
device can assign to each input, most software allows arbitrary mapping of any MIDI input to
any function the user desires. Such mappings may control stereo panning, volume, tempo,
pitch, reverb, echo, or any other effect for any number of tracks running simultaneously. As
for triggers and note keys, possible functions include: normal notes, MIDI Machine Control
commands (such as stop, play, pause), program changes, and patch changes. A MIDI
controller may even be used to control non-musical devices, such as stage lighting and smoke
machines. For most users, controlling all these parameters entirely with a standard keyboard
and mouse can become tedious, hence the MIDI controller.
MIDI is a real-time serial protocol used to communicate music in an instructional form, IE.
parameters and attributes of notes, programs, tracks, and higher-level musical control. MIDI
1.0 does not carry any samples or actual raw sound for any of the notes; rather, MIDI can be
thought of as electronic sheet music. Final rendering of a MIDI stream depends entirely on
the MIDI interpreter and configuration of the wavetable synthesiser used to play it.
The MIDI 1.0 Specification, set by the MIDI Manufacturers Association
(http://www.midi.org), is a complete standard that includes electrical, mechanical, cabling,
timing, protocol, and implementation specifications. The PD-02 aims to provide compatibility
with legacy MIDI 1.0 IN/OUT/THRU ports (5 pin DIN sockets, 5mA current loop) and also
follow the MIDI-MA recommendations on MIDI-over-USB.

Modified: 20. Feb. 2004

Version: 0.3

Page 12 of 20

4099MEE Planning Report - Low-cost USB MIDI Controller

Paul Harvey

Appendix A2: Current MIDI controller market summary


Figure 4: A competitor's product similar to the Analogik MIDI controller concept

Source: Sound & Music, Melbourne; http://www.sound-music.com/images/evolution/evolution_uc33_1.gif

Most MIDI controllers are designed around a keyboard of two to seven octaves, with various
knobs and sliders, pitch wheels and other input devices scattered around the outside. Often,
musicians feel that they don't have enough control. Keyboards with more than 16
knob/slider inputs are generally full sized and quite expensive. Analogik believes there is a
market for a controller that is focused on just the input controls, leaving the consumer to stick
with their existing, cheaper MIDI keyboard.
There are a number of existing products available, some coming from well established names
such as Korg, Roland, and Yamaha. Of these, the product closest resembling the aim of this
IAP2 project is the Korg Microkontrol, which has an RRP of 275 GBP (~$660 AUD)ii. It has
8 knobs, 8 sliders, 16 trigger pads, joystick and a 37 note mini keyboard. Also available is the
US-428 from Tascam, with 2x 24bit audio in/out channels, no keyboard, 18 knobs/sliders,
various buttons and a jog wheel - pricediii at 449 GBP RRP (~$1070 AUD)iv

Appendix A3: Reasons for dropping early PICmicro based prototype


The result of this research activity can be seen in an incomplete prototype Printed Circuit
Assembly (PCA). Although electrically sound (the MCUs and USB-FIFO are functional and
interfaced correctly), the MCU selected was not suitable for the application. The PICmicro
16F series MCUs selected were very tedious to program in their native RISC assembly
language, and there was no cheaply available C compiler. Therefore, a completely new design
with lower IC count and more developer friendly MCU supported by a freely available C
compiler is required.

Modified: 20. Feb. 2004

Version: 0.3

Page 13 of 20

4099MEE Planning Report - Low-cost USB MIDI Controller

Paul Harvey

Appendix B: Current design decisions


Hardware - MCU: HC9S12A64CFU

Subject to change (quantity of I/O lines, amount of EEPROM)

64KiB FLASH, 1KiB EEPROM, 4KiB SRAM

25MHz CLK max., 8x A/D channels, 80 pin QFP IC package

Supports I2C, SPI, SCI serial interfaces; 59 total I/O pins

$9.80 USD ($12.30 AUD) from Arrow electronics

Already in possession of two HC9S12DP256 evaluation boards for development

Hardware - USB FIFO/UART IC: FTDI FT8U245AM

28 pin QFP IC package

A Linux driver exists for FT8U232; rights to royalty-free windows driver with each IC

$10 AUD from gigatechnology.com (located at Gold Coast)

All USB enumeration, endpoint setup and other USB tasks are performed internally

Although the target market will be a mostly Windows XP userbase with some MacOS X,
commercial grade consumer driver software is beyond the scope of this project. The easiest
and most accessible platform to develop with is Linux. It does not take very long for one to
navigate the Linux kernel source and see that, at first glance, there appears to be just three
source files associated with interfacing MIDI over USB (See Table 1).
By studying this part of the kernel source, it can be seen that device-specific information
relating to existing products on the market are mostly in usb-midi.h, with the exception of a
few products that have extra features and/or quirks that need work-arounds. It should be
possible to build a USB MIDI device with minimal modification to these modules; in fact, by
studying the source closely, it may be possible to emulate an existing device so that no
changes are necessary.
Table 1: Linux Kernel 2.6 usb-midi driver related files
File

Comment

drivers/usb/class/usb-midi.c This code actually understands MIDI; it appears to be the


equivilent of a sound card's MPU401 emulation. That is,
responsible for open/close/ioctl of the /dev/midiXX device
nodes.
drivers/usb/class/usb-midi.h Device-specific magic (like USB-IF Vendor/Product IDs)
go here
sound/usb/usbmidi.c

Modified: 20. Feb. 2004

Handles passing MIDI between ALSA/user-land & USB


frames

Version: 0.3

Page 14 of 20

4099MEE Planning Report - Low-cost USB MIDI Controller

Paul Harvey

Appendix C: Project Gantt chart

Modified: 20. Feb. 2004

Version: 0.3

Page 15 of 20

Modified: 20. Feb. 2004

Version: 0.3
50 pins
(25 pins Rqrd.)
2x 50 pins (2x 82 pins Rqrd.)
32 holes
DIL8
DIL14
DIL16
DIL18
DIL20
DIL40
TO-220

1x PCB Header pins


2x PCB Header pins

1x PCB Pin Header Socket


IC Socket
IC Socket
IC Socket
IC Socket
IC Socket
IC Socket

Heatsink

Slider pot

For Analogue sample


For Analogue sample
For Analogue sample
For ICSP
For ICSP

For +5v reg.

For MCU

For LCD (14 Reqrd.)


For Optocoupler

Linear 10k For Analogue sample

OTHER STUFF
IDC plug, 50 way
2x25
IDC socket, 50 way, PCB
2x25
IDC cable, 50 way
1m
Locking header plug, 8 way
IDC cable, 16 way
2m

2.5mm
5 pin MIDI
5 pin MIDI

DC Power jack
DIN Socket
DIN Plug

Supplier
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar

PI-6470
PI-6500
PI-6501
PI-6502
PI-6503
PI-6504
PI-6508

Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar

HM-3250 Jaycar
HM-3250 Jaycar

PS-0520 Jaycar
PS-0350 Jaycar
PP-0304 Jaycar

Jaycar
Jaycar

ZS-5000 Jaycar
Jaycar
ZS-5004 Jaycar
ZS-5008 Jaycar
ZS-5020 Jaycar
ZS-5032 Jaycar
ZS-5074 Jaycar
ZS-5123 Jaycar
ZS-5139 Jaycar
ZS-5245 Jaycar
Jaycar
ZS-5273 Jaycar
Jaycar
ZK-8855 Jaycar
ZC-4051 Jaycar
ZK-8862 Jaycar
ZV-1505 Jaycar

Cat. No.
RC-5326
RC-5314
RC-5336
RC-5490
RE-6032
RC-5490
RE-6066
RE-6220
ZR-1004
ZR-1100
ZR-1014
ZR-1450
ZR-1405
SF-2160
ZD-1940
ZD-1740
RR-0554
RR-0556
RR-0558
RR-0588
RR-0596
RR-0620
RT-4304
RT-4310
RT-4312
RT-4318

RP-3920 Jaycar
Jaycar

HH-8520 Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Jaycar
Inline cable PS-0990 Jaycar
Vertical PCB PP-1116 Jaycar
WM-4508 Jaycar
HM-3408 Jaycar
WM-4502 Jaycar

25.4mm grid

PCB Mount
PCB Mount
Inline

DIL40
HC49U

15pF - 30pF CL

20Mhz
20Mhz

Horizontal
Horizontal
Horizontal
Horizontal

Package
Ceramic Disc
Ceramic Disc
Ceramic Disc
Ceramic Disc
Radial
Radial
Radial
Radial
Axial
Axial
Axial (Large)
Axial (Large)
Axial
5 x 20mm
DIL8

MCU: PIC16F874/P
Parallel resonance XTAL

(500R)

Panel LEDs

! - Pack of 8

(1N5352 - !TVS)
(1N4735)

IC Decoupling
VR2
Power Supply

XTAL
Multivibrator

Notes

DIL14
DIL14
DIL14
DIL14
DIL14
DIL14
DIL14
DIL16
DIL16
DIL20
DIL16
DIL20
DIL20
DIL18
DIL16
DIL20
TO-220

Value
150pF
15pF
1nF
0.1uF
1uF
1uF
10uF
1000uF
1N4004
1N4148
1N5404
P6KE16CA
BZX85C6V2
2A
6N138
3mm
180R
220R
270R
4.7k
10k
100k
100R
5k
10k
100k

IC: 4x2 in. NAND


74LS00N
IC: Hex Inverter
74HCT04N
IC: Hex Inverter
74LS04N
IC: 4x2 in. AND
74LS08N
IC: 2x4 in. NAND
74LS20N
IC: 4x2 in. OR
74LS32N
4 bit D-Latch
74LS74N
IC: 2x one-shot multivibrator74LS123
IC: 2x 1-4 DEMUX
74LS139N
IC: 8x Bus driver
74LS245N
IC: 8 bit addressable latch 74LS259N
IC: 8x D-Latch
74LS373N
IC: 20 key encoder
74C923N
IC: 8x driver
ULN2803A LED Driver
IC: Analog MUX
74HC4051N
IC: A-D Converter
ADC0801
ADC0804
IC: +5v Voltage Regulator LM7805CT L78S05CV (2A)

Item
Capacitor
Capacitor
Capacitor
Capacitor
Capacitor
Capacitor
Capacitor
Capacitor
Diode
Diode
Diode
Diode
Diode
Fuse
Optocoupler
LED
Resistor
Resistor
Resistor
Resistor
Resistor
Resistor
Variable resistor
Variable resistor
Variable resistor
Variable resistor

$0.75
$3.15
$1.10
$8.50
$1.05

$0.90
$3.50
$1.30
$9.95
$1.20

$2.35

$2.55
$2.20
$5.60
$0.95
$2.00

$1.50

$2.80
$0.25
$0.28
$0.34
$0.35
$0.45
$0.70

$1.80
$1.80

$1.60

$2.15
$1.95
$5.60
$0.85
$2.00

$1.95

$2.45
$0.22
$0.25
$0.30
$0.30
$0.40
$0.60

$1.60
$1.60

$0.90
$1.50
$0.70

$0.50
$0.50
$0.60
$0.60
$0.75
$1.30
$0.80
$0.70

$0.60
$0.60
$0.70
$0.70
$0.90
$1.50
$0.95
$0.85

$1.00
$1.70
$0.78

$0.50

$0.60

$1.60

$2.15
$1.95
$5.60
$0.85
$2.00

$1.95

$2.15
$0.20
$0.22
$0.25
$0.25
$0.35
$0.55

$1.60
$1.60

$0.90
$1.50
$0.70

$2.45
$0.75
$6.50
$0.80

$0.50

$0.35
$0.35
$0.40
$0.40
$0.50
$0.90
$0.55
$0.50

$0.35

$1.40

$1.95
$1.75
$5.60
$0.75
$2.00

$1.95

$2.15
$0.20
$0.22
$0.25
$0.25
$0.35
$0.55

$1.60
$1.60

$0.80
$1.35
$0.60

$2.45
$0.75
$6.50
$0.80

$0.50

$0.35
$0.35
$0.40
$0.40
$0.50
$0.90
$0.55
$0.50

$0.35

48

2
2
1
1
1

1
1
10
17
8
1
1

1
2

1
1
1

8
7
1
2

2
1
3
1
1
1
1
7

Cost ea. < 10 Cost ea. < 25 Cost ea. > 25 Cost ea. > 100 Qty. per unit
$0.28
$0.28
$0.19
$0.16
1
$0.28
$0.28
$0.19
$0.16
2
$0.28
$0.28
$0.19
$0.16
1
$0.20
$0.20
$0.14
$0.12
1
$0.25
$0.25
$0.17
$0.15
5
$0.20
$0.20
$0.14
$0.12
51
$0.20
$0.20
$0.14
$0.12
1
$0.70
$0.70
$0.45
$0.40
3
$0.36
$0.30
$0.25
$0.25
1
$0.32
$0.24
$0.17
$0.17
12
$0.25
$0.18
$0.13
$0.13
1
$1.60
$1.40
$1.40
$1.10
1
$0.40
$0.35
$0.25
$0.25
2
$0.35
$0.30
$0.25
$0.25
1
$4.25
$3.75
$2.90
$2.90
1
$0.25
$0.22
$0.17
$0.17
3
$0.38
$0.25
$0.22
$0.22
2
$0.38
$0.25
$0.22
$0.22
5
$0.38
$0.25
$0.22
$0.22
63
$0.38
$0.25
$0.22
$0.22
2
$0.38
$0.25
$0.22
$0.22
6
$0.38
$0.25
$0.22
$0.22
10
$0.32
$0.32
$0.22
$0.19
1
$0.32
$0.32
$0.22
$0.19
1
$0.32
$0.32
$0.22
$0.19
1
$0.32
$0.32
$0.22
$0.19
1

1
1
1
1
1

1
1
6
9
0
9
1

1
2

1
1
1

0
7
1
2

2
1
1
0
0
0
1
7

48

2
2
1
1
1

Proto:

1
1
1
0
0
2
1

1
1

Qty. per proto Qty. per prod


1
2
0
0
3
30
1
3
1
1
1
1
2
1
1
3
2
5
0
2
4
0
1
1
1
1

$9.40
$22.70

$2.55
$2.20
$5.60
$0.95
$2.00

$1.50
$22.92
$80.06

$2.80
$0.25
$1.68
$3.06
$0.00
$4.05
$0.70

$1.80
$3.60

$1.00
$1.70
$0.78

Subtotal (proto)
$0.28
$0.56
$0.00
$0.00
$0.75
$6.00
$0.20
$2.10
$0.36
$0.32
$0.25
$1.60
$0.80
$0.35
$4.25
$0.75
$0.76
$1.90
$0.00
$0.76
$1.52
$0.00
$0.32
$0.32
$0.32
$0.32
$24.79
$0.60
$0.00
$1.20
$0.60
$0.70
$0.00
$0.00
$0.00
$0.95
$5.95
$0.00
$0.90
$0.00
$0.00
$9.10
$9.95
$2.40
$32.35
$0.00
$0.00

4099MEE Planning Report - Low-cost USB MIDI Controller


Paul Harvey

Appendix D: Early Original prototype partial Bill Of Materials

Page 16 of 20

4099MEE Planning Report - Low-cost USB MIDI Controller

Paul Harvey

Appendix F: USB MIDI Controller Test Plan


USB MIDI controller Test Plan
Modified: 20/02/2004

Version: 0.1

Week milestone
3 EVB Firmware implementation

Test item
Pass?
Debug output response to:
Potentiometers
Digital triggers
Contrast OK
INIT OK
Backlight OK
Display pot. input ID+val. on
last moved
5mA current loop present on
cable
Bit rate @ 31250 bps
5mA current loop in cable vs
MCU input (voltage-side) of
opto-coupler are correct
All pots. create appropriate
response on PC-side software
All buttons create appropriate
response on PC-side software
or controller LEDs
All LEDs respond correctly to
PC-side software MIDI
messages and/or controller
buttons
PC-side MIDI test software
responds correctly to all Pots.
and buttons.
Controller responds correctly to
MIDI messages generated by
PC-side test software
3.3V differential NRZI encoding
Bit rate @ 1.5Mbps
PC-side MIDI test software
responds correctly to all Pots.
and buttons.
Controller responds correctly to
MIDI messages generated by
PC-side test software

4 LCD

4 MIDI 1.0 OUT port CRO waveform


4 MIDI 1.0 IN port CRO waveform
4 Input reading firmware/circuitry

4 LEDs firmware/circuitry

4 MIDI 1.0 IN port firmware MIDI


protocol functionality
4 MIDI 1.0 OUT port firmware MIDI
protocol functionality
8 USB port CRO waveform
8 USB-MIDI firmware MIDI protocol
functionality
8 USB-MIDI firmware MIDI protocol
functionality
8 USB-MIDI to Legacy MIDI 1.0 port
functionality

Appropriate waveform present


on MIDI 1.0 OUT port when
receiving messages over USB.
May use loop test using legacy
gameport on PC
10 PCB fabricated
Visual inspection
12 Final Prototype test
Smoke test
12 LCD
Contrast OK
INIT OK
Backlight OK
Display pot. input ID+val. on
last moved
12 MIDI 1.0 OUT port CRO waveform 5mA current loop present on
cable
Bit rate @ 31250 bps
12 MIDI 1.0 IN port CRO waveform
5mA current loop in cable vs
MCU input (voltage-side) of
opto-coupler are correct
12 Input reading firmware/circuitry
All pots. create appropriate
response on PC-side software
All buttons create appropriate
response on PC-side software
or controller LEDs
12 LEDs firmware/circuitry
All LEDs respond correctly to
PC-side software MIDI
messages and/or controller
buttons
12 MIDI 1.0 IN port firmware MIDI
PC-side MIDI test software
protocol functionality
responds correctly to all Pots.
and buttons.
12 MIDI 1.0 OUT port firmware MIDI Controller responds correctly to
protocol functionality
MIDI messages generated by
PC-side test software
12 USB port CRO waveform
3.3V differential NRZI encoding
Bit rate @ 1.5Mbps
12 USB-MIDI firmware MIDI protocol PC-side MIDI test software
functionality
responds correctly to all Pots.
and buttons.
12 USB-MIDI firmware MIDI protocol Controller responds correctly to
functionality
MIDI messages generated by
PC-side test software
12 USB-MIDI to Legacy MIDI 1.0 port Appropriate waveform present
functionality
on MIDI 1.0 OUT port when
receiving messages over USB.
May use loop test using legacy
gameport on PC

Modified: 20. Feb. 2004

Version: 0.3

Page 17 of 20

4099MEE Planning Report - Low-cost USB MIDI Controller

Paul Harvey

Appendix F2: MIDI Controller Test Jig setup


USB CRO waveform
test point: diff(D-,D+)

PC USB Host
controller

USB

Potentiometer test jig

MIDI IN CRO waveform


testpoint is after opto-coupler,
that is, on the voltage (MCU)
side. Compare to cable-side.

Button matrix jig

MIDI
Controller
Prototype

MIDI IN

MIDI OUT
LED matrix jig

MIDI OUT CRO waveform


testpoints are before (MCU) and
after opto-coupler; test 5mA
current loop, correct bitrate

LCD test jig

CHANNEL 5
TEST TEST

Modified: 20. Feb. 2004

Version: 0.3

Page 18 of 20

4099MEE Planning Report - Low-cost USB MIDI Controller

Paul Harvey

Appendix Z: Changelog
0.1 0.2: (first signing) 20/02/2004

Improved clarity of conceptual schema diagram

Removed block diagram of system showing PC software layers (some of it merged with
Fig.1 )

Adjusted work schedule (had only allocated 12 weeks, now 14 are used)

Update Gantt chart

Fixed small typographical errors

Update specifications to include function of most input controllers

Changed USB functionality from Minimum Outcome to Additional Outcome

02 0.3 (submit to Dr. Yongsheng Gao) 20/02/2004

Insert gantt chart into document as one page in Appendix

Fixed ordering of project schedule to match Gantt chart

Modified: 20. Feb. 2004

Version: 0.3

Page 19 of 20

Sound & Music (Australia) Product Information for the UC33E, http://www.soundmusic.com/product_info.php?PID=158 [accessed 19/02/2004]
ii Sounds Live (Newcastle) Ltd. (UK) Korg Microkontrol, http://www.soundslive.co.uk/moreinfo.asp?ID=2672
[accessed 19/02/2004]
iii Promenade Music (UK) Tascam US-428, http://www.promenademusic.co.uk/catalogue/details.asp?pid=941
[accessed 19/02/2004]
iv Sounds Live (Newcastle) Ltd. (UK) Tascam US-428, http://www.soundslive.co.uk/moreinfo.asp?ID=1050 [accessed
19/02/2004]

You might also like