usb driver problem
Claudi Cornaz
claudi.c at fiberworld.nl
Fri Jan 21 07:29:53 EST 2011
Hi Thomas,
Well, I recieved my arduino yesterday and started experimenting. I can upload a scetch to the board and it functions well.
I can also communicate with it via ZTerm. (send and recieve)
Now the most important part: communicating with it via livecode.
Alas this gives me trouble aswell. Here is what I got.
Using Mark's code from the makeboard to get the OSXDeviceNames() and with the arduino connected I see the following:
(it's important to have the board connected otherwise I don't see those modems)
usbmodem3a21
/dev/tty.usbmodem3a21
/dev/cu.usbmodem3a21
Bluetooth-PDA-Sync
/dev/tty.Bluetooth-PDA-Sync
..... ......
etc.
Further I can open a driver with: open driver "/dev/cu.usbmodem3a21"
and see a result on the board, it's resetting (as in the manual so this is as should be)
I can also close the driver.
I haven't been able to recieve data from the board, but I am able to send something to the board.
I send it a 1 and on the board I have a scetch which checks if it recieves data. If it recieves data,
it will send the same data out with a delay of 500 millis. So when I send data from livecode
I see the Rx led light and thereafter I see the Tx light, which means the board did recieve something and sends
the incomming data back out.
Now I am gonna try to figure out what it recieves and what it sends. (Probably I am gonna hook the whole bit up to a scope
so I can see what's going on on a electrical level)
If I use open file instead of driver it doesn't work. If I use the /dev/tty.usbmodem3a21 instead of /dev/cu.usbmodem3a21
livecode hangs with the beachball and I have to force quit.
Well that's as far as I got till now.
Perhaps it would be a good idea to discuss/collaborate some of our effords/failings etc. offlist.
As soon as I have something more I will contact you. Feel free to mail me with your addional results/questions/suggestions etc.
Best wishes,
Claudi
On 21 jan 2011, at 07:19, Thomas McGrath III wrote:
> Actually, as long as data is coming from the Arduino the app works. The data comes in and fills the field. But after the data stops being sent the system hangs. Until I push the button on the Arduino to send more data in which case the beach ball goes away and the new data gets received again.
>
> It's like as long as data keeps everything is fine. I can even close the port in the middle of getting data but If it gets to the end of the current stream the system hangs and I can't even close the port. I put code in to close the port after data stops and that is working I think but the system still hangs like it's waiting for more.
>
>
> -- Tom McGrath III
> http://lazyriver.on-rev.com
> 3mcgrath at comcast.net
>
> On Jan 21, 2011, at 1:12 AM, Thomas McGrath III wrote:
>
>> OK well I can read the data from the USB Serial Modem -- but -- after it is done the app hangs.
>>
>> So I can open the port and then read the port and I think close the port but the system hangs.
>>
>> HELP.... ??
>> -- Tom McGrath III
>> http://lazyriver.on-rev.com
>> 3mcgrath at comcast.net
>>
>> On Jan 21, 2011, at 12:48 AM, Thomas McGrath III wrote:
>>
>>> It seems if I set the EOL to CRLF things work partly. i.e. The numbers show up in the field BUT the script keeps looping and will not stop causing the beach ball.
>>>
>>> Sarah's code:
>>> on readPort
>>> if the hilite of btn "Port open" = true then
>>>
>>> if recEOL is "empty" then resetEOL
>>>
>>> put the label of btn "Port" into thePort
>>> if the hilite of btn "OS X" then
>>> read from file thePort until recEOL
>>> else
>>> read from file thePort until recEOL
>>> end if
>>> if it is not empty then put it after fld "recField"
>>> if last char of fld "recField" <> cr then put cr after fld "recField"
>>> send readPort to me in 5 ticks
>>> end if
>>> end readPort
>>>
>>>
>>>
>>> -- Tom McGrath III
>>> http://lazyriver.on-rev.com
>>> 3mcgrath at comcast.net
>>>
>>> On Jan 21, 2011, at 12:05 AM, Thomas McGrath III wrote:
>>>
>>>> UPDATE: Something is working but makes no sense.
>>>>
>>>> Found a few terminal screen ideas but they are outside of Livecode. No good.
>>>> Found a few applescript examples but would rather keep this crossplatform if possible and a LC to OSC solution would work on iOS but applescript would not. Not best but may have to go this route.
>>>>
>>>> Found a few softwares that access the USB modem (not FTDI serial emulation) as serial which leads me to believe LC can still do this even with the change from software emulation of a serial port to the hardware emulation of a serial port. So I looked again at Sarah's serialTest stack.
>>>>
>>>> I had to manually add the /dev/tty.usbmodem1a21 and /dev/cu.usbmodem1a21 to the popup menu. Then find replace driver with file in five places in the stack. Now most of the other solutions use the tty but two use the cu so I tested both. Major hang and LC not responding in Force Quit Window.
>>>>
>>>> Command period no good.
>>>> Esc no good.
>>>> Force quit. quits but no good and driver may still be open.
>>>>
>>>> Unplug Arduino Uno and plug it back in. HUH Serial Input Shows Up In Field !!!!!! Beach ball of almost death goes away. Also port is now closed I think. Also Arduino Tx led not lighting anymore - should be though. Wait replug Arduino rest button on Arduino and serial Tx led is working again. But no longer connected to LC. Try again. Open cu port and beach ball of almost death shows up - LC not responding in Force Quit Window - Unplug Arduino and field fills up with serial data. THe data is a bunch of 1 and 0 based on blinking led.
>>>>
>>>> SO this seems to say it is connecting but not communicating well. Not knowing enough about serial commands I am not sure what is causing the hang and not responding??? They are both set to 9600. I read somewhere that the trailing bit is or should be ignored.
>>>>
>>>> Is there another way to connect via message box with out clutter from other settings ? Any ideas on what the culprit is here?
>>>>
>>>> Thanks for staying with me on this one.
>>>>
>>>>
>>>> -- Tom McGrath III
>>>> http://lazyriver.on-rev.com
>>>> 3mcgrath at comcast.net
>>>>
>>>> On Jan 15, 2011, at 10:37 PM, Mark Wieder wrote:
>>>>
>>>>> Jacque-
>>>>>
>>>>> Saturday, January 15, 2011, 7:31:30 PM, you wrote:
>>>>>
>>>>>> There's no USB support per se, so if the device doesn't present itself
>>>>>> as a serial port device it won't work.
>>>>>
>>>>>> The path you use when you open a serial port as a file is the same one
>>>>>> you'd use in shell -- use the "/dev/tty.usbmodem1a21" path you
>>>>>> mentioned. Also, see if you can talk to it in shell just as a test.
>>>>>
>>>>> That should work then, since the Arduino driver has always presented
>>>>> itself as a serial port.
>>>>>
>>>>> --
>>>>> -Mark Wieder
>>>>> mwieder at ahsoftware.net
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> use-livecode mailing list
>>>>> use-livecode at lists.runrev.com
>>>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>
>>>>
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> use-livecode at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list