Playing audio files with CSR8645 Bluetooth chip

The CSR8645 is a Bluetooth 4.1 stereo audio chip supporting the aptX codec for streaming high quality audio. I bought the chip from ebay but I couldn’t find a breakout board for it, so I built one.

csr8645 breakout

Configuring the chip

The chip can be configured through the SPI interface with an USB-SPI device connected to the computer. For this you have to do the following steps:
1. Get a breakout module with the FT232RL USB-UART converter chip where you can access every pin of the FT232RL. Download and run Zadig from http://zadig.akeo.ie. In Options menu choose “List all devices”, choose your FT232RL device, choose libusbK driver and press “Replace driver”. This will install a generic libusb-compatible driver for the chip.
2. Connect the CSR8645 with the FT232RL. The https://github.com/lorf/csr-spi-ftdi has a good explanation how to connect them. To select the SPI pins logic level to 3.3V for the FT232RL connect the VCCIO pin to the 3V3OUT pin. But because the CSR8645 needs 1.8V logic for its SPI pins you need to add resistors in series or a logic converter when you connect the two devices. (According to the datasheet you can connect the 1V8 pin of the CSR8645 to the VCCIO pin to provide the 1.8V logic level for the SPI pins, but only if the two devices share the same power source. In this case you don’t need a logic converter). To enable the SPI communication for the CSR8645 connect the SPI_PCM pin to a high logic level through a resistor.

csr8645_spi_connection

CSR8645 SPI connection

3. Install the BlueSuite from http://www.tinyosshop.com/download/BlueSuite 2.5.rar and the CSR86XX ROM Config tool from http://www.tinyosshop.com/download/CSRXX_ROM_ConfigTool_3.0.64.rar
4. Replace the usbspi.dll in the installed programs with a custom dll from https://github.com/lorf/csr-spi-ftdi/releases.  
5. Open the ROM Config tool or the PSTools from the BlueSuite installation directory and change the settings of the CSR8645. Before you do any changes it is a good idea to save the original settings (PSkeys) and the eeprom content. You can do this with the PSTools (File->Dump/File->Merge to backup/update the PSkeys)  or by running the following commands from the BueSuite directory.

  • Backup the PSkeys into pskeys.psr:
      pscli.exe dump pskeys.psr 
  • Merge some settings from pskeys.psr to the chip:
      pscli.exe merge pskeys.psr
    
  • Backup the whole EEPROM content to a file:
      e2cmd.exe dump eeprom.hex
    
  • Restore EEPROM contents from a backup file:
      e2cmd.exe download eeprom.hex
    

CSR8645-pskeys.psr   CSR8645-eeprom.hex (I had to add the .doc extension to upload the files).

The ROM Config tool is more user friendly and has more settings than the PSTools. But according to some info from different forums this program shouldn’t be used to write directly to the device (‘Write Device’ button), because it will overwrite some data on the device, or it just writes only a subset of the data, and so it can brick your module. Instead you should write to a file, before and after changing the settings, and then compare the two files and copy the changed keys to the original dump file. Then you can write back the changed dump file using the methods mentioned above.

Audio output

The CSR8645 has a differential audio output which means that there is two output for each channel (LP+LN and RP+RN). If you want to connect this output to an amplifier you have to transform the differential output to a single ended output, because most of the amplifiers have one input for each channel and a common ground (L+R). Here is the schematic which I built to do the conversion, it is based on LME49721.

diifferencial-to-single

Differential to single ended converter with LME49721

Here are some pictures of the breadboard assembled module.
csr8645_lme49721_breakout1csr8645_lme49721_breakout2

Advertisements

144 thoughts on “Playing audio files with CSR8645 Bluetooth chip

  1. Thanks for you great blog!
    Are the files you attached in your article contain the functions of ‘in-song-search” (long press on NEXT or PREV pins to move fast backward or forward inside a track)? – do you remember if your module supported these functions?
    I ask because I bought some modules that only respond to short press (goes to Next or Previous track)
    and I would like to re-write them with your files to have these functions working.
    Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.