c++ receivetest error: Resource temporarily unavailable

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
JokEtx
Posts: 3
Joined: Thu 20. Sep 2018, 08:25

c++ receivetest error: Resource temporarily unavailable

Post by JokEtx » Thu 20. Sep 2018, 10:43

Hi all,

I am trying to test the receivetest c++ example in an ARM board, and when running it I receive a 'Resource temporarily unavailable' in LINUX_CAN_Read() function.

So, I am going to explain the environment and all the steps I have done:
I have:
- An ARM board with own Linux distribution created with Yocto Project 1.6.
- PCAN-USB X6
- PCAN-USB

First of all, I have cross-compiled and installed the Peak Linux Drivers in my ARM board (v8.6.0 http://layers.openembedded.org/layerind ... peak-linux ). The drivers are loaded properly in my board (checked with 'lsmod | grep pcan').
The second step has been to crosscompile and install receivetest example on the board. Crosscompiled and installed without errors, time to test it.

I have connected the PCAN-USB from the laptop to PCAN-USB X6 and the PCAN-USB X6 to the ARM board. I am transmitting a message every second to the PCAN-USB X6 using the PCAN-View software ( configured to 500kBit/s) (see the attached picture). Status is OK in PCAN-View
I have also upped the interface in my board (ip link set can2 up type can bitrate 500000). The green LED of the CAN1 is blinking quickly, so data is transmitted via the connected CAN bus. If I do candump can2 the message is there every second.

So I run the receive_test example like this way: can_receive_test -f="/dev/pcan-usb_x6/0/can0" -e -n=100 , and the output of the program is the next one:

receivetest Version "Release_20150611_n" (http://www.peak-system.com)
------- Copyright (C) 2004-2009 PEAK System-Technik GmbH ------
receivetest comes with ABSOLUTELY NO WARRANTY. This is free
software and you are welcome to redistribute it under certain
conditions. For details see attached COPYING file.

receivetest: device node="/dev/pcan-usb_x6/0/can0"
Extended frames are accepted, init with 500 kbit/sec.
receivetest: driver version = Release_20180720_n
receivetest: LINUX_CAN_Read(): Resource temporarily unavailable
receivetest: type = usbfd
Serial Number = 0x18392e0b
Device Number = 0
count of reads = 0
count of writes = 0
count of errors = 0
count of irqs = 2727
last CAN status = 0x0020
last error = 0
open paths = 2
driver version = Release_20180720_n
receivetest: finished (11): 0 message(s) received


I also attach the output of cat /proc/pcan:
*------------- PEAK-System CAN interfaces (http://www.peak-system.com) -------------
*------------- Release_20180720_n (8.6.0) Sep 13 2018 13:35:15 --------------
*---------------- [mod] [isa] [pci] [pec] [dng] [usb] [net] -----------------
*--------------------- 6 interfaces @ major 246 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32 usbfd can2 18392e0b 000 0x001c 000014e6 00000000 000014d3 00000000 0x0000
33 usbfd can3 18392e0b 000 0x001c 00000000 00000000 00000000 00000000 0x0000
34 usbfd can4 18392e0b 000 0x001c 00000000 00000000 00000000 00000000 0x0000
35 usbfd can5 18392e0b 000 0x001c 00000000 00000000 00000000 00000000 0x0000
36 usbfd can6 18392e0b 000 0x001c 00000000 00000000 00000000 00000000 0x0000
37 usbfd can7 18392e0b 000 0x001c 00000000 00000000 00000000 00000000 0x0000


What am I doing wrong?

Thank you in advance.

Best,

Jokin

(Edit by ADMIN - resize Picture)
Attachments
IMG_20180920_101807_659.jpg
IMG_20180920_101807_659.jpg (111.37 KiB) Viewed 5806 times

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: c++ receivetest error: Resource temporarily unavailable

Post by M.Maidhof » Thu 20. Sep 2018, 14:01

Hi,

you have generated a Netdev driver (see can2 to 7 in /proc/pcan). To use the receivetest software, you need a Chardev driver interface. Please rebuild and reload the driver as chardev, to solve that problem.

regards

Michael

JokEtx
Posts: 3
Joined: Thu 20. Sep 2018, 08:25

Re: c++ receivetest error: Resource temporarily unavailable

Post by JokEtx » Mon 24. Sep 2018, 08:42

Hi Michael,

I have compiled a project with SocketCan and know I can read the messages without problem.

Thank you for your fast response.

Best,

Jokin

JokEtx
Posts: 3
Joined: Thu 20. Sep 2018, 08:25

Re: c++ receivetest error: Resource temporarily unavailable

Post by JokEtx » Mon 1. Oct 2018, 17:18

Hi,

I have now problems with writing messages through the CAN. Our device has two native CAN port integrated, and if I run my code using one of those native CAN ports, I can visualize the messages I send in the 'Receive Tab' of PCAN-View.

But, If i try to send the message via the PCAN-USB X6, I get a 'write: No buffer space available'.
Output of cat /proc/pcan is:

*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20180720_n (8.6.0) Sep 13 2018 13:35:15 --------------
*---------------- [mod] [isa] [pci] [pec] [dng] [usb] [net] -----------------
*--------------------- 6 interfaces @ major 246 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32 usbfd can2 18392e0b 000 0x011c 00001405 00000000 000013fb 00000000 0x0000
33 usbfd can3 18392e0b 000 0x011c 00000000 00000000 00000000 00000000 0x0000
34 usbfd can4 18392e0b 000 0x011c 00000000 00000000 00000000 00000000 0x0000
35 usbfd can5 18392e0b 000 0x011c 00000000 00000000 00000000 00000000 0x0000
36 usbfd can6 18392e0b 000 0x011c 00000000 00000000 00000000 00000000 0x0000
37 usbfd can7 18392e0b 000 0x011c 00000000 00000000 00000000 00000000 0x0000

Thank you in advance,

Best,

Jokin

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: c++ receivetest error: Resource temporarily unavailable

Post by M.Maidhof » Mon 1. Oct 2018, 17:27

Hi,

which appliction do you use under LInux? Which lib do you call?
For me it looks like you still try to use a pcan lib or pcanbasic lib application with a netdev driver. As written above, you need to generate a chardev driver to use the chardev libs.

regards

Michael

Post Reply