A20-OLinuXino-Lime-4GB FTDI usb to serial

Started by ebimicro, July 24, 2015, 04:58:28 PM

Previous topic - Next topic

ebimicro

Hi everybody,

I got my new A20 board with default android image on it. Now I want to connect one of FTDI chips to it, and I do all steps according to FTDI technical note for D2XXSample http://www.ftdichip.com/Support/Documents/TechnicalNotes/TN_134_FTDI_Android_D2XX_Driver.pdf
I loaded libftd2xx-jni.so file to the right location in /data/data/com.ftdi.d2xx/ using adb. And also ftd_sio.ko file is loaded to /system/vendor/module. I even edit preinstall.sh file with following lines:
/system/bin/insmod /system/vendor/modules/ftdi_sio.ko
chmod 0666 /dev/ttyS0
chmod 0666 /dev/ttyS1
chmod 0666 /dev/ttyS2
chmod 0666 /dev/ttyS3
chmod 0666 /dev/bus/usb/*
But still no success of detecting FTDI plug-in.  :-\
Btw if I look at the file list in /dev on my A20 board, I only can see ttyS0,ttyS6 and ttyS7
and also if I check /dev/bus/usb/002 and 003 while I connect FTDI chip, I can see an extra file created like 002.
Does anybody has a solution for this problem, please?

Pawel_W

#1
Probably kernel object ftdi_sio.ko is not compiled for kernel 3.4.39+ used by A20-Lime2, so the vermagic strings do not match.
More information at http://linux.die.net/lkmpg/x380.html
http://stackoverflow.com/questions/15010642/loading-a-android-kernel-module-with-vermagic-mismatch

Better compile this driver yourself using android kernel sources from
https://axonjakarta.wordpress.com/2014/02/14/olimex-a20-android-building-4/

Modinfo command does not work in Android, so use command from BusyBox
strings some_module.ko | grep vermagic
to list vermagic strings for ftdi_sio.ko and for some other module. They should be identical!

Pawel_W


ebimicro

Dera Pawel_W

Thank u so much for ur answers. I downloaded ur .ko file and copyed it to /system/vendor/modules/ and still my FTDI chip can NOT be detected after restarting the board. And to be honest I didn't get how to use BusyBox vermagic string for a .ko file :-\

Pawel_W

#4
You may need to use terminal, login as root (su) and issue commands:

cd /system/vendor/modules/
insmod ftdi_sio.ko vendor=0x0403 product=0x6001

for this module to become active. You should of course change these values to match your device.
http://www.ftdichip.com/Support/Documents/TechnicalNotes/TN_100_USB_VID-PID_Guidelines.pdf
It loads correctly into my Android, but I don't have any FTDI device to test it.
You may use lsmod command to list loaded modules, lsusb to list numbers, VIDs and PIDs of your devices, dmesg immediately after connecting the device to read device number and find its entry in lsusb output.
Issue command:
chmod 644 ftdi_sio.ko
once to correct access rights.

P.S.
I made xpad.ko module for my XBox 360 gamepad also, and it didn't become loaded in system and active by simply copying it to /system/vendor/modules/. Gamepad starts working only after issuing above commands after each reset (tested by GamepadTest app).
So you may need to modify some Android boot script by adding these commands.

Busybox only installs additional commands into Android, you need also SuperSu app and terminal emulator (i.e. Terminal Ide) to login as root, install kernel module or issue this strings command.

Issue the following command as root to enable writing to /system folder:
mount -o rw,remount /system

UPDATE:
Quote
I even edit preinstall.sh file with following lines:
/system/bin/insmod /system/vendor/modules/ftdi_sio.ko
I edited file preinstall.sh in exactly the same way (before instruction if):
/system/bin/insmod /system/vendor/modules/xpad.ko
and the gamepad didn't work!
But it works when I issue the above command in terminal as root, so probably your preinstall.sh script modification doesn't work.

IMO the correct file to modify is:
/init.sun7i.rc
but I have problems with modifying it and saving changes, probably will have to remove microSD card.

Pawel_W

Hello again!
I have compiled a driver for Prolific PL2303 USB to serial RS232 converter.
You can download it from http://chomikuj.pl/nased0/Android/OLinuXino+A20/Drivers
Copy it to /system/vendor/modules and do not forget to
chmod 644 pl2303.ko

To load and set it for 9600 bps type following commands:

su
insmod /system/vendor/modules/pl2303.ko
stty -F /dev/ttyUSB0 9600


And that's how it works - I press buttons on Arduino LCD shield and it sends texts via RS232 shield to serial terminal on A20.