This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Dear
IC: am3352
SDK version: 05.01.00.11
Problem Description:
when using am3352 to upgrade other modules through can bus, According to software design,data are sented every 1ms.
On the am3352, the can message is sent through the timer every 1ms. By the captured can bus message, the message cycle varies.
Occasionally, the interval between two frames is more than 100ms, up to 600ms at most.
It seems that the interval time between two frame of can is uncontrolled, but I hope that the interval time short than 100ms.
What's the reasone about the issue? or any suggestion to fix the issue?
Thanks
Yunxue Wang
Hello Yunxue Wang,
Thank you for the query.
I will check internally and get back to you
Regards
Rajashri
Hello Yunxue Wang,
I am checking with the CAN expert internally if the time variation(100ms, up to 600ms) between two frames is expected.
I am also checking if there is a way to improve the delay between frames.
I will update you based on the inputs received
Regards
Rajashri
Hello Rajashri
Any suggest have now?
Our products are close to the shipping node, but now the can communication delay is large,
resulting in a great risk to the shipping schedule. If you can help solve this problem,
it will be of great help to our company.
Yunxue Wang
Hello Yunxue Wang,
Please check with the current version of SDK (08.02.00.24).
SDK path - PROCESSOR-SDK-AM335X Software development kit (SDK) | TI.com
Regards
Rajashri
Hello Rajashri
It is recommended to use this version of SDK or which part of the SDK is more efficient to investigate?
Thanks
Yunxue Wang
Hello Yunxue Wang,
I have already shared your inputs with our CAN team to check on this.
Regards
Rajashri
Hi,
Could you please post the results of these commands?
ifconfig -a
ip -d -s link show can0 ( I have assumed for the moment that the interface is can0)
cat /proc/net/can/stats
Could you please describe the application SW that you are using to send the CAN frames with? What is the target device and the SW that is running on it?
Best Regards,
Schuyler
HI
■the result of [ifconfig -a] is as following:
■the result of [ip -d -s link show can0] is as following:
■the result of [cat /proc/net/can/stats] is as following:
■send the CAN frames
I use socketCAN send can frames, some options is as following:
struct sockaddr_can addr;
struct ifreq ifr;
struct can_frame frame[2] = {{0}};
s = socket(PF_CAN, SOCK_RAW, CAN_RAW);
strcpy(ifr.ifr_name, "can0" );
ioctl(s, SIOCGIFINDEX, &ifr);
addr.can_family = AF_CAN;
addr.can_ifindex = ifr.ifr_ifindex;
bind(s, (struct sockaddr *)&addr, sizeof(addr));
setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER, NULL, 0);
and transmit the data by write function in while(1) as following:
nbytes = write(s, &frame[0], sizeof(frame[0]));
★Please refer to the attachment for the source code of can send frame
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <net/if.h> #include <sys/ioctl.h> #include <sys/socket.h> #include <linux/can.h> #include <linux/can/raw.h> void boot_can_config() { system("ip link set can0 down"); system("ip link set can0 type can bitrate 500000"); system("ip link set can0 up"); } void can_load_config(void) { boot_can_config(); } int System_Check(int result) { if((-1 != result) && (WIFEXITED(result)) && (!(WEXITSTATUS(result)))) return 0; else return -1; } int can_send() { int s, nbytes; struct sockaddr_can addr; struct ifreq ifr; struct can_frame frame[2] = {{0}}; s = socket(PF_CAN, SOCK_RAW, CAN_RAW);//create socket strcpy(ifr.ifr_name, "can0" ); ioctl(s, SIOCGIFINDEX, &ifr); // can0 addr.can_family = AF_CAN; addr.can_ifindex = ifr.ifr_ifindex; bind(s, (struct sockaddr *)&addr, sizeof(addr));//bind can0 setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER, NULL, 0); frame[0].can_id = 0x19B; frame[0].can_dlc = 8; frame[0].data[0] = 'B'; frame[0].data[1] = 'I'; frame[0].data[2] = 'O'; frame[0].data[3] = 'K'; frame[0].data[4] = '!'; frame[0].data[5] = '!'; frame[0].data[6] = '!'; frame[0].data[7] = '!'; while(1) { //send can frame nbytes = write(s, &frame[0], sizeof(frame[0])); //send frame[0] if(nbytes != sizeof(frame[0])) { printf("Send Error frame[0]\n!"); } usleep(2000); //2ms } close(s); return 0; } int main() { can_load_config(); can_send(); return 0; }
Now I send can frames by the function of can_send_demo.c on AM3352, and PC side gets the can frames by PCan(a device of equipment which connect to the can bus and analysis the data),it's a so sample function, but some interval between two frames are more than 100ms.
Thanks
Yunxue Wang