Pages: [1]   Go Down
Author Topic: Argh! RX fail on 3 different DIYduinos (inc RBBB)!  (Read 1814 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 97
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!

Pulling my hair out on this one.

Using a Dueminlanove to read the output of a MIDI keyboard plugged into a simple MIDI in/out board (reading value at RX using Serial.available()/Serial.read() etc) and then displaying it on an LCD (controlled via SoftwareSerial).

The Duemilanove does as it should. I get 3 bytes in when I press a key and 3 bytes in when I release a key as one would expect given the MIDI protocol.

So I built my own Arduino clone. Seemed to be fine. Blink runs. I can write to the LCD and so on. But the same sketch and MIDI circuit as above fails. I get a single byte, "0" on note press and note release.

So I thought maybe my board is duff so I knock up a breadboard version. It blinks, writes to LCD. Fab! But again serial in, bogus numbers. Two "0"s sometimes now.

So I thought I'd test an established design online. Specifically the single-sided RBBB (http://www.instructables.com/id/Single-Sided-Really-Bare-Bones-Board-Arduino-in-EA/). Nice board! Very cute when built. Runs blink. Writes to LCD. I feel confident. Bah! No dice! Same "0" bytes read from RX.

What am I missing!!! Three different DIY boards all behaving the same but different from an official Arduino. There's got to be something about the Duemilanove that the other boards don't share that's effecting RX?

I guess the obvious thing is the presence of the FTDI/USB circuit (I'm programming my AVRs in the Duemilanove and then removing them and inserting them into my clone boards) but I'm not sue how this would effect things?

If it's simply that the DIY boards are temperamental then I don't get this as I thought the Arduino platform was meant to be highly robust?

Perhaps the DIY boards just can't handle the high baud rate of MIDI? (31250).

Hmm .. I should try dropping the baud rate and see if the numbers are consistent ...
Logged

LOS GATOS, CA, USA
Offline Offline
Full Member
***
Karma: 3
Posts: 180
The TinkerTech Blog and the MusheenShop
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Try tying grounds together. Multi power source serial garf is almost always caused by uncommon ground.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, just a hunch. Try wiring an external pull-up resistor of say 10k ohms between +5vdc and arduino pin 0. Try your sketch and see if it works. If it does, get back to me here and I'll explain maybe the cause. If it doesn't work just ignore me and maybe someone else will have a better idea.

Lefty
« Last Edit: January 11, 2011, 11:44:46 pm by retrolefty » Logged

SF Bay Area (USA)
Online Online
Tesla Member
***
Karma: 134
Posts: 6763
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The official duemilanove board has a 1k resistors between the FTDI chip and the AVR serial port pins that theoretically aid in sharing the serial port between the PC connection and other devices that you might connect to the pins.  The minimalist boards like the RBBB don't have these resistors, so the FTDI cable (if plugged in) will probably overpower any other device trying to talk to the RX pin.

Does it work if you disconnect the FTDI cable after you're done downloading the sketch?
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 97
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Boz wrote:
Quote
Try tying grounds together. Multi power source serial garf is almost always caused by uncommon ground.

I've set up a test rig using some breadboard where the supply and ground rails are fed from the Duemilanove. All +5V and all GND signals from my various bits and pieces (two alternate MIDI in/out boards, my RBBB Arduino and my breadboard Arduino) go here. Would this constitute common ground yeah? No dice it didn't help but I loved the idea it could have been that simple and will remember it for another time when hopefully it is that simple smiley

Retrolefty wrote:
Quote
Ok, just a hunch. Try wiring an external pull-up resistor of say 10k ohms between +5vdc and arduino pin 0. Try your sketch and see if it works.

Well the sketch always worked it just worked wrong! With your suggestion it seems to be a bit less broken. It more consistently (but not always) now receives three bytes on key press (as you'd expect given the MIDI protocol) and they are at least consistent.

Quote
If it doesn't work just ignore me

Ignore you?! I couldn't possibly be so rude smiley

westfew wrote:
Quote
Does it work if you disconnect the FTDI cable after you're done downloading the sketch?

No cable in use yet I'm just programming the AVR from the Duemilanove and removing it and inserting in the DIY Arduino's instead. But ...

Quote
The official duemilanove board has a 1k resistors between the FTDI chip and the AVR serial port pins that theoretically aid in sharing the serial port between the PC connection and other devices that you might connect to the pins.  The minimalist boards like the RBBB don't have these resistors

Ooh! Ooh! A tangible difference I'm excited ... let's try a 1K resistor between +5VDC and pin 0 rather than a 10K ...

... huzzah! It works. Brilliant.

I SERIOUSLY LOVE YOU GUYS (not in a touchy/kissy way I mean more fraternal yeah?)

So ... why does it work with a 1K resistor between pin 0 and +5VDC?!

Thanks again.
Jim
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I SERIOUSLY LOVE YOU GUYS (not in a touchy/kissy way I mean more fraternal yeah?)

We call it Arduino love, and it's pretty harmless. Just don't tell your spouse about us.  smiley-wink

Quote
So ... why does it work with a 1K resistor between pin 0 and +5VDC?!

I'm not up on midi electrical interfacing, but I suspect the 'senders' on the line are using open collector type outputs that require an external positive voltage through a resistor in which to turn on and off. Without it your arduino input pin is 'seeing' a 'floating input pin' condition and will act very flaky. Glad it worked out for you.


Lefty
« Last Edit: January 12, 2011, 01:31:39 pm by retrolefty » Logged

Pages: [1]   Go Up
Jump to: