How do you connect to Midi?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
rocket200
Posts: 68
Joined: Mon Oct 24, 2011 7:50 pm
Has thanked: 11 times
Been thanked: 3 times
Contact:

How do you connect to Midi?

Post 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?

User avatar
Steve
Matrix Staff
Posts: 3418
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: How do you connect to Midi?

Post 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".

rocket200
Posts: 68
Joined: Mon Oct 24, 2011 7:50 pm
Has thanked: 11 times
Been thanked: 3 times
Contact:

Re: How do you connect to Midi?

Post 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?

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: How do you connect to Midi?

Post 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
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

rocket200
Posts: 68
Joined: Mon Oct 24, 2011 7:50 pm
Has thanked: 11 times
Been thanked: 3 times
Contact:

Re: How do you connect to Midi?

Post 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?

User avatar
Steve
Matrix Staff
Posts: 3418
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: How do you connect to Midi?

Post 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.

rocket200
Posts: 68
Joined: Mon Oct 24, 2011 7:50 pm
Has thanked: 11 times
Been thanked: 3 times
Contact:

Re: How do you connect to Midi?

Post 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?

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: How do you connect to Midi?

Post 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.

rocket200
Posts: 68
Joined: Mon Oct 24, 2011 7:50 pm
Has thanked: 11 times
Been thanked: 3 times
Contact:

Re: How do you connect to Midi?

Post 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.

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: How do you connect to Midi?

Post 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
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

rocket200
Posts: 68
Joined: Mon Oct 24, 2011 7:50 pm
Has thanked: 11 times
Been thanked: 3 times
Contact:

Re: How do you connect to Midi?

Post 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!
Attachments
2. MIDI Basic Output.fcf_avr
(4.5 KiB) Downloaded 256 times

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: How do you connect to Midi?

Post 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
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

rocket200
Posts: 68
Joined: Mon Oct 24, 2011 7:50 pm
Has thanked: 11 times
Been thanked: 3 times
Contact:

Re: How do you connect to Midi?

Post 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.

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: How do you connect to Midi?

Post 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
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

rocket200
Posts: 68
Joined: Mon Oct 24, 2011 7:50 pm
Has thanked: 11 times
Been thanked: 3 times
Contact:

Re: How do you connect to Midi?

Post 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.

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times
Contact:

Re: How do you connect to Midi?

Post by dazz »

cool glad your up n running, but keep at the midi its probably a chip config setting or something
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

Post Reply