questions on PCANbasic on Linux (Raspberry Pi)
Posted: Fri 23. Aug 2024, 00:29
Hello,
I am trying to develop an application based on Linux driver on Raspberry Pi 3B using PEAK PCAN-USB Pro.
Attached are the pictures of both sides of the product I am using.
The questions are:
1. After installing the driver of netdev mode and connecting the device, both chardev node in /dev and netdev link from "ip link show" seem available. Is it normal or something is wrong?
The attached photo pcan-devices.png shows this.
2. When using the C example from the package PCAN-Basic_Linux-4.8.0.5.tar.gz downloaded from this link https://www.peak-system.com/PCAN-Basic.239.0.html?&L=1 to write and read CAN messages (use CAN1 to read and CAN2 to write), I can see these as in attached picture pcan-read-write.png.
a) number of read and write are increasing
b) both channels are active with the same data rate
c) messages on the bus on both channels (from scope)
But the function CAN_read always return empty.
What might be the cause of this?
3. When calculating bit rate, the attached picture pcan-canfd-bitrate.png shows what's in the help document.
It seems the formula is bit_rate = (clock_frequency)/(prescaler * (nom_tse1 + nom_tseg2 + nom_sjw)). Is it the correct formula that data_sjw is also involved in the calculation?
4. Any example for the application which uses socketCAN to read and write?
Thanks!
Crane
I am trying to develop an application based on Linux driver on Raspberry Pi 3B using PEAK PCAN-USB Pro.
Attached are the pictures of both sides of the product I am using.
The questions are:
1. After installing the driver of netdev mode and connecting the device, both chardev node in /dev and netdev link from "ip link show" seem available. Is it normal or something is wrong?
The attached photo pcan-devices.png shows this.
2. When using the C example from the package PCAN-Basic_Linux-4.8.0.5.tar.gz downloaded from this link https://www.peak-system.com/PCAN-Basic.239.0.html?&L=1 to write and read CAN messages (use CAN1 to read and CAN2 to write), I can see these as in attached picture pcan-read-write.png.
a) number of read and write are increasing
b) both channels are active with the same data rate
c) messages on the bus on both channels (from scope)
But the function CAN_read always return empty.
What might be the cause of this?
3. When calculating bit rate, the attached picture pcan-canfd-bitrate.png shows what's in the help document.
It seems the formula is bit_rate = (clock_frequency)/(prescaler * (nom_tse1 + nom_tseg2 + nom_sjw)). Is it the correct formula that data_sjw is also involved in the calculation?
4. Any example for the application which uses socketCAN to read and write?
Thanks!
Crane