Page 1 of 1

How do you connect to Midi?

Posted: Wed Feb 01, 2012 10:00 pm
by rocket200
Hello,

I am trying to output some simple midi notes using the flowcode basic midi output example. The problem is, I can't seem to find out how to connect the midi input cable to the AVR microcontroller. Which pins do I need to connect?

Re: How do you connect to Midi?

Posted: Thu Feb 02, 2012 10:27 am
by Steve
The MIDI IN and MIDI OUT pins can be selected via the component connections screen for the MIDI component in the Flowcode program. Find the MIDI component on the panel, right click it and select "connections".

Re: How do you connect to Midi?

Posted: Thu Feb 02, 2012 2:52 pm
by rocket200
Steve wrote:The MIDI IN and MIDI OUT pins can be selected via the component connections screen for the MIDI component in the Flowcode program. Find the MIDI component on the panel, right click it and select "connections".
Thank you for the reply! I know how to do that, what I was asking is, how do you physically connect the microcontroller to the midi device's 5-pin input? Is there any required circuitry?

Re: How do you connect to Midi?

Posted: Thu Feb 02, 2012 3:25 pm
by dazz
Hi
yes it will require additional circuitry as you need to interface the avr to the midi, ensuring neither get destroyed a quick search on google yielded this

http://www.avrfreaks.net/index.php?modu ... icle&id=19

i had a quick scan of it and it contains connection details

hth

Re: How do you connect to Midi?

Posted: Thu Feb 02, 2012 3:54 pm
by rocket200
dazz wrote:Hi
yes it will require additional circuitry as you need to interface the avr to the midi, ensuring neither get destroyed a quick search on google yielded this

http://www.avrfreaks.net/index.php?modu ... icle&id=19

i had a quick scan of it and it contains connection details

hth
Awesome thanks! I tried the circuit but the midi device doesn't seem to be receiving any midi information. Could this be because I'm using the internal RC oscillator in the microcontroller? Do I need a crystal oscillator for this to work?

Re: How do you connect to Midi?

Posted: Thu Feb 02, 2012 3:58 pm
by Steve
You will certainly need to make sure your timing is right to receive MIDI signals. But as long as you've set the oscillator correctly and can achieve the appropriate bitrate, you should be ok with an internal oscillator.

Re: How do you connect to Midi?

Posted: Thu Feb 02, 2012 4:26 pm
by rocket200
Steve wrote:You will certainly need to make sure your timing is right to receive MIDI signals. But as long as you've set the oscillator correctly and can achieve the appropriate bitrate, you should be ok with an internal oscillator.
So do you think the fact that I am using the RC oscillator is not the problem?

Re: How do you connect to Midi?

Posted: Thu Feb 02, 2012 6:31 pm
by Benj
RC oscillator should work if it is stable and you have defined the frequency correctly in Flowcode. eg so 1 second delays in Flowcode = 1 second on the hardware.

If 1 second delays do not match on the hardware then the MIDI baud rate will also be incorrect.

Re: How do you connect to Midi?

Posted: Thu Feb 02, 2012 8:18 pm
by rocket200
Benj wrote:RC oscillator should work if it is stable and you have defined the frequency correctly in Flowcode. eg so 1 second delays in Flowcode = 1 second on the hardware.

If 1 second delays do not match on the hardware then the MIDI baud rate will also be incorrect.
Oscillator seems correct, but the midi device still doesn't seem to be receiving anything.

Re: How do you connect to Midi?

Posted: Thu Feb 02, 2012 8:25 pm
by dazz
another thought, have you looked at the docs for the midi eblock on the main sight ,might help also can you post your code so others can see and maybe help and what micro are you using

Re: How do you connect to Midi?

Posted: Thu Feb 02, 2012 8:50 pm
by rocket200
dazz wrote:another thought, have you looked at the docs for the midi eblock on the main sight ,might help also can you post your code so others can see and maybe help and what micro are you using
I looked through the midi E-block datasheet. There is one difference that I spotted between my circuit and the E-block; my circuit doesn't have a buffer chip, but the E-block does. Is this what's causing it to not work?

Chip I am using:

Attiny2313(AVR)
Clock speed: 8mhz

I have attached the flowcode file that I have been using.
Thanks for the help!

Re: How do you connect to Midi?

Posted: Thu Feb 02, 2012 9:35 pm
by dazz
Hi
From memory the buffer is there stregnthen the output current so may have a bearing, also are the midi component pins in flowcode connected out =pd1 in =pd0
are the connections as follows (PD1is from the ATtiny2313 data sheet),

ATtiny2313 digital pin 3 PD1(TXD) connected to MIDI jack pin 5
MIDI jack pin 2 connected to ground
MIDI jack pin 4 connected to is there to protect the +5V through 220-ohm resistor ( Please double check i gave the correct pinout as im not responsible for wrong connections ,starting world war3 or diconnecting the country from the national grid ;) )

another thing is i dont usually use avr's i keep killing em, are the configs correct as i have ruined a few by writing the wrong config data
hope this helps

Re: How do you connect to Midi?

Posted: Thu Feb 02, 2012 10:04 pm
by rocket200
dazz wrote:Hi
From memory the buffer is there stregnthen the output current so may have a bearing, also are the midi component pins in flowcode connected out =pd1 in =pd0
are the connections as follows (PD1is from the ATtiny2313 data sheet),

ATtiny2313 digital pin 3 PD1(TXD) connected to MIDI jack pin 5
MIDI jack pin 2 connected to ground
MIDI jack pin 4 connected to is there to protect the +5V through 220-ohm resistor ( Please double check i gave the correct pinout as im not responsible for wrong connections ,starting world war3 or diconnecting the country from the national grid ;) )

another thing is i dont usually use avr's i keep killing em, are the configs correct as i have ruined a few by writing the wrong config data
hope this helps
Tried changing the connections to PD1(TXD), still not working.

Re: How do you connect to Midi?

Posted: Fri Feb 03, 2012 1:14 pm
by dazz
hi
I noticed that in your chart when you issue a sendmidi on, you send a sendmidi off, does increasing the delay to one second work as it seems that its constantly sending a note then canceling it

hth

Re: How do you connect to Midi?

Posted: Fri Feb 03, 2012 9:15 pm
by rocket200
So I figured out what the problem was. It was the flowcode MIDI component. There is something wrong with it that's causing it to not work properly. So, here is what I did to work around the problem; use three RS232 components, set the baud rate to 31250, and manually send out the three hex values(one per RS232 component). Example: RS232 number one: 0x90, RS232 number two: 0x1E, RS232 number three: 0x45.

Got the midi notes working with just the internal oscillator. Hope this helps anybody with the same problem.

Re: How do you connect to Midi?

Posted: Sat Feb 04, 2012 6:19 pm
by dazz
cool glad your up n running, but keep at the midi its probably a chip config setting or something