Can communication via Jetson Tx2 and Olimaxino stm32

Hello everyone,

I have an olimaxino stm32 board and I have connected that via can modules with the Jetson tx2 board.I would like to run a c++ code in Jetson tx2 terminal (real time-continiously) and send this message to olimaxino stm32 board.For that purpose I use a SN65HVD230 transceiver.

I have followed the below task but I can not manage that.Any idea?
https://devtalk.nvidia.com/default/topic/1030192/transmit-messages-using-can-in-a-c-code/

Hi,
I would like to know where exactly are you facing issue? Is your code not transmitting messages? Or without using code also, you are unable to communicate?
Please try once to communicate without code using CAN commands and if it is successful, then the problem will be in code, then we will be able to figure out issue.
Please share exact steps which you will use, it will be helpful for debugging.

Thanks,
Shubhi

Hi,

I am giving the command cansend can0/can1 canid#ff and I recieve the signal in olimaxino board.The problem is with my code as I understood.
Inside the code there are the values of x and y that I want sent to the olimaxino board and I am trying to modify.

These are:
int x = (markerCorners[i][0].x + markerCorners[i][1].x + markerCorners[i][2].x + markerCorners[i][3].x)/4;
int y = (markerCorners[i][0].y + markerCorners[i][1].y + markerCorners[i][2].y + markerCorners[i][3].y)/4;

So is the problem resolved? If not, then to identify what is going wrong , you need to send code and error prints, am not able to understand exactly where are you facing issue? Please help me by providing more details.

I have not solved the problem. Inside the code that I am running,I add the commands at the start as to activate the port Can0

sudo modprobe can
sudo modprobe can_raw
sudo modprobe can_dev
sudo modprobe mttcan
sudo ip link set can0 type can bitrate 500000 dbitrate 2000000 berr-reporting on fd on
sudo ip link setup can0

and in the middle of the code I have to modify the code as to send the x and y values in the olimaxino board
int x = (markerCorners[i][0].x + markerCorners[i][1].x + markerCorners[i][2].x + markerCorners[i][3].x)/4;
int y = (markerCorners[i][0].y + markerCorners[i][1].y + markerCorners[i][2].y + markerCorners[i][3].y)/4;

This part is difficult for me.Also I do not know if it is correct to activate the port inside the code.I would like to tell me if I am right.

Hi,

Sorry for the delay. Are you still facing the problem? You cannot activate CAN ports in your C code. You can do that via bash scripts on device by using the same commands:
sudo modprobe can
sudo modprobe can_raw
sudo modprobe can_dev
sudo modprobe mttcan
sudo ip link set can0 type can bitrate 500000 dbitrate 2000000 berr-reporting on fd on
sudo ip link setup can0

Further, if you want to send x and y values, we generally send CAN_ID and data in below format to device which actually is driven by mttcan driver.
CAN_ID#DATA
Ex. cansend can0 123#abcdabcd
Similarly you can send x and y values which will further get modified from your driver code. You can modify mttcan driver as well for your test purpose.
Let me know if you are facing any issues.

Thanks,
Shubhi