This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
app-notes:can-tcpsockets-parsing [2019/07/03 08:00] – ↷ Page moved from internal:can-tcpsockets-parsing to app-notes:can-tcpsockets-parsing juraschek | app-notes:can-tcpsockets-parsing [2021/08/04 09:14] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== Environment setup ===== | ===== Environment setup ===== | ||
- | {{:internal: | + | {{: |
The above graphic illustrates how the test environment was setup and what data gets transmitted. First to be able to simulate a CAN bus in a local environment PC1 runs [[https:// | The above graphic illustrates how the test environment was setup and what data gets transmitted. First to be able to simulate a CAN bus in a local environment PC1 runs [[https:// | ||
Line 10: | Line 10: | ||
To use the CAN Interface on the Router first you need to enable the CAN Interface with the correct Bitrate (250kBits used). | To use the CAN Interface on the Router first you need to enable the CAN Interface with the correct Bitrate (250kBits used). | ||
- | {{:internal: | + | {{: |
===== Peaksystem PCAN-FMS Simulator ===== | ===== Peaksystem PCAN-FMS Simulator ===== | ||
Line 21: | Line 21: | ||
By default, candump provides the following information: | By default, candump provides the following information: | ||
- | {{:internal: | + | {{: |
Interface, CAN Identifier, DLC and DATA | Interface, CAN Identifier, DLC and DATA | ||
===== Forward CAN Frames over TCP Sockets (can-tcp-broadcast.are) ===== | ===== Forward CAN Frames over TCP Sockets (can-tcp-broadcast.are) ===== | ||
- | To show a possible use of forwarding CAN Frames over Ethernet can-tcp-broadcast.are provides a TCP client that broadcasts all incoming CAN Frames to one or several servers that can be passed as arguments. The SDK API already provides several functions to interact with CAN (see ftp:// | + | To show a possible use of forwarding CAN Frames over Ethernet can-tcp-broadcast.are provides a TCP client that broadcasts all incoming CAN Frames to one or several servers that can be passed as arguments. The SDK API already provides several functions to interact with CAN (see https:// |
The function start_can() sets required attributes to the can interface and sets up a raw socket descriptor that is used in the main part of the script. Additionally filtering of CAN Identifiers is possible via nb_can_setfilter() to specify which CAN frames shall be filtered out and which shall be passed to upper layers. | The function start_can() sets required attributes to the can interface and sets up a raw socket descriptor that is used in the main part of the script. Additionally filtering of CAN Identifiers is possible via nb_can_setfilter() to specify which CAN frames shall be filtered out and which shall be passed to upper layers. | ||
Line 96: | Line 96: | ||
On the receiving end SocketTest listens on TCP port 2000 and displays the raw CAN frames: | On the receiving end SocketTest listens on TCP port 2000 and displays the raw CAN frames: | ||
- | {{:internal: | + | {{: |
===== Simple CAN Frame parsing (simple-can-parser.are) ===== | ===== Simple CAN Frame parsing (simple-can-parser.are) ===== | ||
An additional test was made to show a simple way of parsing CAN Frames. The example is based on checking for a specific PGN (parameter group number) and then get a SPN (supect parameter name) to display its value in human readable format which then gets logged in a file. | An additional test was made to show a simple way of parsing CAN Frames. The example is based on checking for a specific PGN (parameter group number) and then get a SPN (supect parameter name) to display its value in human readable format which then gets logged in a file. |