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

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?

Postby rocket200 » Wed Feb 01, 2012 10:00 pm

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: 3111
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 89 times
Been thanked: 398 times
Contact:

Re: How do you connect to Midi?

Postby Steve » Thu Feb 02, 2012 10:27 am

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?

Postby rocket200 » Thu Feb 02, 2012 2:52 pm

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: 514 times
Been thanked: 467 times
Contact:

Re: How do you connect to Midi?

Postby dazz » Thu Feb 02, 2012 3:25 pm

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
These users thanked the author dazz for the post:
Steve (Thu Feb 02, 2012 3:55 pm)
Rating: 5%
 
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?

Postby rocket200 » Thu Feb 02, 2012 3:54 pm

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: 3111
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 89 times
Been thanked: 398 times
Contact:

Re: How do you connect to Midi?

Postby Steve » Thu Feb 02, 2012 3:58 pm

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?

Postby rocket200 » Thu Feb 02, 2012 4:26 pm

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: 14681
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4665 times
Been thanked: 4287 times
Contact:

Re: How do you connect to Midi?

Postby Benj » Thu Feb 02, 2012 6:31 pm

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?

Postby rocket200 » Thu Feb 02, 2012 8:18 pm

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: 514 times
Been thanked: 467 times
Contact:

Re: How do you connect to Midi?

Postby dazz » Thu Feb 02, 2012 8:25 pm

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?

Postby rocket200 » Thu Feb 02, 2012 8:50 pm

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 100 times

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

Re: How do you connect to Midi?

Postby dazz » Thu Feb 02, 2012 9:35 pm

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?

Postby rocket200 » Thu Feb 02, 2012 10:04 pm

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: 514 times
Been thanked: 467 times
Contact:

Re: How do you connect to Midi?

Postby dazz » Fri Feb 03, 2012 1:14 pm

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?

Postby rocket200 » Fri Feb 03, 2012 9:15 pm

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: 514 times
Been thanked: 467 times
Contact:

Re: How do you connect to Midi?

Postby dazz » Sat Feb 04, 2012 6:19 pm

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