Troubleshooting
Common issues and their solutions when working with HIL.
Installation Issues
hilp: command not found
The hilp CLI is not installed or not in your PATH.
# Install via npm
npm install -g @srashwan/hilp
# Verify installation
hilp --version
# If still not found, add npm global to PATH
export PATH="$PATH:$(npm prefix -g)/bin"
Node.js version error
HIL requires Node.js 18 or later.
# Check version
node --version
# Install or update via nvm
nvm install 18
nvm use 18
Serial Connection Issues
Device not found
Error: Could not open serial port /dev/ttyACM0
Solutions:
-
Check USB cable is connected
-
Verify the correct port:
# Linuxls /dev/tty*# macOSls /dev/cu.*# Windowsmode -
Add user to the
dialoutgroup (Linux):sudo usermod -a -G dialout $USER# Log out and log back in -
Close other programs using the serial port (Arduino IDE, Serial Monitor)
Serial timeout
Error: Serial timeout waiting for ACK
Solutions:
- Verify baud rate is 115200
- Check for serial port conflicts
- Try a different USB cable (some are charge-only)
- Press the reset button on the Arduino
Garbled output
If you see random characters, the baud rate is likely mismatched. Ensure both ends use 115200.
REPL Issues
Syntax error: unexpected token
Check for mismatched parentheses:
; WRONG - missing closing paren
(+ 1 2
; CORRECT
(+ 1 2)
Undefined variable
The variable has not been set before use:
; WRONG - x is undefined
(LOG x)
; CORRECT - set x first
(SET x 42)
(LOG x)
Stack overflow
Recursion depth exceeded. Check for infinite recursion:
; WRONG - no base case
(DEFUN infinite () (infinite))
; CORRECT - has a base case
(DEFUN factorial (n)
(IF (<= n 1) 1
(* n (factorial (- n 1)))))
Hardware Issues
Analog reads return 0
Solutions:
- Verify wiring — sensor output connected to correct analog pin
- Check power supply (5V for most sensors)
- Ensure
PIN-MODEis set for digital pins (not needed for analog)
Servo jittering
Solutions:
- Use an external power supply for servos (not USB power)
- Add a 100µF capacitor across servo power pins
- Reduce servo speed in code
Motor not spinning
Solutions:
- Check motor driver wiring (L298N)
- Verify ENA/ENB pins are connected to PWM outputs
- Ensure motor power supply is adequate
Package Issues
Package not found
# Search for available packages
hilp search
# Check package name spelling
hilp info <package-name>
Dependency conflict
Error: Version conflict for package X
Try installing a specific version:
hilp install package@1.0.0
Network Issues
MQTT connection refused
Solutions:
- Verify broker is running:
mosquitto -v
- Check broker URL and port (default: 1883)
- Verify firewall allows the connection
WebSocket connection failed
Ensure the registry server is running:
# Check if server is up
curl http://localhost:3002/api/health
Error Codes
| Code | Meaning | Solution |
|---|---|---|
| E001 | Serial timeout | Check connection and baud rate |
| E002 | CRC mismatch | Retry command (noise on serial line) |
| E003 | Stack overflow | Reduce recursion depth |
| E004 | Memory full | Reduce variable count |
| E005 | Pin not available | Check pin number for your board |
Getting Help
- Run diagnostics:
hilp doctor - Check error logs:
hilp errors - Report issues:
hilp report "description of problem" - Visit GitHub: https://github.com/SRashwan/hilp/issues