4.9 KiB
Raspberry Pi Deployment Guide
This guide explains how to run the ECU testing framework on a Raspberry Pi (Debian/Raspberry Pi OS). It covers environment setup, hardware integration via MUM (recommended) or BabyLin (legacy), running tests headless, and installing as a systemd service.
Note: The MUM (Melexis Universal Master) is networked, so the Pi only needs IP reachability to the MUM (default
192.168.7.2) — there are no Pi-side native libs to worry about. BabyLin needs ARM Linux native libraries; if those aren't available, use Mock or MUM on the Pi instead.
1) Choose your interface
- MUM (recommended for hardware on Pi):
interface.type: mum. Requires Melexispylin+pymumclient(seevendor/automated_lin_test/install_packages.sh) and IP reachability to the MUM device. - Mock (recommended for headless/dev on Pi):
interface.type: mock - BabyLIN (only if ARM/Linux support is available):
interface.type: babylinand ensure the SDK'sBabyLIN_library.pyand corresponding Linux/ARM shared libraries are available undervendor/or on PYTHONPATH/LD_LIBRARY_PATH.
2) Install prerequisites
sudo apt update
sudo apt install -y python3 python3-venv python3-pip git
Optional (for BabyLin or USB tools):
sudo apt install -y libusb-1.0-0 udev
3) Clone and set up
# clone your repo
git clone <your-repo-url> ~/ecu_tests
cd ~/ecu_tests
# create venv
python3 -m venv .venv
source .venv/bin/activate
# install deps
pip install -r requirements.txt
4) Configure
Create or edit config/test_config.yaml:
interface:
type: mock # or babylin (if supported on ARM/Linux)
channel: 1
bitrate: 19200
flash:
enabled: false
Optionally point to another config file via env var:
export ECU_TESTS_CONFIG=$(pwd)/config/test_config.yaml
If using the MUM on the Pi, set:
interface:
type: mum
host: 192.168.7.2 # adjust to your MUM IP
lin_device: lin0
power_device: power_out0
bitrate: 19200
boot_settle_seconds: 0.5
frame_lengths:
0x0A: 8
0x11: 4
Confirm reachability before running tests:
ping -c 2 192.168.7.2
If using BabyLIN on Linux/ARM with the SDK wrapper, set:
interface:
type: babylin
channel: 0
sdf_path: "/home/pi/ecu_tests/vendor/Example.sdf"
schedule_nr: 0
5) Run tests on Pi
source .venv/bin/activate
python -m pytest -m "not hardware" -v
Artifacts are in reports/ (HTML, JUnit, JSON, summary MD).
6) Run as a systemd service (headless)
This section lets the Pi run the test suite on boot or on demand.
Create a runner script
Create scripts/run_tests.sh:
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
source .venv/bin/activate
# optionally set custom config
# export ECU_TESTS_CONFIG=$(pwd)/config/test_config.yaml
python -m pytest -v
Make it executable:
chmod +x scripts/run_tests.sh
Create a systemd unit
Create scripts/ecu-tests.service:
[Unit]
Description=ECU Tests Runner
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
WorkingDirectory=/home/pi/ecu_tests
ExecStart=/home/pi/ecu_tests/scripts/run_tests.sh
User=pi
Group=pi
Environment=ECU_TESTS_CONFIG=/home/pi/ecu_tests/config/test_config.yaml
# Capture output to a log file
StandardOutput=append:/home/pi/ecu_tests/reports/service.log
StandardError=append:/home/pi/ecu_tests/reports/service.err
[Install]
WantedBy=multi-user.target
Install and run:
sudo mkdir -p /home/pi/ecu_tests/reports
sudo cp scripts/ecu-tests.service /etc/systemd/system/ecu-tests.service
sudo systemctl daemon-reload
sudo systemctl enable ecu-tests.service
# Start manually
sudo systemctl start ecu-tests.service
# Check status
systemctl status ecu-tests.service
7) USB and permissions (if using hardware)
- Create udev rules for your device (if required by vendor)
- Add user to dialout or plugdev groups if serial/USB access is needed
- Confirm your hardware library is found by Python and the dynamic linker:
- Ensure
vendor/BabyLIN_library.pyis importable (addvendor/to PYTHONPATH if needed) - Ensure
.sofiles are discoverable (e.g., place in/usr/local/liband runsudo ldconfig, or setLD_LIBRARY_PATH)
- Ensure
8) Tips
- Use the mock interface on Pi for quick smoke tests and documentation/report generation
- For full HIL on Pi, the MUM is the easiest path — it's IP-reachable so the Pi doesn't need vendor-specific native libraries, just the Melexis Python packages (
pylin,pymumclient) - For BabyLIN HIL, ensure vendor SDK supports Linux/ARM and provide a shared object (
.so) and headers - If only Windows is supported by your hardware path, run the hardware suite on a Windows host and use the Pi for lightweight tasks (archiving, reporting, quick checks)