Enough talk. Let’s stream some tunes! The RN-52 comes ready to begin streaming tunes from most any Bluetooth audio-capable device. However, to add external control functions such as play, skip, and volume, you’ll need to make a few small adjustments.
Using the same setup from the Hardware Setup section, let’s add a few more pieces. By connecting a few buttons and some speakers, the RN-52 becomes a full-on music station and remote. The image below shows all the connections and the functions of each button.
By default, the RN-52 does not have the AVRCP enabled. This is part of the extended features. When you type D
to see the basic settings, you’ll notice a line that says ExtFeatures=XX
, where XX is some hex value. As of this writing, the default firmware comes with the AVRCP buttons disabled. Future versions of the firmware may differ. Looking in the Command Specifications document, we find this table:
Notice that bit 0 is the bit we need to enable to activate the AVRCP button functionality. Send the command S%,07(/r)
to enable this bit while leaving the other two bits enabled. Then follow it up with a reboot – R,1(/r)
. You should now have AVRCP enabled. Type D
to double check the settings.
That’s really the only setting that needs changed for this example.
You are now ready to connect to your Bluetooth device and start streaming some music. Directions on how to pair and connect to the RN-52 can also be found in section 1.4 of the user guide.
Troubleshooting/Common Issues
Checking the Version Number
To check the version number of your RN52, you can use the “v” command. Make sure that you connect the 3.3V FTDI to the RN-52 as stated in the hookup guide for CMD mode: Rx <-> UART_Tx, Tx <-> UART_Rx, 3.3V <-> PWR_EN <-> 3.3V, GND<-> GND, and GPIO9 <-> GND. Using a serial terminal connected to the FTDI’s enumerated COM port (with setting 115200, 8-none-1-none). After typing the command, the RN-52 will respond with:
Upgrading DFU Firmware over USB
Note: Upgrade at your own discretion before proceeding!!! You might brick your module if you are not cautious!!!
If you are interested in upgrading the firmware on the RN-52s, you will need the USBD+, USBD-, GND and GPIO3 pins. The standard default v1.10 firmware on the RN-52s requires DFU over USB. After flashing the v1.16 (file rn52-i_rm116.dfu ), the RN-52 will have the ability to use DFU over UART.
Try looking at the RN52 Firmware v1.16 Release Notes for new additional features.
1.) Head to Microchip’s RN-52 Product Page .
2.) Download the RN52 Bluetooth DFU Utility Installer located under “Documentation > Software.” This will contain the application called MicroChip Bluetooth DFU Utility Installer.exe and a guide called RN52-EK DFU Procedure Guide.pdf . The guide was written for Microchip’s RN52-EK development board but there was no issues updating RN-52’s on our breakout board.
3.) Download the image of your choice below the software. You have the option of using “RN52-I/RM110 DFU Image” (saved as the rn52-i_rm110.dfu file) or “RN52-I/RM116 DFU Image” (saved as the rn52-i_rm116.dfu file).
4.) Unzip Microchip Bluetooth DFU Utility Installer.zip .
5.) Click on the Microchip Bluetooth DFU Utility Installer.exe to install.
6.) Follow the installation instructions in the installer. This will also install the driver for your Rn-52 audio bluetooth though USB.
7a.) Hardware Connection Connect a DFU Over USB Pins: USBD+, USBD-, 3.3V, PWR_EN, GND, and GPIO3 pins. You could use the a USB Mini-B Breakout, mini-B cable , and jumper wires. Since I already connected the 3.3V FTDI to the RN-52, I just used 3.3V and GND from the FTDI to the RN-52 for power. Make sure to connect GND of the USB Mini-B breakout with the GND of the FTDI so the reference is the same:
7b.) Power Cycle Power cycle the RN-52 so that the GPIO3 is HIGH at boot time. The green LED labelled (LED0) and red LED labelled (LED1) will blink simultaneously.
7c.) Launch the the “Microchip Bluetooth Device Firmware Upgrade Utility” software (i.e. MCHPDFUUtility.exe ).
7d.) You will be greeted with a note from Microchip. Click on the “Next >” button to begin.
7e.) Connection Type Selection Select “DFU over Universal Serial Bus (USB)” and click on the “Next >” button.
7f.) The software should automatically search for the device that is connected over USB. Your computer might pop up with a new device (For Windows, there was a popup in the notifications):
7g.) Upgrade Action Selection Select “Download a new version of the firmware, saving a copy of the current version first. Any previous saved version will be replaced. (Recommended.)” and click “Next >”.
7h.) Upgrade File Select the location of your file (i.e. rn52-i_rm116.dfu ). and click “Next >”.
7i.) Ready to Upgrade Verify your selections and click “Next >”. Your window might say something like this:
Note: Since the PWR_EN is connected to 3.3V already, you do not need to “hold the power button down” as stated in the guide for Microchip’s RN52-EK development board. The upgrade automatically started as soon as I pressed on the “Next >” button.
7j.) Upgrade in Process Make sure to not interrupt the power and connections during the firmware upgrade. There will be progress bars that indicate your progress. Depending on your upgrade selection, it will save the previous firmware, flash the new firmware, and verify the update on the RN-52.
7k.) Successful Upgrade Once finished, the utility will provide the total time it took to save your file and flash the new firmware. It took less than 5 minutes to upgrade the firmware:
There was also a verification process after flashing the new firmware. This should take about a minute to complete. Click “Finish” to complete the upgrade at the final screen.
7l.) Cycle Power Disconnect GPIO3 from 3.3V so that it is LOW. Power cycle the RN-52 by disconnecting and reconnecting power to 3.3V.
8.) If you are already connected to a serial terminal with a 3.3V FTDI and the RN-52 set to CMD mode, you can verify the version number by sending the “v” command. The RN-52 should respond with this output:
This should indicate that the firmware has been upgraded to the new firmware. Try testing out the new firmware by playing music from a smartphone. =)
Streaming Music and Phone Calls
When streaming music with the audio bluetooth and a call comes in, the smartphone will automatically stop the music and begin to ring until the call is answered/rejected. After answering or rejecting the call, the music will begin to stream again.
Useful mic design application notes for the RN-52
http://www.jenrathbun.com/Electronics/rn52-bluetooth-adapter-microphone/
http://www.microchip.com/forums/m770128.aspx
https://learn.sparkfun.com/tutorials/rn-52-bluetooth-hookup-guide/discuss#comment-5241d04ed3ae260a048b4567
Resources and Going Further
Wireless music, how sweet it is! We’ve only just scraped the surface of what the RN-52 is capable of. Try your hand at a project that incorporates the RN-52. You could create your own wireless headset. You could have a home theater system that can stream music from your mobile device. You could even connect an RN-52 to your car stereo and stream tunes from your phone as you travel. The possibilities are endless!
Resources
Here are all the documents listed in this tutorial:
Also, don’t forget to check out the RN-52 GitHub page for all the hardware files and info.
This site is a handy Bluetooth Class of Device (CoD) generator.
For more tutorial action, check out these related tutorials: