cable picaxe sous linux infos
Installation sous linux du cable de programmation picaxe
le cable AXE027 contient un circuit électronique interné basé sur un composant convertisseur série vers un usb FTDI.
The AXE027 cable contains an internal electronic circuit,
based upon an FTDI USB<>serial converter chip. This chip is
already supported by the default Linux installation, via the
kernel driver named ‘ftdi_sio’ (kernel 2.4.20 and later).
Ce composant est déjà pris en charge lors de l'installation par défaut de Linux via le pilote du noyau appelé "ftdi_sio" (pour les noyaux 2.4.20 et supérieur)
Therefore no driver download is required.
Dans les autres cas il n'est pas nécessair de télécharger de pilotes
Autrement
However, as many different products from many different companies all use the same FTDI chip,
each product is given a unique ‘product id’ number for identification purposes. This unique product
id is programmed into the chip inside the cable, so that when the cable is connected to the
computer it can be uniquely identified.
The unique product id for the AXE027 USB cable is 0xbd90. The vendor id is 0x0403.
However the default driver ftdi_sio, as installed by most Linux distributions, only recognises a
couple of (default) product ids for the FTDI chip (e.g. 0x6001). Therefore it is required to ‘patch’ the
driver so that it correctly supports the AXE027’s 0xbd90 product id.
There are 3 different ways to do this, depending on user expertise with using the Linux operating
system.
Option 1 is to simply patch (“modprobe”) the driver details every time the cable is used. This is very
simple, but needs to be carried out every time the computer is restarted (before the AXE027 cable is
inserted). This method also works when running Linux from a Live CD (without installation).
Option 2 (recommended) is also fairly straight forward, and permanent as it involves adding a new
‘udev rule’ file to the operating system. The rule runs automatically each time the computer boots.
Option 3 is advanced and only for those familiar with kernel module recompiling. It involves
modifying the original driver source code and recompiling.
All 3 options are checked for correct operation in the same simple way – after inserting the AXE027
cable into the USB port the symbolic link file called
/dev/ttyUSB0
should automatically appear within the operating system.
Note that any application using the AXE027 cable needs to address this USB symbolic link
/dev/ttyUSB0
which is not the same as the traditional serial (e.g. “COM1”) port link
/dev/ttyS0
Remember the Linux operating system is case sensitive - ‘ttyusb0’ is not the same as ‘ttyUSB0’. If you
have more than one similar USB device attached the name of the second device will be ttyUSB1 etc.
The following instructions were tested on an Asus eeePc 900, running the default Xandros (Debian
derived) distribution and on a PC booted with a Ubunto live CD (not installed).
Note that although the principles are the same for most Linux distributions, different distributions
will use different methods for becoming root (aka “superuser”) (e.g. use su -l rather than sudo) or
for opening a Console Terminal. See the online documenation for your distribution for more
specific details.
revolution
(c) Revolution Education Ltd. Web: www.picaxe.co.uk V2.5 09/11
AXE027.PMD
11
PICAXE USB CABLE
4.1) Linux Patch Option 1
Temporarily update the kernel drivers product id every time the computer is restarted (this must be carried out before
the cable is inserted into the USB port). This method can also be used when running Linux from a live CD.
To do this open a Terminal console and then type
sudo modprobe ftdi_sio vendor=0x0403 product=0xbd90
4.2) Linux Patch Option 2 (recommended)
Create a new udev rule, so that the modprobe rule is automatically applied every time the computer boots.
Create a new file (e.g. using KWrite, gedit or similar text editor) named
/etc/udev/rules.d/99-axe027.rules
To do this press open a Terminal console and then type
sudo kwrite /etc/udev/rules.d/99-axe027.rules
Then enter the following text (note the last 2 lines below should be entered as one long line) and then save the file.
# /etc/udev/rules.d/99-axe027.rules
# contains axe027 udev rule to patch default
# FTDI product id to AXE027 product id (0xbd90)
SYSFS{idProduct}=="bd90",
SYSFS{idVendor}=="0403",
RUN+="/sbin/modprobe -q ftdi_sio product=0xbd90 vendor=0x0403"
The new rule will then always be applied when the system boots. To immediately try out the new rule without
rebooting open a Terminal console and then type
sudo udevcontrol reload_rules
4.3) Patch Option 3
The technically correct method, but for experienced users only!
Patch the original kernel source files orig/drivers/usb/serial/ftdi_sio.c (3 extra lines required as overleaf) and orig/
drivers/usb/serial/ftdi_sio.h (1 extra line required) and recompile.
After patching these two files also make sure in addition to normal USB support you have
CONFIG_USB_SERIAL_GENERIC and CONFIG_USB_SERIAL_FTDI_SIO enabled in kernel .config.
Then recompile and install the kernel (or at least this module).
revolution
(c) Revolution Education Ltd. Web: www.picaxe.co.uk V2.5 09/11
AXE027.PMD
12
PICAXE USB CABLE
*** orig/drivers/usb/serial/ftdi_sio.c
*** linux/drivers/usb/serial/ftdi_sio.c
***************
*** 350,355 ***
*** 350,356 ***
{ USB_DEVICE_VER(FTDI_VID, PROTEGO_SPECIAL_3, 0, 0x3ff) },
{ USB_DEVICE_VER(FTDI_VID, PROTEGO_SPECIAL_4, 0, 0x3ff) },
{ USB_DEVICE_VER(FTDI_VID, FTDI_ELV_UO100_PID, 0, 0x3ff) },
+
{ USB_DEVICE_VER(FTDI_VID, FTDI_AXE027_PID, 0, 0x3ff) },
{ }
/* Terminating entry */
};
***************
*** 431,436 ***
*** 433,438 ***
{ USB_DEVICE_VER(FTDI_VID, PROTEGO_SPECIAL_3, 0x400, 0xffff) },
{ USB_DEVICE_VER(FTDI_VID, PROTEGO_SPECIAL_4, 0x400, 0xffff) },
{ USB_DEVICE_VER(FTDI_VID, FTDI_ELV_UO100_PID, 0x400, 0xffff) },
+
{ USB_DEVICE_VER(FTDI_VID, FTDI_AXE027_PID, 0x400, 0xffff) },
{ USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) },
{ }
/* Terminating entry */
***************
*** 537,542 ***
*** 541,545 ***
{ USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_3) },
{ USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_4) },
{ USB_DEVICE(FTDI_VID, FTDI_ELV_UO100_PID) },
+
{ USB_DEVICE(FTDI_VID, FTDI_AXE027_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) },
{ }
/* Terminating entry */
*** orig/drivers/usb/serial/ftdi_sio.h
*** linux/drivers/usb/serial/ftdi_sio.h
***************
*** 143,148 ***
*** 143,149 ***
/* ELV USB Module UO100 (PID sent by Stefan Frings) */
#define FTDI_ELV_UO100_PID
+ #define FTDI_AXE027_PID
revolution
0xFB58
0xBD90
/* Product Id */