board hanging problem

I bought two Diecimila's from the ada fruit site. wrote my arduino code and my mac application with real basic and all was good. an associate bought 10 more Diecimila's from another site and now i am having random hanging issues of the arduino board when my app trys to connect to it. to troubleshoot this i have some code that blinks the led on and off in the loop. when i step through my mac applications code, when i get to the line that does serial1.open the led on the board stops blinking. if i reset the board with the reset button i can get it going again. this happens in between 1 and 5 trials on the new batch of boards. it never happens with my original two boards from ada fruit. i also have some code that blinks the led to let me now that i am in the setup routine. the proper behavior should be that everytime i launch my mac software when it does serial1.open the board should reset itself and run through the setup routine and then start looping. this is randomly failing on the new batch of boards. Could this be a chip problem? i noticed that the little 4 digit number above where it says ATMEGA168-20PU is different on the new batch of boards than on the 2 ada fruit boards. Or could it be some kind of bootloader problem?

Any help is greatly appreciated.

Thanks

Jeff O'Brien

Hi Jeff,

I'm having a similar problem, but with php. The first time the application starts up after a re-boot, it hangs on serial connect. To solve the problem, I need to start the Arduino IDE, open the serial monitor, then close the IDE, and presto - the program works without hanging.

I'm also using osx 10.3.9, if you want to post your code, I've also got RB and can attempt to emulate the problem to determine if it's a mac issue, or bootloader - I have chips here with Adaboot boot loader, and an original NG.

your point about the serial monitor in the IDE is a very good one. none of my boards ever hang when connected to by the serial monitor in the IDE. i wonder if you or anybody else knows how the serial monitor connects to the board. whatever it sends causes a reset every time faithfully. i will try a battery of repetitive tests with the serial monitor to see if it fails after multiple tests and report back. In the mean while can anybody tell us what steps the serial monitor goes through when you press the button?

Thanks Jeff

To be honest I don't know, java, and possibly the rx/tx library?

I haven't tried php on XP yet, but when I get a moment I'll see if serial connect exhibits the same issues on a XAMPP stack.

When you open the serial port to the diecimila, the board resets. If you're sending data to the board right away, the bootloader might interpret that as data for it and never time out and start your sketch. You might try putting a 2 or 3 second delay in the real basic program after opening the serial port but before sending any data.

In my case, it's hanging before any data is sent, and with regard to opening the serial monitor of the IDE, it's just that, open - then shut, solves the problem.

It's hard to imagine why, but I think it's a mac issue, which I thought could be attributed to the php serial library which comes with no guarantee that it will function flawlessly.

When you open the serial port to the diecimila, the board resets. If you’re sending data to the board right away, the bootloader might interpret that as data for it and never time out and start your sketch. You might try putting a 2 or 3 second delay in the real basic program after opening the serial port but before sending any data.

my app doesn’t send any data to the board. it also appears to hang when i quit my app sometimes. it almost seems like the port is not being closed correctly and then when the app is launched a second time. the communication is messed up and the board doesn’t get a reset. the problem is that it is random.
thanks
Jeff