usb stick and the gsc 10

294 views
Skip to first unread message

Adrian Cooke

unread,
Nov 16, 2011, 5:11:10 AM11/16/11
to python-ant-...@googlegroups.com
Hello Dan,

I use the Sparkfun Nordic USB ANT Stick. It is set by default to 4800 Baud, so my advice is only for that device. I think your stick is the same as or similar to Martins. I use Python 2.7 and do not have problems so I do not think it should cause problems on your Computer.

Either way I will think a bit about it and then let you know if I have any ideas. For now I have just added this thread to a google group and hopefully you receive it now. Lets communicate via the Google Group now and check you spam if you did not receive the invitation.

Regards,
Adrian

Dan Dixon <>16 November 2011 05:11
To: Martín Raúl Villalba <>, Adrian Cooke <>
Ah, yes.  I did not mention that I was using the garmin usb2 ant+ stick.  I think that baud rate is 115200 -- this looks like the default in Martin's config but different than the call Adrian makes (he sets it to 4800.)

I've tried all baud rates (4800 to 115200) in 01-reset.py.  - I even tried some illegal rates to make sure it crashed on those.

I don't have easy access to python2.6, three systems, all have 2.7.  Bummer.  I might try to run ubuntu-live and then uninstall and reinstall python as 2.6 ...  but not tonight.


I did an rm -rf in the dist_packages directory, then downloaded and installed ant-0.1.0-py2.6.egg using easy_install.
The 01-reset demo seems to run the same.   No return from the "waitForMessage" in event.py  line176 (run from the command line as:  python 01-reset.py)

Thanks again for taking the time to respond.  I hope I'm not wasting your time.

-Dan Dixon



Here is the lsusb from the device:

Bus 003 Device 011: ID 0fcf:1008 Dynastream Innovations, Inc.
Device Descriptor:
 bLength                18
 bDescriptorType         1
 bcdUSB               2.00
 bDeviceClass            0 (Defined at Interface level)
 bDeviceSubClass         0
 bDeviceProtocol         0
 bMaxPacketSize0        32
 idVendor           0x0fcf Dynastream Innovations, Inc.
 idProduct          0x1008
 bcdDevice            1.00
 iManufacturer           1 Dynastream Innovations
 iProduct                2 ANT USBStick2
 iSerial                 3 100
 bNumConfigurations      1
 Configuration Descriptor:
   bLength                 9
   bDescriptorType         2
   wTotalLength           32
   bNumInterfaces          1
   bConfigurationValue     1
   iConfiguration          2 ANT USBStick2
   bmAttributes         0x80
     (Bus Powered)
   MaxPower              100mA
   Interface Descriptor:
     bLength                 9
     bDescriptorType         4
     bInterfaceNumber        0
     bAlternateSetting       0
     bNumEndpoints           2
     bInterfaceClass       255 Vendor Specific Class
     bInterfaceSubClass      0
     bInterfaceProtocol      0
     iInterface              2 ANT USBStick2
     Endpoint Descriptor:
       bLength                 7
       bDescriptorType         5
       bEndpointAddress     0x81  EP 1 IN
       bmAttributes            2
         Transfer Type            Bulk
         Synch Type               None
         Usage Type               Data
       wMaxPacketSize     0x0040  1x 64 bytes
       bInterval               1
     Endpoint Descriptor:
       bLength                 7
       bDescriptorType         5
       bEndpointAddress     0x01  EP 1 OUT
       bmAttributes            2
         Transfer Type            Bulk
         Synch Type               None
         Usage Type               Data
       wMaxPacketSize     0x0040  1x 64 bytes
       bInterval               1
Device Status:     0x0000
 (Bus Powered)



-----Original Message-----
From: Martín Raúl Villalba [mailto:]
Sent: Tuesday, November 15, 2011 12:31 PM
To: Adrian Cooke
Cc: Dan Dixon
Subject: Re: usb stick and the gsc 10

By all means do. It would be better to use "ANT+" over "ANT" though; I'm pretty sure a build tool akin to Java's ANT exists with that exact spelling.

2011/11/15 Adrian Cooke <>:
> Hello Dan,
> Double check the Baud Rate that is used in the demo, it must be 4800.
> Also are you receiving any data? (spin the wheel turn the cranks,
> reset the Garmin device, try again...) Martin's program goes into a
> wait and read mode, so if you waited 120 seconds it would exit
> properly, so I do not think its hanging. I also did not receive things
> sometimes, but after reseting the Garmin and waiting a bit it seems to
> work. Still need to start testing it better and create a complete
> packet parser. I will post this up on GitHub soon.
> I plan to make a system whereby we read the ant packets from the
> device store it in an HDF5 file which can then be processed by Python
> or Matlab and probably many other languages.
> Dan, do you know how to change the Baud Rate on the SparkFun device? I
> looked on the webpage at Sparkfun, its says you can change it by
> soldering a jumper but I cannot figure out where... I want to put a
> post on in the Sparkfun forum for that, one of the many tasks on my plate...
> Do either of you mind if I make a new google group called 'Python Ant'
> or Python ANT+ user forum, or open source ant orsomethinglike that,
> and put this story online so that other people can find out our
> solutions when we get there? I will remove all email address's from
> this thread and then post it to the group and invite you two to the
> group... these sort of conversations should be shared with everybody!
> Adrian
>
> 2011/11/15 Martn Ral Villalba <>
>>
>> Dan,
>>
>> That shouldn't be happening at all. Could you try...
>> 1) Running demo 01 against the HEAD of the master branch rather than
>> develop? Please note you may need to set baud_rate=4800 on the
>> USB1Driver constructor call for the demos as can be seen in the
>> SparkFun demo.
>> 2) Running demo 01 from either the develop or master HEAD under
>> python
>> 2.6 rather than 2.7, if you have it available.
>>
>> If that doesn't fix it, I'll try to debug it. Let me know how it goes.
>>
>> P.S. It would be helpful to know the exact stick model you have.
>>
>>
>> Adrian,
>>
>> Considering you most likely have the same stick, have you experienced
>> similar problems?
>>
>>
>> 2011/11/14 Dan Dixon <>:
>> >
>> > Hey guys,
>> >
>> > Thanks again (very much) for the code and the pointers on getting
>> > my ant stick up and talking to a speed/cadence sensor.
>> >
>> > I'm a 20yr perl vet, but a total noob when it comes to python and
>> > usb communications. But, I'm learning...
>> >
>> > After a Sunday of getting ubuntu up, adding libusb, adding some
>> > necessary python libraries, getting the usb mapped to ttyUSB0,
>> > etc... I think I have things how they should be.
>> >
>> > But, I'm hanging on the simplest demo. I'll put a bunch of info
>> > here, and if you ever have a minute, I was hoping you might point
>> > me in a probable debug direction. I know you don't owe me a thing
>> > here, but I'd be SUPER grateful if you had any ideas.
>> >
>> > THANKS at ton in advance!
>> >
>> > -dan
>> >
>> > Dan Dixon
>> > Fort Collins, CO
>> > US
>> >
>> >
>> > ===================================================================
>> > ================
>> > output from demo runs
>> >
>> > ===================================================================
>> > ================
>> >
>> > $ python ./01-reset.py
>> > Using log file: 2011-11-14T18:05:27.644414.ant
>> >
>> > ========== [WRITE] ==========
>> > 0000 A4 01 4A 00 EF
>> >
>> > ========== [WRITE] ==========
>> > 0000 A4 02 4D 00 54 BF
>> >
>> > ========== [READ] ==========
>> > 0000 A4 01 6F 20 EA A4 06 54
>> > 0000 08 03 00 BA 36 00 71
>> >
>> > ... it hangs here and I get this with a ^C
>> >
>> > Traceback (most recent call last):
>> > File "./01-reset.py", line 22, in <module>
>> >  antnode.start()
>> > File
>> > "/usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/c
>> > ore/node.py",
>> > line 163, in start
>> >  self.init()
>> > File
>> > "/usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/c
>> > ore/node.py",
>> > line 188, in init
>> >  caps = self.evm.waitForMessage(message.CapabilitiesMessage)
>> > File
>> > "/usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/c
>> > ore/event.py",
>> > line 176, in waitForMessage
>> >  time.sleep(0.002)
>> > KeyboardInterrupt
>> > Unhandled exception in thread started by sys.excepthook is missing
>> > lost sys.stderr
>> >
>> >
>> > ===================================================================
>> > ================
>> >
>> > It also hangs on...
>> >
>> > $ python 07-rawmessage3_SparkFun.py Using log file:
>> > 2011-11-14T18:07:42.866512.ant
>> >
>> > ========== [WRITE] ==========
>> > 0000 A4 01 4A 00 EF
>> >
>> > ========== [READ] ==========
>> > 0000 A4 01 6F 20 EA
>> >
>> > ========== [WRITE] ==========
>> > 0000 A4 09 46 00 B9 A5 21 FB
>> > 0000 BD 72 C3 45 64
>> >
>> > ========== [READ] ==========
>> > 0000 A4 03 40 00 46 00 A1
>> >
>> > ^CTraceback (most recent call last):
>> > File "07-rawmessage3_SparkFun.py", line 42, in <module>  if
>> > evm.waitForAck(msg) != RESPONSE_NO_ERROR:
>> > File
>> > "/usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/c
>> > ore/event.py",
>> > line 164, in waitForAck
>> >  time.sleep(0.002)
>> > KeyboardInterrupt
>> > Unhandled exception in thread started by sys.excepthook is missing
>> > lost sys.stderr
>> >
>> >
>> >
>> > ===================================================================
>> > ================
>> > Now some debug info:
>> >
>> > ===================================================================
>> > ================
>> >
>> > /var/log/syslog
>> >
>> > Nov 14 18:10:35 ubuntut42p kernel: [28140.092070] usb 3-2: new full
>> > speed USB device number 11 using uhci_hcd Nov 14 18:10:36
>> > ubuntut42p kernel: [28140.280137] usbserial_generic
>> > 3-2:1.0: generic converter detected Nov 14 18:10:36 ubuntut42p
>> > kernel: [28140.280357] usb 3-2: generic converter now attached to
>> > ttyUSB0 Nov 14 18:10:36 ubuntut42p mtp-probe: checking bus 3,
>> > device 11:
>> > "/sys/devices/pci0000:00/0000:00:1d.1/usb3/3-2"
>> > Nov 14 18:10:36 ubuntut42p mtp-probe: bus: 3, device: 11 was not an
>> > MTP device
>> >
>> >
>> > ===================================================================
>> > ================
>> >
>> > dmesg:
>> >
>> > [28140.092070] usb 3-2: new full speed USB device number 11 using
>> > uhci_hcd [28140.280137] usbserial_generic 3-2:1.0: generic
>> > converter detected [28140.280357] usb 3-2: generic converter now
>> > attached to ttyUSB0
>> >
>> >
>> >
>> > ===================================================================
>> > ================
>> >
>> > The install looked healthy:
>> >
>> > $ sudo python setup.py install
>> > running install
>> > Checking .pth file support in
>> > /usr/local/lib/python2.7/dist-packages/
>> > /usr/bin/python -E -c pass
>> > TEST PASSED: /usr/local/lib/python2.7/dist-packages/ appears to
>> > support .pth files running bdist_egg running egg_info writing
>> > requirements to src/ant.egg-info/requires.txt writing
>> > src/ant.egg-info/PKG-INFO writing top-level names to
>> > src/ant.egg-info/top_level.txt writing dependency_links to
>> > src/ant.egg-info/dependency_links.txt
>> > reading manifest file 'src/ant.egg-info/SOURCES.txt'
>> > reading manifest template 'MANIFEST.in'
>> > writing manifest file 'src/ant.egg-info/SOURCES.txt'
>> > installing library code to build/bdist.linux-i686/egg running
>> > install_lib running build_py creating build/bdist.linux-i686/egg
>> > creating build/bdist.linux-i686/egg/ant creating
>> > build/bdist.linux-i686/egg/ant/plus
>> > copying build/lib.linux-i686-2.7/ant/plus/__init__.py ->
>> > build/bdist.linux-i686/egg/ant/plus
>> > creating build/bdist.linux-i686/egg/ant/fs copying
>> > build/lib.linux-i686-2.7/ant/fs/__init__.py ->
>> > build/bdist.linux-i686/egg/ant/fs copying
>> > build/lib.linux-i686-2.7/ant/__init__.py ->
>> > build/bdist.linux-i686/egg/ant creating
>> > build/bdist.linux-i686/egg/ant/core
>> > copying build/lib.linux-i686-2.7/ant/core/log.py ->
>> > build/bdist.linux-i686/egg/ant/core
>> > copying build/lib.linux-i686-2.7/ant/core/exceptions.py ->
>> > build/bdist.linux-i686/egg/ant/core
>> > copying build/lib.linux-i686-2.7/ant/core/__init__.py ->
>> > build/bdist.linux-i686/egg/ant/core
>> > copying build/lib.linux-i686-2.7/ant/core/constants.py ->
>> > build/bdist.linux-i686/egg/ant/core
>> > copying build/lib.linux-i686-2.7/ant/core/driver.py ->
>> > build/bdist.linux-i686/egg/ant/core
>> > copying build/lib.linux-i686-2.7/ant/core/event.py ->
>> > build/bdist.linux-i686/egg/ant/core
>> > copying build/lib.linux-i686-2.7/ant/core/message.py ->
>> > build/bdist.linux-i686/egg/ant/core
>> > copying build/lib.linux-i686-2.7/ant/core/node.py ->
>> > build/bdist.linux-i686/egg/ant/core
>> > byte-compiling build/bdist.linux-i686/egg/ant/plus/__init__.py to
>> > __init__.pyc byte-compiling
>> > build/bdist.linux-i686/egg/ant/fs/__init__.py to __init__.pyc
>> > byte-compiling build/bdist.linux-i686/egg/ant/__init__.py to
>> > __init__.pyc byte-compiling
>> > build/bdist.linux-i686/egg/ant/core/log.py to log.pyc
>> > byte-compiling build/bdist.linux-i686/egg/ant/core/exceptions.py to
>> > exceptions.pyc byte-compiling
>> > build/bdist.linux-i686/egg/ant/core/__init__.py to __init__.pyc
>> > byte-compiling build/bdist.linux-i686/egg/ant/core/constants.py to
>> > constants.pyc byte-compiling
>> > build/bdist.linux-i686/egg/ant/core/driver.py to driver.pyc
>> > byte-compiling build/bdist.linux-i686/egg/ant/core/event.py to
>> > event.pyc byte-compiling
>> > build/bdist.linux-i686/egg/ant/core/message.py to message.pyc
>> > byte-compiling build/bdist.linux-i686/egg/ant/core/node.py to
>> > node.pyc creating build/bdist.linux-i686/egg/EGG-INFO
>> > copying src/ant.egg-info/PKG-INFO ->
>> > build/bdist.linux-i686/egg/EGG-INFO
>> > copying src/ant.egg-info/SOURCES.txt ->
>> > build/bdist.linux-i686/egg/EGG-INFO
>> > copying src/ant.egg-info/dependency_links.txt ->
>> > build/bdist.linux-i686/egg/EGG-INFO
>> > copying src/ant.egg-info/requires.txt ->
>> > build/bdist.linux-i686/egg/EGG-INFO
>> > copying src/ant.egg-info/top_level.txt ->
>> > build/bdist.linux-i686/egg/EGG-INFO
>> > zip_safe flag not set; analyzing archive contents...
>> > creating 'dist/ant-develop-py2.7.egg' and adding
>> > 'build/bdist.linux-i686/egg' to it removing
>> > 'build/bdist.linux-i686/egg' (and everything under it) Processing
>> > ant-develop-py2.7.egg removing
>> > '/usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg'
>> > (and everything under it)
>> > creating
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg
>> > Extracting ant-develop-py2.7.egg to
>> > /usr/local/lib/python2.7/dist-packages
>> > ant develop is already the active version in easy-install.pth
>> >
>> > Installed
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg
>> > Processing dependencies for ant==develop Searching for
>> > msgpack-python==0.1.10 Best match: msgpack-python 0.1.10
>> > msgpack-python 0.1.10 is already the active version in
>> > easy-install.pth
>> >
>> > Using /usr/local/lib/python2.7/dist-packages
>> > Searching for pyserial==2.5
>> > Best match: pyserial 2.5
>> > Adding pyserial 2.5 to easy-install.pth file
>> >
>> > Using /usr/lib/python2.7/dist-packages Searching for
>> > distribute==0.6.24 Best match: distribute 0.6.24 Processing
>> > distribute-0.6.24-py2.7.egg distribute 0.6.24 is already the active
>> > version in easy-install.pth Installing easy_install script to
>> > /usr/local/bin Installing easy_install-2.7 script to /usr/local/bin
>> >
>> > Using
>> > /usr/local/lib/python2.7/dist-packages/distribute-0.6.24-py2.7.egg
>> > Finished processing dependencies for ant==develop
>> >
>> >
>> >
>> > ===================================================================
>> > ================
>> >
>> > $ find /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/EGG-IN
>> > FO
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/EGG-IN
>> > FO/zip-safe
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/EGG-IN
>> > FO/dependency_links.txt
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/EGG-IN
>> > FO/top_level.txt
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/EGG-IN
>> > FO/requires.txt
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/EGG-IN
>> > FO/PKG-INFO
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/EGG-IN
>> > FO/SOURCES.txt
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/pl
>> > us
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/pl
>> > us/__init__.pyc
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/pl
>> > us/__init__.py
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/fs
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/fs
>> > /__init__.pyc
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/fs
>> > /__init__.py
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/__
>> > init__.pyc
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/__
>> > init__.py
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/co
>> > re
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/co
>> > re/event.pyc
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/co
>> > re/node.pyc
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/co
>> > re/log.py
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/co
>> > re/message.pyc
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/co
>> > re/driver.pyc
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/co
>> > re/exceptions.py
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/co
>> > re/log.pyc
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/co
>> > re/__init__.pyc
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/co
>> > re/__init__.py
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/co
>> > re/constants.py
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/co
>> > re/driver.py
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/co
>> > re/event.py
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/co
>> > re/constants.pyc
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/co
>> > re/message.py
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/co
>> > re/exceptions.pyc
>> >
>> > /usr/local/lib/python2.7/dist-packages/ant-develop-py2.7.egg/ant/co
>> > re/node.py
>> >
>> >
>> >
>> > ===================================================================
>> > ================
>> >
>> >
>> >
>> >
>>
>>
>>
>> --
>> Martn Ral Villalba
>
>



--
Martn Ral Villalba

Martín Villalba

unread,
Nov 17, 2011, 4:15:44 PM11/17/11
to Python ANT+ Open Source
In that case, the packet sent back from the stick is most likely
bearing a wrong checksum and is being discarded by the event machine,
ergo, the script hangs in an eternal busy loop, forever waiting for a
packet that will never come. The thing is, that should never happen
since checksum errors are expected for OTA data packets rather than
control messages; perhaps it's a driver issue.

Dan, how did you set up the USB2 stick to work with the existing
driver?

On 16 Nov, 07:11, Adrian Cooke <adriangerardco...@gmail.com> wrote:
> Hello Dan,
>
> I use the Sparkfun Nordic USB ANT Stick. It is set by default to 4800 Baud,
> so my advice is only for that device. I think your stick is the same as or
> similar to Martins. I use Python 2.7 and do not have problems so I do not
> think it should cause problems on your Computer.
>
> Either way I will think a bit about it and then let you know if I have any
> ideas. For now I have just added this thread to a google group and
> hopefully you receive it now. Lets communicate via the Google Group now and
> check you spam if you did not receive the invitation.
>
> Regards,
> Adrian
>
> *Dan Dixon <>**16 November 2011 05:11*

Dan Dixon

unread,
Nov 17, 2011, 10:08:03 PM11/17/11
to Python ANT+ Open Source

I plugged it in and typed:

sudo modprobe usbserial vendor=0x0fcf product=0x1008

To get it to show up as ttyUSB0

uh oh... is that not enough -- I'm not sure what you mean by "existing
driver". The python code?

-dan
> ...
>
> read more »

Adrian Cooke

unread,
Nov 22, 2011, 7:25:50 AM11/22/11
to python-ant-...@googlegroups.com
Hello,

I think Martin has the Dynastream USB version 1. You might need some additional lower-level driver for your version. But I am not sure. Mine has a different FTDI USB driver that makes the Sparkfun stick look like a normal serial device. You need something to do that before you can use the python code, which you might not have. I do not have the knowledge to really give proper advice about this though.

Adrian

Martín Raúl Villalba

unread,
Nov 22, 2011, 8:26:39 AM11/22/11
to python-ant-...@googlegroups.com
Sorry for being unresponsive Dan, I've been rather busy. I'm pretty
sure this is a problem with your stick in particular, as nobody else
seems to have your problem, but you are the first I've seen using the
gen 2 stick by Dynastream. I'll put together a python-side driver with
libusb for you to try as soon as I can. Hopefully today.

2011/11/22 Adrian Cooke <adriange...@gmail.com>:

--
Martín Raúl Villalba

Reply all
Reply to author
Forward
0 new messages