Testing philosophy
BlueBus firmware testing combines multiple approaches:- Simulator testing - Initial verification using MPLAB X Simulator
- Bench testing - Hardware validation without vehicle integration
- Vehicle testing - Full integration testing in supported BMW models
- Regression testing - Ensuring existing functionality remains intact
Due to the embedded nature of the BlueBus and its tight integration with vehicle systems, comprehensive testing requires access to a compatible BMW vehicle with I-Bus.
Pre-flight checks
Before flashing new firmware to hardware, perform these basic validations:Verify compilation
Ensure the firmware builds without errors or warnings:The build should complete with:
Check memory usage
Review the memory usage report in the build output:Ensure:
- Program memory usage < 90% (< 0xAA800 for bootloader compatibility)
- Data memory usage < 80% (leaving headroom for stack)
Review code changes
Use static analysis tools or manual review to check:
- No uninitialized variables
- No buffer overflows in string operations
- Proper bounds checking on arrays
- Correct interrupt handling (no long-running operations in ISRs)
- Proper use of volatile for hardware registers and ISR-modified variables
Simulator testing
MPLAB X includes a simulator for testing firmware without hardware:Setting up the simulator
- In MPLAB X, right-click your project and select Properties
- Under Hardware Tool, select Simulator
- Click OK
Running in simulator
- Set breakpoints in your code by clicking the line number margin
- Click Debug Project (Ctrl+F5)
- Use the Debug toolbar to:
- Step Over (F8) - Execute one line at a time
- Step Into (F7) - Step into function calls
- Continue (F5) - Run until next breakpoint
Simulator limitations
The simulator cannot emulate:
- UART communication (I-Bus, Bluetooth, USB)
- I2C peripherals (WM8804, PCM5122)
- Real-time timing constraints
- Interrupt interactions with external devices
Bench testing
Bench testing validates hardware functionality outside of a vehicle:Required equipment
- BlueBus hardware (v1.x or v2.x)
- 12V power supply (2A minimum)
- USB cable for serial monitoring
- Logic analyzer or oscilloscope (optional but recommended)
- PICkit 3/4 for debugging
Serial console testing
The BlueBus exposes a CLI over the system UART at 115200 baud:help to see available commands:
Testing I-Bus communication
Without a vehicle, you can test I-Bus packet handling:- Connect a second microcontroller or UART adapter to simulate I-Bus traffic
- Send valid I-Bus packets (see
lib/ibus.hfor packet format) - Monitor the BlueBus response with a logic analyzer
Testing Bluetooth module
The BM83 Bluetooth module can be tested independently:-
Use the CLI
btcommand to query module status: - Monitor UART communication between PIC and BM83 on UART2
- Verify Bluetooth pairing and audio streaming with a phone
Vehicle testing
Full vehicle testing validates integration with BMW I-Bus systems:Test vehicle requirements
- BMW E38, E39, E46, E53, E83, E85/E86, or MINI R50/R52/R53
- I-Bus equipped (navigation or non-navigation)
- Display unit: BMBT, MID, CD53, or MIR
Installation for testing
- Locate the CD changer connector in the trunk or glovebox
-
Connect BlueBus to the 10-pin CD changer harness:
- Pin 1: Ground
- Pin 3: I-Bus
- Pin 7: +12V
- Connect USB cable to the BlueBus for serial monitoring (optional)
Always test with ignition in position 2 (accessories on). Never install or remove modules with the ignition on.
Core functionality tests
Perform these tests for every firmware release:Audio streaming
Pair a Bluetooth device
- Press and hold the BlueBus pairing button (or use vehicle menu)
- Pair a smartphone via Bluetooth
- Verify the telephone LED turns green when connected
Test audio playback
- Press CD button on the radio
- Start music playback on the phone
- Verify:
- Audio plays through vehicle speakers
- Metadata displays on screen (artist, title, album)
- Volume control works via steering wheel/radio
Hands-free telephony
Receive a call
- Have someone call your paired phone
- Verify:
- Caller ID displays on vehicle screen
- Audio mutes and ring tone plays
- Telephone LED turns red
Answer the call
- Press the telephone button on steering wheel
- Verify:
- Call audio routes through speakers
- Microphone captures your voice
- Vehicle controls (end call, mute) work
Vehicle integration
Test on-board computer
- Navigate to OBC on the instrument cluster
- Verify BlueBus displays:
- Coolant temperature
- Ambient temperature
- Oil temperature (if available)
Test configuration menu
- Access BlueBus settings via vehicle display:
- Audio settings (DAC gain, DSP input)
- Telephony settings (HFP mode, mic gain)
- Comfort features (auto-lock, blinker count)
- UI settings (language, temperature units)
- Change settings and verify they persist after ignition cycle
Display unit compatibility
Test with all available display types:| Display | Resolution | Test Focus |
|---|---|---|
| BMBT | Graphical | Full menus, metadata, graphics |
| MID | 24 chars | Single-line scrolling text |
| CD53 | 11 chars | Limited text display |
| MIR | Single line | Basic metadata |
Logging and diagnostics
Use the serial console to monitor system behavior during vehicle tests:- I-Bus packet traffic
- Bluetooth module events
- Configuration changes
- Error conditions
Regression testing
Before releasing firmware, verify all core features still work:Regression checklist
- Bluetooth pairing and connection
- Audio playback (A2DP)
- Metadata display (AVRCP)
- Playback control (play, pause, next, previous)
- Incoming call handling
- Outgoing call via voice assistant
- Caller ID display
- Microphone audio quality
- On-board computer data
- Configuration menu access
- Setting persistence across power cycles
- Auto-lock/unlock (if enabled)
- Comfort turn signals (if enabled)
- Multi-language support
- Firmware upgrade via USB
Board version testing
Test on both hardware revisions:- v1.x - WM8804 S/PDIF receiver
- v2.x - DIT4096 S/PDIF transmitter
Continuous integration
While BlueBus doesn’t have automated CI/CD due to hardware requirements, maintain good practices:- Document all changes in commit messages
- Create test reports for vehicle validation
- Track issues in GitHub Issues
- Version tagging for releases:
Reporting issues
When reporting bugs or test failures, include:- Firmware version (
versioncommand output) - Hardware version (v1.x or v2.x)
- Vehicle details (model, year, display type)
- Steps to reproduce the issue
- Serial console log (if applicable)
- Expected vs. actual behavior
Safety considerations
Always prioritize vehicle and occupant safety:
- Never test while driving
- Ensure critical vehicle functions (lights, HVAC) still work
- Test auto-lock/unlock in a safe environment
- Verify telephone functionality doesn’t interfere with driving
- Keep original BMW equipment available in case of issues
Next steps
After validating your changes:- Review the code style guide to ensure compliance
- Create a pull request with detailed test results
- Include vehicle test logs and validation screenshots
- Request review from project maintainers