Hi Ravi, Also, have you tried adding CAN_EFF_FLAG to the can_id in a logical OR?
Chris -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Chris Verges Sent: Tuesday, December 01, 2009 8:16 PM To: Ravi Kumar Madhuranthakam; [email protected] Subject: Re: [Socketcan-users] FW: CAN Id is trucated Hi Ravi, First, apologies for the top-posting. Tis the mail reader that I'm forced to use at the moment. I too am using the AT91 SocketCAN driver with extended IDs. Everything seems to work fine in our application. What version of the kernel and/or SocketCAN drivers are you using? Also, how are the extended IDs being truncated? Chris From: [email protected] [mailto:[email protected]] On Behalf Of Ravi Kumar Madhuranthakam Sent: Tuesday, December 01, 2009 8:08 PM To: [email protected] Cc: Ravi Kumar Madhuranthakam Subject: [Socketcan-users] FW: CAN Id is trucated HI , I am using socket CAN with Atmel 9263 board , And CAN Messages Extended ID is truncated when I send message using PCAN USB- analyzer . I am using read and write calls for message sending and receiving in the board. I am not using any filters and using CAN_RAW . Anybody has idea on this issue ? My Code looks like this #include <sys/types.h> #include <sys/socket.h> #include <sys/ioctl.h> #include <net/if.h> #include <linux/can.h> #include <linux/can/raw.h> #include <string.h> /* At time of writing, these constants are not defined in the headers */ #ifndef PF_CAN #define PF_CAN 29 #endif #ifndef AF_CAN #define AF_CAN PF_CAN #endif /* ... */ /* Somewhere in your app */ /* Create the socket */ int skt = socket( PF_CAN, SOCK_RAW, CAN_RAW ); /* Locate the interface you wish to use */ struct ifreq ifr; strcpy(ifr.ifr_name, "can0"); ioctl(skt, SIOCGIFINDEX, &ifr); /* ifr.ifr_ifindex gets filled * with that device's index */ /* Select that CAN interface, and bind the socket to it. */ struct sockaddr_can addr; addr.can_family = AF_CAN; addr.can_ifindex = ifr.ifr_ifindex; bind( skt, (struct sockaddr*)&addr, sizeof(addr) ); /* Send a message to the CAN bus */ struct can_frame frame; frame.can_id = 0x123; strcpy( &frame.data, "foo" ); frame.can_dlc = strlen( &frame.data ); int bytes_sent = write( skt, &frame, sizeof(frame) ); /* Read a message back from the CAN bus */ int bytes_read = read( skt, &frame, sizeof(frame) ); ________________________________________ http://www.mindtree.com/email/disclaimer.html _______________________________________________ Socketcan-users mailing list [email protected] https://lists.berlios.de/mailman/listinfo/socketcan-users _______________________________________________ Socketcan-users mailing list [email protected] https://lists.berlios.de/mailman/listinfo/socketcan-users
