The new Raspberry Pi B Model B+ is here - Pick one up in the store and check our detailed guide!

Strange Borduino Behavior

by at2marty on Thu Nov 03, 2011 6:16 pm

I couldn't think of another title to put on this thread.

I recently purchased and assembled a Borduino. I have been going through some tests, and found that there is an odd behavior... either that or I'm losing my mind.

I have the DC version and am using a FTDI FT232R cable to upload sketches to it (though I don't think that matters).

I uploaded the blink sketch, and rather than blink, the LED would stay lit constantly. I went ahead and added a few lines of code to output to the serial monitor to try debugging... and it started working! I figured that maybe I must have a poor solder joint somewhere, so I went back over the board to check my work.

I then kind of expanded on the Blink Sketch to test some more of the digital outputs, and again, the sketch seems to "hang" unless I add in "Serial.begin(9600);" to void setup ().

Now one thing that I do need to point out, and I'm not entirely sure if it's related. I'm using Linux, specifically Fedora 15 64 bit. I did have to modify a couple of files to fix a compile problem. It had to do with the AVR toolchain.

Specifically, this is what I did.

Opened up /usr/avr/include/util/delay.h and added "#include <math.h>" near the top.
Opened up /usr/share/arduino/hardware/arduino/cores/arduino/wiring.h and commented out line 79 which read "#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))".

The first "fix" involving the delay.h file is suspect to me. I got the information for that fix from here. I didn't copy any files over as suggested, and I haven't tested my sketch on a Windows computer yet. I'll do those things and report my results. Prior to copying any files over from the source that I downloaded, I'll do a compare and see where the differences are.

In the meantime, any other suggestions or pointers are certainly appreciated.
at2marty
 
Posts: 45
Joined: Sun Mar 27, 2011 12:15 pm

Re: Strange Borduino Behavior

by adafruit_support_bill on Fri Nov 04, 2011 5:36 am

Let us know what you find. I recall a similar post a while back where something was not getting initialized properly unless Serial.Begin() was called.
User avatar
adafruit_support_bill
 
Posts: 27992
Joined: Sat Feb 07, 2009 9:11 am

Re: Strange Borduino Behavior

by at2marty on Fri Nov 04, 2011 11:19 am

UPDATE

Tested on a Windows machine, and everything works just fine. This points to the issue definitely having something to do with the software on Linux. I may test with a 32 bit version to see if I see a difference. Meanwhile, I am gathering information regarding versions of software and searching bug reports. I would be interested to find out if something similar happens on other Linux Distributions such as Ubuntu.

I'll try to document my findings in hopes that it may help someone else out in the future.
at2marty
 
Posts: 45
Joined: Sun Mar 27, 2011 12:15 pm

Somewhat Solved

by at2marty on Fri Nov 04, 2011 4:30 pm

I got home from work and started trying a few things. I went back over what I did, then stumbled across a "fix" for now.

I went back to the original instructions for fixing a compile issue, and this time I followed the instructions completely. :oops:

As the root user, I first made a backup of the original /usr/avr directory.
Code: Select all | TOGGLE FULL SIZE
cd /usr
mv avr avr-orig


Then I copied over the downloaded avr directory to /usr
Code: Select all | TOGGLE FULL SIZE
cp -rv /home/my_user_name/Downloads/avr8-gnu-toolchain-linux_x86_64/avr/ .

Again, all commands need to be executed as user root, or use the sudo program.

After doing so, I compiled my test program with the call to Serial.begin() commented out, uploaded to my Borduinio, and all is well.

Since I am a curious person, I'll try to spend some time this weekend figuring out exactly what is different between the two directory trees and see if I can nail down the problem.
at2marty
 
Posts: 45
Joined: Sun Mar 27, 2011 12:15 pm

Re: Strange Borduino Behavior

by adafruit_support_bill on Sat Nov 05, 2011 5:24 am

Thanks for the follow up! :D
User avatar
adafruit_support_bill
 
Posts: 27992
Joined: Sat Feb 07, 2009 9:11 am

Re: Strange Borduino Behavior

by mtbf0 on Sun Nov 06, 2011 5:31 pm

my guess would be an incompatibility between avr-gcc and avr-libc versions. last time i built the toolchain for open-suse i had to try three versions of libc before getting everything to work. something, (of course, i forget exactly what), had changed in the compiler and older revs of the the libraries had become obsolete.
"i want to lead a dissipate existence, play scratchy records and enjoy my decline" - iggy pop, i need more
User avatar
mtbf0
 
Posts: 1645
Joined: Fri Nov 09, 2007 11:59 pm
Location: oakland ca