Troubleshooting
This guide helps you diagnose and resolve common issues when using the BNO08x driver.
Common Error Messages
Error: Initialization Failed
Symptoms:
Begin()returnsfalse- Sensor not responding
GetLastError()returns non-zero
Causes:
- Communication interface not properly initialized
- Hardware connections incorrect
- Power supply issues
- Wrong I²C address
Solutions:
- Verify Communication Interface: Ensure interface is initialized before calling
Begin() - Check Connections: Verify all I²C/SPI connections (SCL, SDA, CS, etc.)
- Verify Power: Check power supply voltage (2.4V - 3.6V, typically 3.3V)
- Check I²C Address: Verify address matches hardware (0x4A or 0x4B)
- Check Pull-ups: Ensure I²C has proper pull-up resistors (4.7 kΩ)
- Verify Interface Selection: Check PS0/PS1 pins match selected interface
Error: No Sensor Data
Symptoms:
Begin()succeeds but no data receivedHasNewData()always returns false- Callbacks never called
Causes:
- Sensors not enabled
Update()not called frequently enough- Sensor not calibrated
- Communication errors
Solutions:
- Enable Sensors: Call
EnableSensor()for each sensor you need - Call Update Frequently:
Update()must be called as often as possible (every 5-10ms) - Check Sensor Status: Wait for calibration (accuracy = 3)
- Verify Communication: Check for communication errors with
GetLastError() - Check Interval: Ensure report interval is reasonable (not too fast)
Error: Communication Error
Symptoms:
GetLastError()returns communication error codes- Intermittent data loss
- Timeout errors
Causes:
- I²C/SPI configuration incorrect
- Signal integrity issues
- Bus speed too high
- Interference
Solutions:
- Check I²C Speed: Try lower speed (e.g., 100 kHz instead of 400 kHz)
- Verify Pull-ups: Ensure proper pull-up resistors on I²C bus
- Check Wiring: Verify all connections are secure and wires are short
- Reduce Interference: Keep sensor away from noise sources
- Check Bus Loading: Ensure bus capacitance is within limits
Error: Sensor Not Calibrating
Symptoms:
accuracyfield stays at 0 or 1- Orientation data unreliable
- Heading drifts
Causes:
- Sensor needs calibration motion
- Magnetic interference
- Sensor not moving
- Calibration timeout
Solutions:
- Perform Calibration Motion: Move sensor in figure-8 pattern
- Check Magnetic Environment: Avoid strong magnetic fields
- Wait for Calibration: Calibration can take 10-30 seconds
- Check Sensor Placement: Ensure sensor is not near magnetic materials
- Verify Magnetometer: Check if magnetometer is enabled and working
Error: Wrong Orientation Data
Symptoms:
- Euler angles seem incorrect
- Quaternion values unexpected
- Coordinate system mismatch
Causes:
- Sensor mounting orientation
- Coordinate system convention
- Calibration issues
Solutions:
- Check Mounting: Verify sensor orientation matches expected coordinate system
- Apply Transformations: Rotate quaternion/Euler angles to match your coordinate system
- Verify Calibration: Ensure sensor is fully calibrated (accuracy = 3)
- Check Datasheet: Review sensor coordinate system in datasheet
Error: RVC Mode Not Working
Symptoms:
BeginRvc()fails- No RVC frames received
- UART communication errors
Causes:
- Sensor not in RVC mode
- UART configuration incorrect
- Baud rate mismatch
- HAL implementation issues
Solutions:
- Verify RVC Mode: Check PS0/PS1 pins are set for RVC mode (PS0=1, PS1=0)
- Check Baud Rate: Ensure UART is configured for 115200 bps (8N1)
- Verify HAL: Check
IRvcHalimplementation is correct - Check Wiring: Verify UART connections (TX/RX)
- Call ServiceRvc: Ensure
ServiceRvc()is called frequently
Error: DFU Update Failed
Symptoms:
Dfu()returns error code- Firmware update doesn’t complete
- Bootloader not responding
Causes:
- Sensor not in bootloader mode
- Firmware image invalid
- Communication timeout
- Transport implementation issues
Solutions:
- Enter Bootloader: Hold BOOTN low while resetting sensor
- Verify Firmware: Check firmware image is valid
HcBin_tobject - Check Transport: Verify
IDfuTransportimplementation is correct - Increase Timeout: DFU may take several minutes on slow links
- Check Communication: Ensure communication interface works in bootloader mode
Debugging Tips
Enable Logging
Check your communication interface implementation for logging capabilities:
1
2
3
4
5
6
7
8
// Example: Add logging to your CommInterface implementation
int Read(uint8_t* data, uint32_t length) {
int result = /* your read implementation */;
if (result < 0) {
printf("Read error: %d\n", result);
}
return result;
}
Check Last Error
1
2
3
4
5
int error = imu.GetLastError();
if (error != 0) {
printf("Last error: %d\n", error);
// Error codes are from SH-2 library
}
Verify Sensor Status
1
2
3
4
5
6
7
8
9
// Check if sensor is responding
if (!imu.Begin()) {
printf("Initialization failed\n");
return;
}
// Check if sensors are enabled
imu.EnableSensor(bno08x::BNO085Sensor::RotationVector, 20);
// Wait a bit, then check for data
Monitor Update Frequency
1
2
3
4
5
6
7
8
9
10
uint32_t last_update = 0;
while (true) {
uint32_t now = xTaskGetTickCount();
if (now - last_update > 100) { // More than 100ms
printf("Warning: Update() not called frequently enough!\n");
}
last_update = now;
imu.Update();
vTaskDelay(pdMS_TO_TICKS(5));
}
Common Configuration Mistakes
- Forgetting to Enable Sensors: Must call
EnableSensor()for each sensor - Not Calling Update():
Update()must be called frequently (every 5-10ms) - Wrong I²C Address: Check ADR/SA0 pin for correct address (0x4A or 0x4B)
- Interface Mismatch: PS0/PS1 pins must match selected interface
- Too Fast Update Rate: Some sensors have maximum rates (check datasheet)
- Not Waiting for Calibration: Orientation data unreliable until accuracy = 3
Next Steps
- Review Hardware Setup for wiring verification
- Check Platform Integration for communication interface issues
- See Examples for working code samples
- Review API Reference for error codes
Navigation ⬅️ Examples | Back to Index