PCAN on Android

This forum covers PCAN-Linux and Linux development issues concerning our products
M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: PCAN on Android

Post by M.Maidhof » Wed 6. Aug 2014, 15:00

Hi,

well, we don´t have such a phone here, so we can´t help you with your problem. When you are located in Germany, you can contact us by phone, this will be much easier to find a solution than posting messages in that thread...again and again

regards

Michael

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: PCAN on Android

Post by S.Grosjean » Mon 11. Aug 2014, 11:38

Hi,

In order to help you in fixing your problem, I need first to be sure of the several steps you did and their sequence, please. For example, in your screenshot, you do an "echo blahbla > /dev/pcanusb0" which will create a TEXT file named "pcanusb0" under "/dev", if there was not any file with this name before... This (could) explain why your next "mknod" commands don't work...

So, please, do the followings and give us the ouput of each command please:

1 - remove the driver from the memory:

Code: Select all

$ rmmod pcan
2 - remove any existing "pcanxxx" files from "/dev" and check they have been really destroyed:

Code: Select all

$ rm -f /dev/pcan*
$ ls -l /dev/pcan*
3 - check your Kernel current configuration for hotplug support. You should find a way to get your kernel configuration, either using /proc/config.gz (if option was set) or in a file like /boot/config.xxx, like under Ubuntu systems. For example:

Code: Select all

$ uname -r
$ grep -e HOTPLUG -e DEVTMPFS  /boot/config-`uname -r` 
4 - load the driver again:

Code: Select all

$ insmod pcan.ko
5 - give us the ouput of this command please:

Code: Select all

$ dmesg | grep -e pcan -e usb
6 - give us the ouput of this command please:

Code: Select all

$ ls -l /dev/pcan*
Thanks and regards,

Stéphane
— Stéphane

mo_oin
Posts: 14
Joined: Wed 6. Aug 2014, 11:08

Re: PCAN on Android

Post by mo_oin » Mon 11. Aug 2014, 16:11

Hi,
here the outputs:

rmmod pcan ->worked
rm -f /dev/pcan* ->worked
ls -l /dev/pcan* ->worked
output:
/dev/pcan*: No such file or directory

/proc/config.gz ->failed
output:
sh: /proc/config.gz:can't execute: Permission denied

uname -r ->worked
output:
3.1.10-CM
(in /proc/version: Linux versin 3.1.10-CM (ivan@ubuntu) (gcc version 4.7 (GCC) ) #786 SMP PREEMPT Thu Jul 10 21:50:40 CEST 2014)

grep -e HOTPLUG -e DEVTMPFS /boot/config-'uname -r' ->failed
output:
grep: /boot/config- uname -r: No such file or directory
(well there isnt even a boot folder, and the /config folder is empty too.)

insmod pcan.ko ->worked
dmesg |grep -e pcan -e usb ->worked
output:
(image http://imgur.com/ujgSMZT)
Image

ls -l /dev/pcan* ->worked
output:
crw---- root root 180, 32 2014-08-11 15:06 pcanusb0

well i tried even to remount my /system folder with rw permission but didnt took any effect on the outcome :(
(mount -o remount,rw /system)
If u guys like i can phone u again or visit ur company to show u my setup. Maybe i missed smthing essential.
Seems to me like an annoying task to do over the forum.

Greetings,

ray

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: PCAN on Android

Post by S.Grosjean » Tue 12. Aug 2014, 11:56

Hi,

To go on with fixing your issue, I would have liked to get your entire config of your kernel first.

Since you made a few mistakes in the commands you typed, it's really important that you do exactly what I request. Moreover, use text files instead of screenshots please and upload them through the below "Upload attachment" tab ...

1 - Please give us the text file "config.txt" created with:

Code: Select all

$ zcat /proc/config.gz > config.txt
If what you wrote is correct, the pcanusb0 dev node is automatically created by a running udev system, which ISNOT the case in the TFT201 environment described in the document that explains how to cross-compile for Android. Once again, I only imagine this, and having your Kernel config could confirm it.

Anyway, because udev seems running on your system, the "mknod" commands obviously fail (the pcansub0 /dev node already exists). The only difference is the access rights used to create that node: your udev default rights sets rw for root only. So you MUST be root (be sure to run "su" before) to read/write on that node.

Finally, according to http://i.imgur.com/pwcDP8J.png, especially the below commands sequence:

Code: Select all

$ rm /dev/pcanusb0
$ echo "i 0x1c 0x03" > /dev/pcanusb0
  • deletes the existing (and correct) device node created by udev
  • creates a text file named "pcanusb0" under "/dev", which contains "i 0x1c 0x03", which obviously removes any further acces to the kernel device created by pcan.
To summarize, redo what I wrote in my previous e-mail, FROM the begining TO the end. Your last line shows a correct device node. So at this point, if you're root, you should be able to write commands to the device node. To be sure of that, when you have reached that last point, please do the followings next:

1 - be sure to be root:

Code: Select all

$ id
(you should get soemthing like "uid=0(root) gid=0(root)")

2 - display the current pcan config to check if default bitrate (btr column) shows "0x001c" as default BTR value:

Code: Select all

$ cat /proc/pcan
3 - to verify if your device node is ok, start changing the bitrate of the CAN interface, with the following command:

Code: Select all

$ echo "i 0x14 0x00" > /dev/pcanusb0
4 - check if the command worked by reading the pcan config again:

Code: Select all

$ cat /proc/pcan
(the btr column should have changed with the 0x0014 value now)

Regards,

Stéphane
— Stéphane

mo_oin
Posts: 14
Joined: Wed 6. Aug 2014, 11:08

Re: PCAN on Android

Post by mo_oin » Tue 12. Aug 2014, 14:56

Hi,
and thankyou for ur help again!

i did everything in ur pre post again exept the config thing (i used the new command and it worked)

id gives back: uid=0(root) gid=0(root) context=u:r:init_shell:s0
(i guess i'm root)

but changing bitrate didnt work sadly.

i researched a bit and somehow my android kernel runs in read only mode or something like that because previous i couldn't use "adb push" to put files on my phone.
i fixed it with the command

Code: Select all

mount -o rw,remount rootfs/ 
so maybe this solved some issues, but i dont know.
i also tried after removing the old one:

Code: Select all

mknod -m 0777 dev/pcanusb0 c 180 32
and it worked but also in this one changing bitrate didnt worked :(

i hope i provided all the information to ur delight.

sincerely,

ray
Attachments
sdcard1.zip
the txt files
(21.91 KiB) Downloaded 796 times

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: PCAN on Android

Post by S.Grosjean » Tue 12. Aug 2014, 15:42

Hi,
mknod -m 0777 dev/pcanusb0 c 180 32
is missing the heading "/" before "dev/pcanusb0" ... Check if you didn't forget it when you entered your command.

Please tell me also what exactly are the reasons (messages, errno etc...) that are displayed when you say "it doesn't work". This could - really - help in fixing the issue.

To get more infos, you could also build the pcan driver in Debug mode: edit the "peak-linux-driver-x.y/driver/Makefile" and change

Code: Select all

DBG = NO_DEBUG
into

Code: Select all

DBG = DEBUG
Save then exit, then clean and rebuild the driver:

Code: Select all

$ cd peak-linux-driver-x.y/driver
$ make clean
$ make
On your Android phone, unload the old driver, unplug the PCAN-USB, load the new driver, plug the PCAN-USB and redo the "echo i" command, then give me the pcan.txt file built from this command please:

Code: Select all

$ dmesg | grep -e pcan -e usb > pcan.txt
Regards,

Stéphane
— Stéphane

mo_oin
Posts: 14
Joined: Wed 6. Aug 2014, 11:08

Re: PCAN on Android

Post by mo_oin » Tue 12. Aug 2014, 17:00

Sorry for being sloppy. i wrote the initial "/" but out of curiosity i tried it now without the initial "/" and it worked also in the mknod command.
Well, the error messages are always the same:

Code: Select all

sh: 
echo "i 0x14 0x00" > /dev/pcanusb0
can't create /dev/pcanusb0: No such device

Code: Select all

chown 0777 /dev/pcanusb0
Unable to open /dev/pcanusb0: No such device
i did the debug thing and i got an error. i did the suggested make oldconfig && make prepare but at the second driver compile it threw the error again. i guess i have to read more about kernel compiling to understnd the next step.
but never the less it made everytime a new pcan.ko. normally if a make doesnt succeed it stops compiling... strange.
i didn't put it on the phone becaus of the error i got. but if the .ko is ok tell me and i go on as u suggested.

i added all 3 outputs in .txt files

sincerely,

ray
Attachments
output.tar.gz
(2.27 KiB) Downloaded 989 times

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: PCAN on Android

Post by S.Grosjean » Wed 13. Aug 2014, 11:50

Hi,

1 - why do you want to rebuild your kernel ?
2 - I don't know your cross-compilation environment but:

Code: Select all

$ make oldconfig && make prepare
will build a kernel for YOUR host ! Not for the phone !

Generally speaking, cross-compiling a kernel needs the ARCH option on "make" command-line, something like that:

Code: Select all

$ make ARCH=arm oldconfig && make ARCH=arm prepare
3 - because you failed to build your kernel, its config is broken. Thus, building the "pcan" driver is no more possible.

Regards,

Stéphane
— Stéphane

mo_oin
Posts: 14
Joined: Wed 6. Aug 2014, 11:08

Re: PCAN on Android

Post by mo_oin » Wed 13. Aug 2014, 12:19

Hi,
i use

Code: Select all

export ARCH=arm
export CROSS_COMPILE=/path/to/android/gcc
should be the same as typing it with the make command, or not?

I will try it with again hopefully it solves problems.

greetings,

ray

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: PCAN on Android

Post by S.Grosjean » Wed 13. Aug 2014, 12:55

Hi,

If you export ARCH, so it's ok. If the version file is not found by pcan's Makefile, it's certainly because the kernel should be built.

First try to rebuild (make) your kernel.

Regards,

Stéphane
— Stéphane

Post Reply