problems with serial
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.
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.
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.
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…
----------begin_max5_patcher---------- 638.3ocyVtsiaBCDF9ZVo8cvxWmFEaBDRuqOGUqpLfSVuErQXiZ1tpu60dfP HmIERyFoLNZrw4e97Ld3imexCGq1v0XzWQeG448g0iG3y4waqCObNaSRFSCK DGWYLJIdRybxpbgLiafIIc7ppLG4VjBagJ9suD0tC0Kz7dAuVH3XlbMF8x14 KXljWEx0+njmXpWRPvzYSPfgFt0hdAdf+77StQ6vjdGS4bslsle5fht06Jkz HY4fLweqTvxv8OdCaWaQIWykFlQnjchIxbHRVrzYm0X1QginTGB4DlV7aXFB YZvx.RzhKfORDr+MVpyRhFD.k7eYCx1Pzv2.+UtXsfKSQZt4JYLCBtA3aFSt X+pDpNOKb4T+Y1O9CFSIp7b6Q+wbJ4UkRyQEpRChslIjHwJz6pJzZtAkJzIJ ozJNdZ6ilIrNTURydonCjssHYU453FR.YGcM6.ZmSf43SRYZenLg.XlD.E.9 yuKYhFTQoPZPIYbV4XkKROAI7OetHn.7D6wMHh+sLSfU90Ilg+GJcYEtg6Y0 KczqdA5DA1kjwp3sxV5V0JUggm2z4bmFuY33B0i1kLVLOKISj7yKzS0+Dfjb gbulLO36YfZXOfJgVWxVeyHMXTa61I2SHM2ytwzE36Ri0ZFAHx2+NVbp4GFv i80XjqmJMfZyvZDsX5bWsI8Lbp9O.Z0c3KoB6rahCnmVUUlrUnMumIpSKqTt 1Hjv6d0YQj8WzqhzTtbuFh4hzBkMvaKVO+QZukVPejV3CQZj9HsfGizrWxgH i9I5R5z.28ZvaCGUeG2teG3e4x3aBrWU7zGBX8+7VoP6kz7eXXi7IUat1bWG bCWaNG1g+Z6XZVJ -----------end_max5_patcher-----------
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.
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.
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.
Just realised that setting the DTR attribute of the serial object to ’1′ sorts this out.
e.g [serial COM4 9600 @dtr 1]
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
> 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