-
Notifications
You must be signed in to change notification settings - Fork 0
BLCU Troubleshooting
Boot Loader Control Unit (BLCU) troubleshooting and repair documentation for Hyperloop UPV Control Station.
The BLCU system handles firmware upload and download operations to vehicle boards via TFTP protocol. This guide provides comprehensive troubleshooting for BLCU-related issues and the recent system repairs.
-
Backend BLCU Handler (
pkg/boards/blcu.go
) -
BLCU Topics (
pkg/broker/topics/blcu/
) - TFTP Client for firmware transfer
- Frontend Interfaces in Control Station and Ethernet View
The BLCU system was experiencing communication failures due to:
- Missing board registration - BLCU board never added to vehicle
- Frontend/backend data format mismatch - Different field names and encoding
- Incorrect topic handling - Wrong topic names in message routing
- Missing response format - No proper success/failure feedback
β
Board Registration: Added BLCU board to vehicle initialization
β
Data Format Alignment: Fixed frontend base64 encoding with backend byte handling
β
Topic Routing: Corrected topic names for proper message flow
β
Response System: Implemented proper JSON response format
Frontend (React) β WebSocket β Broker Topics β Vehicle β BLCU Board β TFTP β Target Board
β β
Response β WebSocket β Broker β Board Events β BLCU β TFTP Response β Target Board
-
Frontend: Sends base64-encoded file via
blcu/upload
-
Backend: Decodes to bytes in
UploadRequestInternal
-
Vehicle: Routes to BLCU board with
UploadEvent
- BLCU: Initiates TFTP upload to target board
- Response: Success/failure sent back to frontend
-
Frontend: Sends download request via
blcu/download
-
Backend: Creates
DownloadRequest
-
Vehicle: Routes to BLCU board with
DownloadEvent
- BLCU: Downloads firmware via TFTP
- Response: Firmware data or error sent to frontend
# Check if BLCU board is registered
cd backend
grep -r "BlcuId" pkg/vehicle/
grep -r "AddBoard.*blcu" cmd/
# Verify BLCU topics are registered
grep -r "RegisterTopics" pkg/broker/topics/blcu/
# Backend logs
cd backend/cmd
./backend 2>&1 | grep -i blcu
# Look for these messages:
# β
"BLCU board registered"
# β "BLCU board not registered"
# β "unknown topic"
# β "error handling download/upload"
# Test TFTP connectivity to target board
tftp [TARGET_BOARD_IP]
> connect
> get test_file
> quit
# Check BLCU IP configuration in ADJ
grep -r "BLCU" backend/cmd/adj/
Symptoms:
- Error message in backend logs
- BLCU operations fail silently
- No response to upload/download requests
Solution:
// Verify this exists in cmd/main.go:
if blcuIP, exists := adj.Info.Addresses[BLCU]; exists {
blcuBoard := boards.New(blcuIP)
vehicle.AddBoard(blcuBoard)
trace.Info().Str("ip", blcuIP).Msg("BLCU board registered")
} else {
trace.Warn().Msg("BLCU address not found in ADJ")
}
Symptoms:
- Upload requests fail with "unknown field" errors
- Base64 decode errors in backend
- Type assertion failures
Solution: Frontend should send:
{
"board": "VCU",
"file": "dGVzdCBkYXRh" // base64 encoded
}
Backend handles:
type UploadRequest struct {
Board string `json:"board"`
File string `json:"file"` // base64 encoded
}
type UploadRequestInternal struct {
Board string
Data []byte // decoded bytes
}
Symptoms:
- "unknown topic" messages in logs
- Messages not reaching BLCU board
- No response from upload/download
Solution: Verify topic consistency:
- Frontend sends:
blcu/download
,blcu/upload
- Backend expects:
blcu/downloadRequest
,blcu/uploadRequest
Symptoms:
- TFTP timeouts
- "connection refused" errors
- File transfer failures
Solutions:
- Check Network Connectivity:
ping [TARGET_BOARD_IP]
telnet [TARGET_BOARD_IP] 69 # TFTP port
- Verify TFTP Server on Target:
# Most boards run TFTP server on port 69
nmap -p 69 [TARGET_BOARD_IP]
- Check Firewall Rules:
# Ensure TFTP traffic is allowed
iptables -L | grep -i tftp
Symptoms:
- Frontend doesn't show progress
- No success/failure notifications
- Incomplete upload/download status
Solution: Ensure proper response format:
// Success response
{
"percentage": 100,
"failure": false,
"file": "[download data for downloads]"
}
// Progress response
{
"percentage": 45,
"failure": false
}
// Failure response
{
"percentage": 0,
"failure": true
}
cd backend
go test -v ./pkg/boards/... -run TestBLCU
go test -v ./pkg/broker/topics/blcu/...
Use browser console or WebSocket client:
// Connect to backend WebSocket
const ws = new WebSocket('ws://localhost:8080/ws');
// Send download request
ws.send(JSON.stringify({
topic: 'blcu/download',
payload: JSON.stringify({
board: 'VCU'
})
}));
// Send upload request
ws.send(JSON.stringify({
topic: 'blcu/upload',
payload: JSON.stringify({
board: 'VCU',
file: btoa('test firmware data') // base64 encode
})
}));
# Test TFTP connectivity manually
echo "test data" > test_file.bin
# Upload test
tftp [TARGET_BOARD_IP]
> binary
> put test_file.bin
> quit
# Download test
tftp [TARGET_BOARD_IP]
> binary
> get firmware.bin
> quit
# Start backend with debug logging
cd backend/cmd
DEVELOPMENT=true ./backend
# Start frontend development server
cd control-station
npm run dev
# Access bootloader interface at:
# http://localhost:5173/bootloader
For testing without hardware:
#!/usr/bin/env python3
# mock_tftp_server.py
import socket
import threading
import time
def handle_tftp_request(data, client_addr, sock):
# Simple TFTP ACK response
response = b'\x00\x04\x00\x00' # ACK packet
sock.sendto(response, client_addr)
print(f"Sent ACK to {client_addr}")
def tftp_server():
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(('0.0.0.0', 69))
print("Mock TFTP server listening on port 69")
while True:
data, addr = sock.recvfrom(1024)
print(f"Received TFTP request from {addr}: {data[:20]}...")
threading.Thread(
target=handle_tftp_request,
args=(data, addr, sock)
).start()
if __name__ == "__main__":
tftp_server()
# Full integration test script
#!/bin/bash
echo "=== BLCU Integration Test ==="
# 1. Start backend
cd backend/cmd
./backend &
BACKEND_PID=$!
# 2. Wait for startup
sleep 3
# 3. Test BLCU board registration
curl -s http://localhost:8080/health | grep -q "blcu" && echo "β
BLCU registered" || echo "β BLCU not found"
# 4. Test WebSocket connection
echo "Testing WebSocket endpoints..."
# 5. Cleanup
kill $BACKEND_PID
echo "Integration test complete"
Monitor these BLCU-related metrics:
# TFTP transfer success rate
grep -c "UploadSuccess\|DownloadSuccess" /var/log/backend.log
# Average transfer time
grep "transfer.*completed" /var/log/backend.log | awk '{print $X}'
# Error frequency
grep -c "BLCU.*error\|TFTP.*failed" /var/log/backend.log
#!/bin/bash
# blcu_health_check.sh
check_blcu_status() {
# Check if BLCU board is responding
curl -s http://localhost:8080/api/boards/blcu/status || return 1
# Check TFTP connectivity
timeout 5 nc -u -z [TARGET_BOARD_IP] 69 || return 1
return 0
}
if check_blcu_status; then
echo "$(date): BLCU system healthy"
else
echo "$(date): BLCU system issues detected"
# Alert team or restart services
fi
- System Architecture - Overall system design
- Backend Architecture - Go backend details
- Common Issues - General troubleshooting
- Development Environment Setup - Development setup
- β Fixed BLCU board registration in vehicle initialization
- β Aligned frontend/backend data formats for upload/download
- β Corrected topic routing for proper message flow
- β Implemented proper response handling with progress feedback
- β Added comprehensive test suite for BLCU operations
- β Updated documentation with troubleshooting procedures
- β BLCU operations failing silently
- β Frontend/backend communication errors
- β Missing progress feedback
- β Inconsistent error handling
β BLCU System Status: Operational
The BLCU system has been fully repaired and tested. For ongoing issues, follow the diagnostic procedures above or contact the development team through GitHub Issues.