An AVR firmware project that emulates a Volkswagen CD changer. This project allows you to control multimedia playback in VW vehicles through IR remote control and SPI communication protocols.
This repository contains the firmware, XCode project configuration, and PCB designs for a CD changer emulator that integrates with Volkswagen infotainment systems. The system supports:
- NEC IR Protocol: Receives remote control commands from car radios
- VW SPI-like Protocol: Communicates with the car's infotainment system
- Bluetooth Audio: Integration with OVC3860 Bluetooth module
- Multi-disc Support: Emulates up to 6 CD discs with 99 tracks each
cd-changer-emulator/
├── platformio/ # PlatformIO build (RECOMMENDED)
│ ├── platformio.ini # PlatformIO configuration
│ ├── README.md # PlatformIO-specific docs
│ ├── src/ # Source files
│ │ ├── main.c
│ │ ├── *.c *.h # All firmware source files
│ │ └── ...
│ └── .pio/ # Build artifacts (auto-generated)
├── vwcdc-firmware/ # Original firmware source (legacy)
│ ├── VWCDC/ # Main firmware implementation
│ │ ├── main.c # Main entry point
│ │ ├── Makefile # Traditional AVR build (deprecated)
│ │ ├── VWCDC_protocol.c/h # VW CD changer protocol
│ │ ├── NEC_protocol.h # IR remote protocol (NEC)
│ │ ├── SPI_protocol.c/h # SPI communication protocol
│ │ ├── USART_protocol.c/h # USART serial protocol
│ │ ├── OVC3860_library.c/h # Bluetooth module library
│ │ ├── timer.c/h # Timer interrupt handlers
│ │ ├── counter.c/h # Counter utilities
│ │ └── ASCII_table.h # ASCII character definitions
│ ├── VWCDC.xcodeproj/ # XCode project configuration
│ └── README.md # Firmware-specific documentation
├── vwcdc-pcb/ # PCB design files
│ └── [Various PCB versions] # Different hardware configurations
├── PLATFORMIO_MIGRATION.md # Migration guide from Makefile
└── README.md # This file
- Microcontroller: ATmega8 (7.3728 MHz external crystal)
- Programmer: USBasp programmer (or compatible AVR programmer)
- Bluetooth Module: OVC3860 (optional)
- Other: IR receiver, SPI interface components
-
Crosspack for AVR: Complete AVR development environment
# Download and install from https://www.obdev.at/products/crosspack/index.html -
X-AVR: XCode integration for AVR development
# Clone and install from https://github.com/jawher/xavr -
AVR GCC Tools: Typically installed with Crosspack
- avr-gcc
- avr-libc
- avrdude
# Check if AVR tools are available
avr-gcc --version
avr-libc --version
avrdude -vPlatformIO is a modern, cross-platform build system that simplifies AVR development.
# Install PlatformIO CLI
pip install platformio
# Build
cd platformio
pio run
# Build and upload to device
pio run -t upload
# Monitor serial output
pio device monitor -b 57600For detailed instructions, see PLATFORMIO_MIGRATION.md.
Navigate to the firmware directory and build:
cd vwcdc-firmware/VWCDC/
make clean # Clean previous builds
make all # Build the projectThis will generate:
main.hex- Hex file for programming the microcontrollermain.elf- ELF file for debugging
-
Open the project:
open vwcdc-firmware/VWCDC.xcodeproj
-
Select the appropriate build scheme
-
Press
Cmd + Bto build -
Press
Cmd + Rto run/program the device (if connected)
cd vwcdc-firmware/VWCDC/
# Program the ATmega8
make program
# Or manually:
avrdude -c usbasp -p atmega8 -U flash:w:main.hex:i- Build the project (
Cmd + B) - Connect the USBasp programmer to your computer and the ATmega8
- Run the project (
Cmd + R) - XCode will automatically program the device
The main build settings are located in vwcdc-firmware/VWCDC/Makefile:
- MCU: atmega8
- CPU Frequency: 7372800 Hz
- Serial/SPI Baud Rate: 57600 Hz
- Output Format: Intel HEX
-
Edit source files in
vwcdc-firmware/VWCDC/ -
Key modules:
- VWCDC_protocol.c/h: Modify CD changer behavior
- NEC_protocol.h: Change IR remote handling
- main.c: Add new features or protocol support
-
Rebuild:
make clean && make all
Common modification points:
- New IR Commands: Add to
NEC_protocol.hand handle inmain.c - Protocol Changes: Modify
VWCDC_protocol.corSPI_protocol.c - Bluetooth Integration: Extend
OVC3860_library.c
Receives commands from car radio IR remotes:
#define VWCDC_ON 0x532CE41BUL
#define VWCDC_OFF 0x532C10EFUL
#define VWCDC_NEXT 0x532CF807UL
#define VWCDC_PREV 0x532C7887UL
#define VWCDC_PLAY 0x532C08F7UL
#define VWCDC_SHUFFLE 0x532C609FUL
#define VWCDC_SCAN_AUDI 0x532CA05FUL
// ... and moreCommunication with the infotainment system:
- Clock: 57600 Hz @ 7372800 Hz external crystal
- Delay: 700µs after each byte, 50ms after each command
- Disc Selection: 0xBE-0xB9 (CD1-CD6)
- Mode: Play (0xFF), Shuffle (0x55), Scan (0x00)
Ensure Crosspack is installed and in your PATH:
which avr-gccIf not found, add Crosspack to your shell profile:
export PATH="/usr/local/CrossPack-AVR/bin:$PATH"Ensure you have the X-AVR plugin installed for XCode.
- Check USB connection and USBasp programmer
- Verify correct port in Makefile:
AVRDUDE_PORT = /dev/cu.usbmodem* - Test with:
avrdude -c usbasp -p atmega8
- Bluetooth Module: See
Bluetooth manual.pdffor OVC3860 specifications - Wiring Diagrams: See
zapojenie.pdffor hardware connections - Firmware Details: See
vwcdc-firmware/README.mdfor protocol specifics
Enable serial output for debugging:
-
Connect USART to a USB serial adapter
-
Monitor output using a terminal:
screen /dev/cu.usbserial-* 57600 -
Add debug statements in C code using USART functions
This project is for personal and educational use.
Feel free to fork, modify, and contribute improvements to this project.
- Crosspack-AVR: https://www.obdev.at/products/crosspack/index.html
- X-AVR: https://github.com/jawher/xavr
- AVR GCC: https://gcc.gnu.org/wiki/avr-gcc
- WinAVR Makefile: https://winavr.sourceforge.net/
Last Updated: 2024 Project Status: Active Development