Transmit messages using CAN in a C++ code

Hi ,

I want to transmit data from NVIDIA JETSON TX2 using CAN from the transciever to the CAN bus and finally to the canalyser.
The data to be transmitted using CAN should be through a C++ code.
I did download sources from the link - https://developer.nvidia.com/embedded/dlc/l4t-sources-28-1
But the path - /sources/kernel/t18x/drivers/net/can/mttcan/native/ has missing declarations or definitions cause of which I am unable to call and use the functions on my C++ code.

Kindly help.

Thanks,
Pratosha

Kindly help on the above

Hi Pratosha,

Please provide some more clarity on your doubt.

If you are looking for the CAN driver to be in C++
or it is you are going to use something on top of can device driver which would be in C++.

If you are looking for a driver to be in C++ for linux kernel, thn AFAIK, it is still not available open source for CAN.

Or if you are trying to automate inserting the modules and setting up can interfaces and initiating the communication, thn it can be done using a script.

Please let us know if your doubt is not related to this.

Thanks & Regards,
Sandipan

Hi Spatra,

Thanks for your response.
I am looking for transmitting messages from CAN through a C++ code.
Yes if there is a script for setting up can interfaces and initiating the communication that would be of great help :)

Thanks,
Pratosha

Kindly help.

I am looking for transmitting messages from CAN through a C++ code.

There’s several examples on using SocketCAN with the Nvidia Jetson TX2.

https://devtalk.nvidia.com/default/topic/1011148/enable-can-bus-on-jetson-tx2/?offset=5
https://devtalk.nvidia.com/default/topic/1006762/how-can-i-use-can-bus-in-tx2-/

https://en.wikipedia.org/wiki/SocketCAN
https://elinux.org/CAN_Bus
http://blog.mbedded.ninja/programming/operating-systems/linux/how-to-use-socketcan-with-c-in-linux

Hi david_evans_g,

Thanks for your response.
Yes I am trying to fix it with the links provided. Will surely get back on this.

Thanks,
Pratosha