Automated Testing Scripts
Automated Testing Scripts
The Snake-V1 includes a suite of automated diagnostic scripts designed to validate the hardware integrity of the device. These scripts perform functional checks on the STM32WB35 microcontroller and its connected peripherals, ensuring that all sensors, transmitters, and receivers are operational after assembly or firmware updates.
Prerequisites
Before running the diagnostic suite, ensure the following:
- Connection: The Snake-V1 must be connected to your workstation via the USB-C port.
- Environment: You should have the Snake-V1 CLI tool installed or a serial terminal (like PuTTY or Minicom) configured to communicate with the device.
- Storage: A microSD card should be inserted into the Molex connector if you wish to run the SD logging and filesystem tests.
Running the Diagnostic Suite
The diagnostics can be triggered via the serial interface. To run the full battery of tests, use the following command in the device console:
# Run all automated hardware tests
snake-v1 --test all
To test a specific peripheral, provide the component name as an argument:
# Test only the Sub-GHz transceiver
snake-v1 --test subghz
Test Modules
IR Transmitter & Receiver
This script performs a loopback test. It triggers the Vishay TSAL6400 to send a specific modulated signal and verifies if the Vishay TSOP38238 receiver picks up the exact bitstream.
- Success Criteria: Received pulse timings match the transmitted signal within a 5% margin of error.
Sub-GHz Transceiver (CC1101)
The script initializes the TI CC1101 over SPI and performs a register read/write check to verify communication. If two devices are present, it will attempt a packet transmission.
- Success Criteria: SPI "Who Am I" register returns
0x00or0x11(depending on version) and the PLL locks successfully.
MicroSD Interface
Tests the connectivity of the Molex 47352-1001 connector. It attempts to mount the filesystem, create a temporary file, and calculate a checksum of the written data.
- Success Criteria: Successful file creation and matching CRC32 checksum.
BLE & Wireless Stack
The script initializes the STM32WB wireless coprocessor (CPU2) to ensure the BLE stack is responsive.
- Success Criteria: CPU2 signals a "Ready" state and begins advertising a test UUID.
Interpreting Results
The scripts output real-time status updates to the console. Results are color-coded for quick identification:
| Result | Meaning | Action Required |
| :--- | :--- | :--- |
| [ PASS ] | Component is fully functional. | None. |
| [ FAIL ] | Component failed functional check. | Check solder joints or component orientation. |
| [ SKIP ] | Test skipped (usually due to missing hardware like SD card). | Insert required peripheral and retry. |
Example Output:
Snake-V1 Hardware Diagnostic v1.0
---------------------------------
[ PASS ] STM32WB35 Internal Core Temp: 32C
[ PASS ] CC1101 Sub-GHz: SPI Communication Established
[ PASS ] IR Loopback: Signal Match Confirmed
[ FAIL ] MicroSD: No Card Detected
[ PASS ] BLE Stack: CPU2 Active
---------------------------------
Result: 4 Passed, 1 Failed
Safety Note
During the IR Transmitter test, avoid looking directly at the IR LED from a very close distance. While the TSAL6400 is an infrared emitter, high-intensity pulses are used during the diagnostic phase to test maximum range.