SilKit CAN Communication Tests
This guide provides instructions on how to execute the manual tests for the SilKit CAN communication system, including the can_reader and can_writer components.
Prerequisites
Before running the tests, ensure the following:
- Operating System: Ubuntu (or a Linux distribution with gnome-terminal installed) or Windows.
- Dependencies:
sil-kit-registryandsil-kit-system-controllerbinaries are available in the directory:<...>/vapi-cpp-vehicle-api-platform/build/<compiler_version>/_deps/silkit-src/SilKit/bin/- gnome-terminal is installed on your system (Linux only).
- Build: The project has been built successfully, and the binaries for can_reader and can_writer are available in the directory:
<...>/vapi-cpp-vehicle-api-platform/build/<compiler_version>/tests/bin/
Test Components
The tests involve the following components:
sil-kit-registry: Manages the SilKit network.sil-kit-system-controller: Controls the lifecycle of SilKit participants.can_writer: Sends CAN messages to the network.can_reader: Receives CAN messages from the network.
Instructions
Linux
- Start the SilKit Utilities
-
Navigate to the directory containing the
run_silkit_util.shscript:cd <...>/vapi-cpp-vehicle-api-platform/build/<compiler_version>/tests/manual_tests/ -
Make the script executable (if not already):
chmod +x run_silkit_util.sh -
Run the script to start the SilKit utilities:
./run_silkit_util.shThis will open two new terminal windows:
- One running
sil-kit-registry. - Another running
sil-kit-system-controllerwith the argumentscan_reader can_writer.
- One running
-
Run the CAN Writer In a new terminal, navigate to the directory containing the can_writer binary:
cd <...>/vapi-cpp-vehicle-api-platform/build/<compiler_version>/tests/bin/- Run the can_writer binary:
./can_writerThe
can_writerwill send different CAN messages to the network. Each message will be logged in the terminal. -
Run the CAN Reader In another terminal, navigate to the directory containing the can_reader binary:
cd <...>/vapi-cpp-vehicle-api-platform/build/<compiler_version>/tests/bin/- Run the
can_readerbinary:
./can_readerThe
can_readerwill receive and log the CAN messages sent by thecan_writer. Each message will be logged in the terminal. - Run the
Windows
- Start the SilKit Utilities
-
Before running the executables, copy the
SilKit.dllandSilKitd.dllDLLs from the SilKit source directory<..>\_deps\silkit-src\SilKit\binto the<..>\test\bindirectory. -
Open PowerShell or Command Prompt and navigate to the directory containing the
run_silkit_util.batscript (if available):cd <...>\vapi-cpp-vehicle-api-platform\build\<compiler_version>\tests\manual_tests -
Run the script to start the SilKit utilities:
run_silkit_util.batThis will open two new windows:
- One running
sil-kit-registry. - Another running
sil-kit-system-controllerwith the argumentscan_reader can_writer.
If the script is not available, you can start the utilities manually:
- Open two Command Prompt or PowerShell windows:
- In the first window, navigate to the SilKit bin directory and run:
cd <...>\vapi-cpp-vehicle-api-platform\build\<compiler_version>\_deps\silkit-src\SilKit\bin sil-kit-registry.exe - In the second window, run:
sil-kit-system-controller.exe can_reader can_writer
- In the first window, navigate to the SilKit bin directory and run:
- One running
- Run the CAN Writer
-
Open a new Command Prompt or PowerShell window and navigate to the directory containing the can_writer binary:
cd <...>\vapi-cpp-vehicle-api-platform\build\<compiler_version>\tests\bin can_writer.exeThe
can_writerwill send different CAN messages to the network. Each message will be logged in the terminal.
- Run the CAN Reader
-
Open another Command Prompt or PowerShell window and navigate to the directory containing the can_reader binary:
cd <...>\vapi-cpp-vehicle-api-platform\build\<compiler_version>\tests\bin can_reader.exeThe
can_readerwill receive and log the CAN messages sent by thecan_writer. Each message will be logged in the terminal.
Expected Output
-
CAN Writer: Logs the messages being sent, including the CAN ID, data length, and data content in the terminal.
-
CAN Reader: Logs the messages being received, including the CAN ID, data length, and data content in the terminal.
Troubleshooting
-
Binaries Not Found: Ensure the
sil-kit-registry,sil-kit-system-controller,can_writer, andcan_readerbinaries are built and located in the correct directories. -
Terminal Emulator: The script uses gnome-terminal on Linux. On Windows, PowerShell is used. If you use a different terminal emulator, modify the scripts accordingly.
-
Network Issues: Ensure the RegistryURI in the configuration matches the address of the sil-kit-registry.
Additional Notes
- The
can_writerandcan_readerconfigurations are hardcoded in their respective source files. If you need to modify the configurations (e.g., participant names, network names, or registry URI), update the source code and rebuild the binaries. - The tests are designed to run in synchronous mode (SyncMode = true). Ensure this setting is consistent across all components.