A TCP tunnel over CAN bus FD (Flexible Data-rate) involves encapsulating TCP/IP packets within CAN FD frames to enable communication between TCP/IP networks using the CAN FD physical layer.
Implementing a TCP tunnel over CAN bus FD can be advantageous for several reasons:
- Legacy System Integration: Many industrial and automotive systems use CAN bus for communication. Implementing a TCP tunnel allows modern TCP/IP-based devices to integrate seamlessly with these existing systems, extending their functionality without requiring complete system overhauls.
- Cost Efficiency: Utilizing the existing CAN bus infrastructure avoids the need for additional networking hardware, reducing costs. This is particularly beneficial in environments where adding new cabling or network equipment is impractical or expensive.
- Increased Data Transfer Rates: CAN FD (Flexible Data-rate) allows for higher data rates and larger payload sizes compared to standard CAN, enabling more efficient data transfer. This makes it feasible to transport TCP/IP packets, which are typically larger, over the CAN network.
- Robustness and Reliability: CAN bus is known for its robustness in noisy environments, making it suitable for industrial and automotive applications. By tunneling TCP over CAN FD, you can leverage CAN's reliability while enabling more complex TCP/IP communications.
- Real-time Communication: CAN bus offers deterministic communication, which is crucial for real-time systems. Implementing a TCP tunnel over CAN FD can ensure that time-sensitive data is transmitted reliably, combining the benefits of real-time CAN communication with the versatility of TCP/IP.
- Interoperability: Creating a TCP tunnel over CAN FD allows different subsystems or components within a vehicle or industrial setup to communicate using standard TCP/IP protocols. This interoperability can simplify system integration and enhance overall functionality.
- Security: Tunneling TCP over CAN FD can add an additional layer of security. The encapsulated TCP/IP packets are not directly accessible over the network, reducing the attack surface for potential cyber threats.
- Flexibility: This approach provides flexibility in network design, allowing developers to leverage the strengths of both TCP/IP and CAN FD. It facilitates communication between different types of networks and devices within a single system.
Overall, implementing a TCP tunnel over CAN bus FD combines the reliability and real-time capabilities of CAN FD with the widespread compatibility and functionality of TCP/IP, making it a powerful solution for various industrial and automotive applications.
Here's a simplified description of how it worksEncapsulation: TCP/IP packets are encapsulated within CAN FD frames. This process involves breaking down the larger TCP/IP packets into smaller chunks that fit within the CAN FD frame size limits.Transmission: These CAN FD frames are transmitted over the CAN bus. CAN FD allows for higher data rates and larger data payloads compared to the standard CAN protocol, making it more suitable for this purpose.
Reception: On the receiving end, the CAN FD frames are collected and reassembled into the original TCP/IP packets.Decapsulation: The reassembled TCP/IP packets are then processed by the receiving TCP/IP stack, completing the tunnel process.
SYSTEM IMPLEMENTATION
This tutorial implements a point-to-point connection between a couple of Raspberry Pi through a couple of CAN Bus FD V1.4 boards. This setup allows devices using TCP/IP to communicate over a CAN bus network, leveraging the robustness and real-time capabilities of CAN FD.
The SW side is implemented by ISOTPTUN a tool of can-utils, before to proceed over install the following packet
sudo apt-get install can-utils
Instal and test the can bus functionality as described in this link.
On Raspberry Router open two different terminals, on first write
sudo isotptun -s 124 -d 421 -v can1
Data from Router are sent with ID 124, instead data from Device are received on ID 421. The can interface is CAN1.
On second terminal of Raspberry Router write
sudo ifconfig ctun0 192.168.8.1 pointopoint 192.168.8.2 up
On Raspberry Device open two different terminals
sudo isotptun -s 421 -d 124 -v can1
Data from Device are sent with ID 421, instead data from Router are received on ID 124. The can interface is CAN1.
On second terminal of Raspberry Device write
sudo ifconfig ctun0 192.168.8.2 pointopoint 192.168.8.1 up
Ping the device board (on second terminal)
ping 192.168.8.2
Ping the router (on second terminal)
ping 192.168.8.1
Comments