Currently I am developing CAN Communication using AGX Xavier board and Can Bus Module(N65HVD230)
and then I could successfully receive the data from other ECU but I can’t send the data to target ECU
So I tried steps like below
(1) Reference the famous blogs
My Xavier CAN0 and CAN1 port was opend after setting the pin and changing the register values as in the Medium blog (Enabling CAN on Nvidia Jetson Xavier Developer Kit | by Ramin Nabati | Medium)
also I referenced the other site (Jetson/AGX Xavier CAN - eLinux.org) then also I could check surely opened CAN[0,1] port using ‘ifconfig’
Register values mapped
sudo busybox devmem 0x0c303000 32 0x0000C400
sudo busybox devmem 0x0c303008 32 0x0000C458
sudo busybox devmem 0x0c303010 32 0x0000C400
sudo busybox devmem 0x0c303018 32 0x0000C458
(2) The CAN Loopback Test was done successfully
(3) I connected CAN Bus Module CAN H&L wire with Target ECU then I could received intended data frames
but I couldn’t send my data frame to Target ECU
(4) Another Solutions
1) launching /opt/nvidia/.../ jetson-io.py -> enable CAN0 & CAN2 -> reboot(flash)
2) changing reg pins valued after reference recently published the Jetson AGX Xavier Technical Reference Manual on NVIDIA Developer site
Change case
2-1) *result: enabled RX
CAN D_OUT -> 0x0000C400
CAN D_IN -> 0x0000C458
2-2) *result: enabled RX
CAN D_OUT -> 0x0000C418
CAN D_IN -> 0x0000C458
2-2) *result: enabled nothing
CAN D_OUT -> 0x0000C418
CAN D_IN -> 0x0000C400
(5) Used linux can util (CANDUMP & CANSEND) and Wrote custom source C code to send data like below
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#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>
int main( int argc, char *argv){
int fd_can;
struct sockaddr_can addr;
struct can_frame frame;
int nbytes;
struct ifreq ifr;
int ifindex;
if ( 2 > argc){
printf( " ./can_sender can0\n");
exit( 0);
}
if ( 0 > ( fd_can = socket(PF_CAN, SOCK_RAW, CAN_RAW)) ) {
perror("socket");
return 1;
}
strcpy(ifr.ifr_name, argv[1]);
ioctl( fd_can, SIOCGIFINDEX, &ifr);
ifindex = ifr.ifr_ifindex;
addr.can_family = AF_CAN;
addr.can_ifindex = 0; /* bind to all interfaces */
if ( 0 > bind( fd_can, (struct sockaddr *)&addr, sizeof(addr)) ) {
perror("bind");
return 1;
}
frame.can_id = 0x5AF;
frame.can_dlc = 8;
frame.data[0] = 0x00;
frame.data[1] = 0x11;
frame.data[2] = 0x22;
frame.data[3] = 0x33;
frame.data[4] = 0x44;
frame.data[5] = 0x55;
frame.data[6] = 0x66;
frame.data[7] = 0x77;
addr.can_family = AF_CAN;
addr.can_ifindex = ifindex; /* send via this interface */
nbytes = sendto( fd_can, &frame, sizeof(struct can_frame), 0, (struct sockaddr*)&addr, sizeof(addr));
close( fd_can);
return 0;
}
and then tried change the line “socket(PF_CAN, SOCK_RAW, CAN_RAW))” to socket(PF_CAN, SOCK_DGRAM, CAN_BCM))
- As a Resultly I failed send datas and just I could watch the message “write: No buffer space available” on the terminal after send many times
Please look at the tired steps and find the defect or suggest solutions

