"can send" command over c++ (peak 4canM2)

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
elpimous12
Posts: 59
Joined: Tue 3. Aug 2021, 23:34

"can send" command over c++ (peak 4canM2)

Post by elpimous12 » Sun 26. Sep 2021, 11:16

Hello the team.
Do you have an example, to call the command "can send" on peak board on c++?
anything like this command : can send 800a 140501 ..

Thanks the team.
Vincent

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

Re: "can send" command over c++ (peak 4canM2)

Post by M.Maidhof » Mon 27. Sep 2021, 09:59

Hi,

which PEAK hardware do you use (serial number)? Please post the output of "cat /proc/pcan", "uname -a" and "ip a"

regards

Michael

elpimous12
Posts: 59
Joined: Tue 3. Aug 2021, 23:34

Re: "can send" command over c++ (peak 4canM2)

Post by elpimous12 » Mon 27. Sep 2021, 18:37

Hello Mickael, here is the return of your requests :

** external link removed by ADMIN *

Code: Select all

customer@pc:~$ cat /proc/pcan
 
*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20210505_n (8.12.0) Aug 31 2021 17:59:40 --------------
*---------------------------- [mod] [pci] [pec] -----------------------------
*--------------------- 4 interfaces @ major 236 found -----------------------
*n -type- -ndev- --base-- irq --btr- --read-- --write- --irqs-- -errors- status
 0  pcifd   -NA- 80b71000 016 0x001c 00000000 00000000 00000000 00000000 0x0000
 1  pcifd   -NA- 80b72000 016 0x001c 00000000 00000000 00000000 00000000 0x0000
 2  pcifd   -NA- 80b73000 016 0x001c 00000000 00000000 00000000 00000000 0x0000
 3  pcifd   -NA- 80b74000 016 0x001c 00000000 00000000 00000000 00000000 0x0000
 
customer@pc:~$ uname -a
Linux  5.4.0-1-generic #0~upboard2-Ubuntu SMP Sun Oct 25 14:06:23 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

customer@pc:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp3s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 00:07:32:74:c5:81 brd ff:ff:ff:ff:ff:ff
3: enp6s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 00:07:32:7e:77:76 brd ff:ff:ff:ff:ff:ff
4: eno1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 00:07:32:7e:77:75 brd ff:ff:ff:ff:ff:ff
5: wlp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether bc:17:b8:c1:10:83 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.47/24 brd 192.168.1.255 scope global dynamic noprefixroute wlp4s0
       valid_lft 42721sec preferred_lft 42721sec
    inet6 2a01:e0a:38b:1970::83c1:abdb/128 scope global dynamic noprefixroute 
       valid_lft 85924sec preferred_lft 85924sec
    inet6 fe80::2221:b43c:22ab:4ef2/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
customer@pc:~$ 

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

Re: "can send" command over c++ (peak 4canM2)

Post by M.Maidhof » Tue 28. Sep 2021, 11:16

Hi,

when using a kernel version 5.x and you want to use the SocketCAN tools (cansend, candump etc.) please uninstall the peak-linux driver and reboot once, so that the card can be used by the kernel internal NetDev driver:

- goto the peak-linux-driver-8.12 directory and call: sudo make uninstall
- sudo reboot
- check with ip a that there are can0 to can3 netdevices available
- install the can-utils with apt
- configure the canx devices to your needs with sudo ip link set ........(see SocketCAN documentation for more details: https://www.kernel.org/doc/Documentatio ... ng/can.txt)
- see the help of the can-utils applications for more details how to use them, or how to write own applications for SocketCAN.

regards

Michael

elpimous12
Posts: 59
Joined: Tue 3. Aug 2021, 23:34

Re: "can send" command over c++ (peak 4canM2)

Post by elpimous12 » Tue 28. Sep 2021, 12:35

Big thanks Michael.
Exactly what I needed. 👌

Post Reply