Skip to main content

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:

  1. Check USB cable is connected

  2. Verify the correct port:

    # Linux
    ls /dev/tty*

    # macOS
    ls /dev/cu.*

    # Windows
    mode
  3. Add user to the dialout group (Linux):

    sudo usermod -a -G dialout $USER
    # Log out and log back in
  4. Close other programs using the serial port (Arduino IDE, Serial Monitor)

Serial timeout​

Error: Serial timeout waiting for ACK

Solutions:

  1. Verify baud rate is 115200
  2. Check for serial port conflicts
  3. Try a different USB cable (some are charge-only)
  4. 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:

  1. Verify wiring — sensor output connected to correct analog pin
  2. Check power supply (5V for most sensors)
  3. Ensure PIN-MODE is set for digital pins (not needed for analog)

Servo jittering​

Solutions:

  1. Use an external power supply for servos (not USB power)
  2. Add a 100µF capacitor across servo power pins
  3. Reduce servo speed in code

Motor not spinning​

Solutions:

  1. Check motor driver wiring (L298N)
  2. Verify ENA/ENB pins are connected to PWM outputs
  3. 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:

  1. Verify broker is running:
    mosquitto -v
  2. Check broker URL and port (default: 1883)
  3. 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​

CodeMeaningSolution
E001Serial timeoutCheck connection and baud rate
E002CRC mismatchRetry command (noise on serial line)
E003Stack overflowReduce recursion depth
E004Memory fullReduce variable count
E005Pin not availableCheck pin number for your board

Getting Help​

  1. Run diagnostics: hilp doctor
  2. Check error logs: hilp errors
  3. Report issues: hilp report "description of problem"
  4. Visit GitHub: https://github.com/SRashwan/hilp/issues