RN4020 firmware upgrade tutorial

Teodor Costachioiu
May 24, 2016 · 4 min read

One of many click boards that I have is a BLE2 click from MikroElektronika, a Bluetooth Low Energy board based on the BLE2 click from MikroElektronika, a Bluetooth Low Energy board based on the RN4020 Bluetooth 4.1 (aka Bluetooth Low Energy or BLE) from Microchip. This particular click board came with firmware version 1.10, and I needed firmware 1.33 for a project that I’m working on. So, time for a firmware upgrade.

Easier said than done. The RN4020 DFU utility requires hardware flow control, while on this particular click board the RTS/PIO6 and CTS/PIO5 pins of the RN4020 module are left floating. The only way to upgrade the firmware is to connect those pins, as the application requires. So, time for some fancy soldering 🙂

A fair warning: performing the procedures described in these tutorials have the potential to brick (permanently damage) your click board. You need above the average soldering skills and a good rework station.

I will start with the BLE2 click and one 3.3V USB-UART click installed on a breadboard. The USB-UART is used to provide the power to the BLE2 click. The following connections are made:

  • USB-UART RX <-> BLE2 TX
  • USB-UART TX <-> BLE2 RX
  • USB-UART 3V3 <-> Vcc
  • BLE2 3V3 <-> Vcc
  • USB-UART GND <-> GND
  • BLE2 GND <-> GND
  • BLE2 CMD/MLDP <-> Vcc
  • BLE2 SWAKE <-> Vcc

With the above connections, you should be able to use a terminal program such as TerraTerm to communicate with your BLE2 click (use baud 115200, 8, N, 1, no flow control). If all is working fine and you have established communication it’s time to go to the next step: enabling flow control.

Connecting BLE2 and USB-UART click boards

To enable hardware flow control one must use the RTS/PIO6 and CTS/PIO5 pins of the RN4020 module. I have soldered some very thin wire on those pins, using a 0,5mm soldering tip. The result looks like this:

BLE2 click: hardware flow control connections

The white wire is BLE2 CTS/PIO5 and is connected to the RTS pin of the USB-UART click. The blue wire is BLE2 RTS/PIO6 and it goes to the CTS pin of the USB-UART click.

Once again, we test if everything goes fine. So, we connect with TerraTerm as described above and we run the following commands:

+
Echo on
SR,32000000
OK
R,1
Reboot
CMD

The + command enables echo, SR3200000 sets the device as peripheral with an automatic advertisement, support for MLDP and flow control features. R.1 reboots the RN4020 with the new settings.

Now we are ready to flash the hardware. We start the RN4020 DFU utility (ver1.1) and we scan for available COM ports. Once the scan completes, we can use the drop-down menu to select our port (COM7 in this tutorial). Then we select the firmware file — I will use the latest version, which is RN4020BEC_133_112415_DFU, then click the Update button. If all the connections are OK you should see the update progressing. If something is connected wrong there will be an error message and the upgrade will not start.

Once updated we can connect again with TerraTerm, but with flow control disabled. This is necessary as the hardware flow control is disabled after the update process and the RN4020 is reset to the factory values. Now if you run the V command you should see the new firmware version.

Now you can remove the wires for RTS and CTS, or, if you wish, you can re-route them to some of the NC pins of the click board.

A complicated procedure, but what’s the gain? First, the RN4020 user manual is for the 1.23 firmware version. Now everything described in that manual will work. Besides this there are some new features in the 1.33 firmware that is not in the manual:

  • Custom Advertising broadcast packets
  • GATT Service Definition Enhancement for both public and private services
  • Private (random) MAC address for Advertisement

For more information, you should check the RN4020-Firmware-1.33BEC-Release-Note.

Originally published at https://electronza.com on May 24, 2016.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store