Does anyone know the CAN settings to read a 500 kHz baudrate CAN signal? Thanks for your help?
Additional questions from Alexander:
The final question is how is the data stored when using the canecho command, meaning was is the variable type and name when the canecho command is used?
Please use pages 46 and 47 as a reference to set the timing, let us know if you have issues and I'll ask the CAN experts to comment.
You don't need to install the libraries, just copy them to your file system.
You can check you the source code for the CAN packages by typing:
- $ ./ltib -m prep -p <package>
The source will be extracted to <ltib install>/rpm/BUILD/<pkg name>
I tried to set the timing, but every I always get an error saying, "Unable to get bitrate." I can set no parameters for the CAN bus. Is there anyway to set the parameters using the canconfig command.
Could you share the commands you are using? Just paste the commands you are issuing on the terminal and the output you are getting?
I am trying to set the baudrate of the CAN signal. The baudrate needs to be 500 kHz. I use the command:
canconfig can0 bitrate 500000
Please double check that your CAN driver is up and running by executing the below command:
> ip link show can
If any of the CAN interfaces is up, the procedure to configure the bitrate is as follows:
-echo 125000 >> /sys/devices/platform/FlexCAN.0/bitrate(this command sets CAN0 interface to run at 125Kbps, to setup CAN1 interface use the same command above but changing FlexCAN.0 to FlexCAN.1)-ip link set canX up(the X needs to be replaced by the can interface to use. E.g can0 or can1)-cantest can0 121#DEADBEEF(cantest utility needs to be selected from: ltib->package list)To listen messages from CAN, please run the below command:-cantest can0 &(this command will put the can0 to listen from any incoming messages from CAN bus)After using this configuration settings, you should be able to see CAN framesBtw, which BSP release are you using?
I use the ip link show command and it display which can buses were running so I think I install the can utilities correctly. However,I tried to use the cantest command but I get an error saying "command not found." I looked in the can utilities file and could not find any files relating to the cantest command. Do I need a different can utilities?
I however used to settings provided by the workshop and I was abl to read CAN frames at 33 kHz baud rate. The configurations for the 33 kHz baud rate were:
ifconfig can0 downecho 99 > /sys/devices/platform/FlexCAN.0/br_presdivecho 8 > /sys/devices/platform/FlexCAN.0/br_propsegecho 8 > /sys/devices/platform/FlexCAN.0/br_pseg1echo 3 > /sys/devices/platform/FlexCAN.0/br_pseg2echo 3 > /sys/devices/platform/FlexCAN.0/br_rjwls -lha /sys/devices/platform/FlexCAN.0/br*cat /sys/devices/platform/FlexCAN.0/br*ifconfig can0 up
I do not know where to find the settings for the 500 kHz baudrate though. I can not find the prescaler, prop_seg, Phase_seg1, or Phase_seg2. If you how I can find theses values then I think I can read the CAN frames using canecho command.Thanks for your help.
The cantest tool need to be selected in the package list from ltib tool:
-- Package Selection
Package List -->
The easiest way to configured the CAN interface to run at 500Kbps is to select the below options in the kernel menuconfig:
In Ltib choose the option:
[*] Configure Kernel
then run the ltib by typing ./ltib
A new window (Kernel Menu) will open:
[*] Networking Support --->
[*] CAN bus subsystem support --->
CAN Device Drivers --->
[*] CAN bit-timing calculation
WIth that option selected, the dirver will solve the br_* values by itself. The next step you need to perform is just to write the below command:
echo 500000 >> /sys/devices/platform/FlexCAN.0/bitrate
ifconfig can0 up
After executing the above command you can consult all the br_* parameters by:
Hope this information helps.
Retrieving data ...