MIDI Problems

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

Post Reply
SebastianKulik
Posts: 1
Joined: Wed Feb 23, 2011 2:16 pm

MIDI Problems

Post by SebastianKulik »

Hi@all,
Im try to build a Midi controller using HP488&EB021-30 (Midiboard). PIC18F4620 imo.
Using original crystal- all works just perfect.
I try to use 12MHz crystal - change frequency at "Project Options", "Chip Expert Options" oscillator still "HS" (at XT -same thing)- sended midi data corrupt and my USB interface (imo MidiSport) input LED blinks, but midi-data totally wrong.

Can someone help?

Regards,
Sebastian

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: MIDI Problems

Post by Benj »

Hello Sebastian,

First of all you have the Use Extended CPU config bit enabled. This is known to cause problems so I would recommend that you disable this option.

Secondly there are a couple of defines that control the baud rate of the bit banged MIDI signal.

For a clock speed of 19660800Hz

//MIDI Bit and Half Bit Delays
#define MIDI_TX32_US 41
#define MIDI_RX16_US 20

And for a clock speed of 12000000Hz.

//MIDI Bit and Half Bit Delays
#define MIDI_TX32_US 20
#define MIDI_RX16_US 9

If you select the MIDI component on the panel then you can right click it and select custom code. Then select the GetDefines section and click Edit.

Once in here you can then change the values assigned to the baud rate to see if you can tweak it slightly to make it work more reliably.

//MIDI Bit and Half Bit Delays
#define MIDI_TX32_US %e
#define MIDI_RX16_US %f

Eg change to

//MIDI Bit and Half Bit Delays
#define MIDI_TX32_US 12
#define MIDI_RX16_US 5

As the signal is bit banged it is based on delays which are based on the crystal frequency. We have a calculation which generates the delay values but sometimes tweaking the values slightly allows for a more reliable connection.

If you have an oscilloscope then you can test the data. The baud rate should be as near to 31250 bits per second as you can get it.

Hope this helps.

Post Reply