transmittest not working (receivetest works)

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
youngbo
Posts: 3
Joined: Wed 27. Dec 2017, 13:27

transmittest not working (receivetest works)

Post by youngbo » Wed 27. Dec 2017, 13:58

I've build version 8.5.1 of the linux driver, by means of:
make
sudo make install
sudo modprobe pcan

I have 120 Ohms termination in my CAN cables.

Unfortunately, I can receive messages but can't transmit. I faced CAN status is BUSOFF.
What should I check?

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

Re: transmittest not working (receivetest works)

Post by S.Grosjean » Wed 27. Dec 2017, 14:06

Hi,

Please give us the results of:

$ cat /proc/pcan

$ uname -a

and tell us a bit more on how do you use the transmittest program, please.

Regards,

Stéphane
— Stéphane

youngbo
Posts: 3
Joined: Wed 27. Dec 2017, 13:27

Re: transmittest not working (receivetest works)

Post by youngbo » Wed 27. Dec 2017, 14:37

$ uname -a

Image
https://ibb.co/d2o26b

This picture is the result of using pcanread in pcanbasic and $ cat /proc/pcan.

Image
https://ibb.co/cH7Umb

This picture is the result of using pcanwrite in pcanbasic and $ cat /proc/pcan.

Image
https://ibb.co/c8ZaRb

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

Re: transmittest not working (receivetest works)

Post by S.Grosjean » Wed 27. Dec 2017, 15:20

Hi,

Thanks. So it looks like you're having access to the CAN bus with a PCAN-USB at 500 kbps, right?

Regarding the "status" column, we don't see any BUSOFF status but 0x3 says that the Tx queue of the driver and the controller are full.

Next, you've asked about an issue with transmittest, so we first need to know how you use it: which parameters do you put on the command line, please ?

Finally, try this command please:

Code: Select all

$ pcanfdtst tx -b 500k -n 100 -i 0x2b1 -I 8 /dev/pcanusb32
This command writes 100x CAN frames with ID=0x2b1 (like yours) and 8 data bytes over the CAN bus through the PCAN-USB setup to connect with bitrate=500 kbps.

Regards,

Stéphane
— Stéphane

youngbo
Posts: 3
Joined: Wed 27. Dec 2017, 13:27

Re: transmittest not working (receivetest works)

Post by youngbo » Thu 28. Dec 2017, 04:15

Thank you for your comment.

I did what you asked me to try($ pcanfdtst tx -b 500k -n 100 -i 0x2b1 -I 8 /dev/pcanusb32). As a result, a message is sent but it seems not to be received by the receiver.


Also, I tried sending and receiving messages through PCAN-VIEW on Windows and it works correctly.

I tested using the example 'pcanwrite' in PCAN-Basic, as follows:

Image
https://ibb.co/j5L3xG

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

Re: transmittest not working (receivetest works)

Post by S.Grosjean » Thu 28. Dec 2017, 10:02

Hello,

Ok, AFAIU the status column 0x53 shows the BUSOFF state. So there's something wrong on your CAN bus.

Please verify each node connected to the bus and their bitrate. Notice that if there's only one other node on the bus, it MUST not be setup in Listen Only mode. Verify each piece of cable of your bus. Be sure to have two resistors (only) on each end.

To help to fix on the software side, your recent kernel includes some other driver that is compatible with the PCAN-USB. Please do the following commands:

Code: Select all

$ sudo rmmod pcan
$ sudo apt-get install can-utils
$ sudo modprobe peak_usb
$ dmesg | grep peak
You should see something like:

Code: Select all

[ 1123.160528] peak_usb 3-9.2:1.0 can0: attached to PCAN-USB channel 0 (device XX)
Then, type:

Code: Select all

$ sudo ip link set can0 up type can bitrate 500000
$ cansend can0 2b1#0011223344556677
This last line writes the frame ID=0x2b1 with data=[00 11 22 33 44 55 66 77]. You can repeat that line as many times as you like. Tell us if it works better. Then, type:

Code: Select all

$ ip -s -d link show can0
and give us the result please.

Regards,

Stéphane
— Stéphane

Post Reply