problems with serial

azs's icon

About a forth of my students have been having problems with the serial object. When receiving values from arduino, the serial object only works sometimes. Other times, they open the same patch and it doesn't work. They have installed the correct serial drivers and have closed arduino. Also, when they open arduino, they are able to see the values over the serial monitor.

Jeremy's icon

This is unfortunately not really enough to go on. If you can come up with a set of steps which, at least intermittently, show the problem, and can include details like hardware, OS, Max verson and so on, we might be able to do some investigating.

Jeremy

azs's icon

They are all using max 5 and most have OS X leapord. As far as I can tell, they aren't doing anything differently from the students who are not having a problem. They downloaded serial drivers from the FTDI website. Then they downloaded arduino software and wrote a code to print values from analog pins to serial. The values were displayed on the serial monitor in arduino. Then they closed arduino and made a max patch using the serial object. The patch in the tutorial should work as well.

However, sometimes when they open max, these patches receive the data from the arduino and sometimes they don't. The arduino (dicimillia) is connected via usb and the program on the arduino is sending values to serial. If they do not close the patch before opening arduino, they cannot connect to the serial port, indicating that max is connected. As soon as they close max, they can connect in arduino and see the values over serial.

seejayjames's icon

I had some similar weirdness. Usually if I reconnect to the appropriate port (COM3 or COM4 on windows, not sure on mac) things start working again. Sometimes I forget to disconnect in the Arduino program before trying it, which you have to do.

I create a dropdown menu with the ports via the "print" command to serial. Then "prepend port" the COM3 COM4 etc. to reconnect. It has been a little flaky, but does work eventually, at least here...

Max Patch
Copy patch and select New From Clipboard in Max.

azs's icon

I am certain that they are connected to the right serial port. They have included the arguments "a 9600." When serial is sent the message "print" port a is usb. Also, if they try to connect to serial in arduino, without closing the patch first, arduino says that the serial port is being used by another application. As soon as they close the patch, they can connect in arduino.

Roth's icon

Have you tried using the example Aruduino-Max patch? I know the arguments you are giving probably work (and that seems to be backed up by Arduino software saying the port is busy) but I know that has some driver selection menu in it (maybe like seejay was mentioning). I realize that may not be of any help, but might be worth a try if you haven't as a kind of control group test.

If you aren't sure which patch I' referring to, let me know and I will look up the link.

comfy's icon

I may have a problem too. Sounds like this might be related.....

I have an Arduino Diecimila board, and the only way I can get it comunicate with MAX is to physicaly press the reset button on the Arduino board after the Max patch is loaded (with all the correct port settings allready set up), if I change to another port then back to the port that the Arduino is on (or close the port then open it by sending messages to the serial object)... again I have to press the reset button on the Arduino for any comunication to begin.

This is on Windows XP, I dont think its code error (i was using the Max tutorial code to try) and I'd be interested to know if this is correct behaviour for the Arduino/Max combo... The Ardunio editor programs serial monitor doesnt need a physical reset press and works fine.

Thanks Matt

comfy's icon

Nevermind chaps....

Just realised that setting the DTR attribute of the serial object to '1' sorts this out.

e.g [serial COM4 9600 @dtr 1]

Thanks anyway

Scott Fitzgerald's icon

When using a Diecimila (presumably the newer Duemilanove as well), you
need to wait for a few seconds after opening the serial pot before you
start to send data. because these newer boards have an auto-reset
"feature" to facilitate easier programming, you need to give the
bootloader a chance to time out before sending information.

If you start sending data right away, you will be talking to the
bootloader (which is waiting for a new sketch).

On Tue, Nov 11, 2008 at 3:51 PM, Matt wrote:
>
> I may have a problem too. Sounds like this might be related.....
>
> I have an Arduino Diecimila board, and the only way I can get it comunicate with MAX is to physicaly press the reset button on the Arduino board after the Max patch is loaded (with all the correct port settings allready set up), if I change to another port then back to the port that the Arduino is on (or close the port then open it by sending messages to the serial object)... again I have to press the reset button on the Arduino for any comunication to begin.
>
> This is on Windows XP, I dont think its code error (i was using the Max tutorial code to try) and I'd be interested to know if this is correct behaviour for the Arduino/Max combo... The Ardunio editor programs serial monitor doesnt need a physical reset press and works fine.
>
> Thanks Matt
>