Let's Make Robots!

How to use the PICAXE USB cable on Linux


So i finally managed to have the Picaxe USB Cable working under linux. Not the programming editor of course, just the serial connection. You can use it to send/receive data with sertxd and serrxd basic command.

Basically, the download cable contains an USB to Serial chip made by FTDI for which a linux kernel module already exists! The problem is that the module is not recognized automatically becouse the cable have different non-standard identificatives. So first, let's find the device. (note: give all commands as root)

Connect the cable to an USB port, then give the following command:

cat /proc/bus/usb/devices

It should list something like (among other devices):

T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  6 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0403 ProdID=bd90 Rev= 6.00
S:  Manufacturer=Revolution
S:  Product=AXE027 PICAXE USB
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr= 90mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

Now take note of the Vendor and ProdID you have (i don't know if they're the same as mine). Then give the following command:

modprobe ftdi_sio vendor=0x0403 product=0xbd90

This will load the ftdi_sio kernel module which will handle the serial communication. Substitute the two ID if they're different (remember the 0x before).

Now try to list the devices again, you should see where it said Driver=(none), now should say Driver=ftdi_sio.

The driver should have created a new device under /dev, called /dev/ttyUSB0 (maybe ttyUSB1 or 2 etc if you had other serial devices).

That's the device for your cable! You can now run your favourite program to use the port.

For example, to access it from the console you can run the standard minicom program. Once open hit CTRL-A O. It should open a configuration menu. Go to Serial port setup, choose the right device, set Bps/par/bits to 4800 8N1, no hardware control flow, no software control flow. Close the menu, connect your robot and you should see his output on the terminal!

(To exit minicom, give CTRL-A Q).

I think you can make the module load at boot time by putting a line in /etc/modules, something like:

ftdi_sio vendor=0x0403 product=0xbd90

This ends this wanderful guide. IHTH

 

 A session of minicom, reading robot output

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
how pixace work
I think there is one. This no? http://www.rev-ed.co.uk/software/picaxe.tgz from rev-ed themselves.

Good find! They even have a compiler for the mac! Now I can use the brilliant TextMate program for editing programs and I wont have to start windows when I want to update the program.

Thanx! 

I connect the cable to the usb port and it doesn't show up under devices. Windows will recognize it as Axe027 Usb Cable. Any idea why it isn't showing up under devices? i'm on Ubuntu 8.04

Any body gotten this to load at boot time?

I'm running Ubuntu 8.04 x86_64 , i don't have a etc/modules.

 

 

My experience with wine and the editor was that it didn't work too well. I had a bit of a migrane(damn those tanins) in the morning and my program looked like crap as well...oh wait...wrong wine..  :)  But seriously, the setup that I had was running on an older dell laptop(inspiron 8100) that I use when I need serial com. The After getting the com port setup the app ran slow and seemed to hang almost every other minute... I was running ubuntu 8.0.4 with all the current updates at the time.

 

For all you Ubuntu/Debian x86_64 users you might want to try 'lsusb' to list you usb devices

since cat /proc/bus/usb/devices may not work, it didn't for me.

BTW the vendor and prodid is exactly the same 0409,bd90.

though the chip name was different.

Bus 001 Device 004: ID 0403:bd90 Future Technology Devices International, Ltd

But it works, bye, bye winbloze!

However the editor is pretty neat, can't wait for the linux version.

Anyone know of any attempt to reverse engineer the picaxe download protocol (ie some documentation) ?

I tryed to log the serial port traffic but when i run a download the picaxe doesn't answer.. there's something going on :)

You cannot do that reverse.. (in a million years, at last) - because the Picaxe editor is NOT just transferring the BASIC to the Picaxe; It assambles it, parces it to the libraries etc.. and then it transfers. 

/ Fritsl

Yeah i know.. But it's less than a million year :) After all, they reverse engineered harder stuff, like NTFS.. There are well known tecniques to do reverse engineerings, i did some in the past. Basically you observe the transfer, than make small changes and observe the difference and so on.

For what i know, the basic interpreter resides on the chip, so the programs are not "compiled" on the editor. Instead they're probably parsed and tokenized with some eventual transformations. For example, that's exacly the way old MSX computers save Basic programs on tape.

Anyway, i'm not gonna do anything near a full or useful reverse engineering.. i dont' have the time nor the skills :) I'm just investigating a little.. I like to know how things work :)

For grog: i was on windows, i used Null Modem Emulator and a small program by me to log stuff.