Skip to content
guohui edited this page Nov 7, 2014 · 10 revisions

DFU-OTA for Blend / BlendMicro


Device Firmware Update for Blend / BlendMicro Over The Air.

Last updated: 2014/11/07

File Brief


  • Source: it contains the source code and makefile to generate the DFU-OTA bootloader for Blend / BlendMicro.

  • Release: it contains the DFU-OTA bootloader we have generated for Blend / Blend Micro.

  • Jump2DFU: it contains a sketch and the corresponding hex file that running on Blend / Blend Micro. The sketch demonstrates that when Blend / Blend Micro received a "DFU" string from central device, it will jump to the bootloader (no matter whether it is the DFU-OTA bootloader or the typical serial bootloader).

  • Tools: It contains the App running on MAC OS X to make you upload firmware to Blend / BlendMicro Over-The-Air(OTA).

DFU-OTA Bootloader Deployment


  1. Download our Blend / BlendMicro add-on pakage for Arduino 1.0.5 and follow the README to add it to Arduino.
    Alt text

  2. Copy the hex file we have generated for Blend / BlendMicro bootloader that under the "Release" folder, to under the folder:

     "Documents\Arduino\hardware\blend\bootloaders\caterina"  
    

and Then rename it with "Caterina-Blend.hex" (which is for Blend) or "Caterina-BlendMicro.hex" (which is for BlendMicro). You'd better backup the previous hex file for Blend \ BlendMicro.
If you want to generate the bootloader for Blend / BlendMicro yourself, please follow the belowing steps:

- Navigate to the "**Source**" folder, copy the sub-folder "ble-caterina" to the folder "Documents\Arduino\hardware\blend\bootloaders", which under where the Blend / BlendMicro add-on package installed. Backup the previous folder of "caterina" fisrt and rename the "ble-caterina" folder with "caterina".   

- Open the makefile under the renamed "caterina" folder with editor. Modify the LUFA library relative path according to where the LUFA folder located. The default relative path is:  

		\# Path to the LUFA library  
		LUFA_PATH = ../../../../../../LUFA/LUFA-111009  

But the default location of the LUFA folder is under the "caterina" folder, where the same as makefile, so you need to modify the relative path to:

		\# Path to the LUFA library  
		LUFA_PATH = LUFA/LUFA-111009  

- Open your command line terminal and change the work directory to where the makefile located. Run "make all" command to generate an hex file, which is DFU-OTA bootloader.  

- Rename the generated hex file with "Caterina-Blend.hex" (which is for Blend) or "Caterina-BlendMicro.hex" (which is for BlendMicro).  
  1. You need an Arduino board with Arduino ISP sketch programmed. Connect Blend / BlendMicro with the Arduino board. More info about Arduino ISP, please refer to Using an Arduino as an AVR ISP .

  2. Open Arduino IDE, select the target board:Tools->Board->Blend if you are going to deploy the DFU-OTA bootloader for Blend, or select the target board:Tools->Board->Blend Micro 3.3v/8MHz if you are going to deploy the DFU-OTA bootloader for BlendMicro. Burn the bootloader:Tools->Burn Bootloader. After burning the bootloader, the on-board led will blink breathely. Now you can upload firmware to Blend / BlendMicro Over-The-Air.

NOTE: The DFU-OTA bootloader disables the serial ability, so you can not upload sketch through Arduino IDE. To enable uploding through Arduino IDE, you have to burn the typical serial bootloader for Blend / BlendMicro.

Firmware preparation


You may not find the hex or bin file after Arduino IDE compiling the sketch, since the hex and bin file are temporary files and are deleted after compilation finished. Please follow the steps to obtain the hex or bin file after you compiling the sketch.

  1. Open Arduino IDE. Click on "File->Preferences".
    Alt text

  2. On the pop up window, click on the string below "More preferences can be edited directly in the file" and it will pop up the file browser to show where the preferences.txt located.
    Alt text

  3. Close the Arduino IDE! It is important to close the Arduino IDE before editing the preferences.txt, otherwise, the modification of the file will make no effect.

  4. Open the preferences.txt with text editor. Add a variable "build.path". The value of the variable is the path that you want to place the hex and bin files after compiling a corresponding sketch. E.g.,

     build.path=C:\Users\dell\Documents\Arduino\Hex  
    

Then the hex file and the other object files will be placed under the "C:\Users\dell\Documents\Arduino\Hex" folder when compiling a sketch.

  1. Open your sketch with Arduino IDE. Select the board: "Tools > Board > Blend" or "Tools > Board > Blend Micro 3.3v/8MHz".

  2. click on the "Compile" button at the IDE toolbar to begin compiling. When compilation complete, the hex and bin file should have been placed at the path: "C:\Users\dell\Documents\Arduino\Hex".

Note: If you want to write the sketch for Blend / BlendMicro with BLE utility implemented, you should follow this instruction to set up the nRF8001 libraries for arduino first. And in the sketch, you should add the function ble_ reset(uint8_ t reset_ pin) before ble_ begin() is called. Otherwise, when uploaded the sketch, it will still advertise the DFU service, unless re-power on the Blend / Blend Micro.

DFU-OTA on nRF Toolbox


  1. Download nRF Toolbox on App Store or Google play.

  2. Download and install Dropbox, Mail, QQ or any other Apps that can synchronize the firmware from PC to your iOS or Android device.

  3. Synchronize the firmware (e.i. the hex file generated after compiling the sketch), to your iOS or Android device. Navigate to the firmware you have synchronized and open it with nRF Toolbox.

  4. Power on Blend / BlendMicro. If there is no sketch running on it, it will run the DFU-OTA bootloader forever. If you have burnt a sketch to it, just reset it to run DFU-OTA bootloader and it will last running the bootloader for about 16 seconds, and then jump to the sketch. You should ensure that it is running the DFU-OTA bootloader when performing the DFU OTA using nRF Toolbox.

  5. Touch the "SELECT DEVICE" button on nRF Toolbox. It will show the device list around you and select the "DFU" device as the target.
    Alt text Alt text

  6. Touch the "Upload" button to begin uploading the firmware to Blend / BlendMicro Over-The-Air. When upload completed, the sketch begins running if it is valid.
    Alt text Alt text

DFU-OTA on Mac OS X App


In the "Tools\Mac OS X" folder, you will find the DFU_OTA.zip. After unzip the package, it is the App that implement you uploading firmware to Blend / BlendMicro.
Alt text

Upload Prepared Firmware

  1. Please follow the "Firmware preparation" section to set up the path where the firmware will be placed after compiling the sketch.

  2. Run the App and click on the ".hex / .bin" button. It will pop up the file browser to let you select the firmware (either be a hex or a bin file) for Blend / BlendMicro.

  3. Navigate to where the firmware is located and select it to be uploaded.
    Alt text

  4. Power on Blend / BlendMicro. If there is no sketch running on it, it will run the DFU-OTA bootloader forever. If you have burnt a sketch to it, just reset it to run DFU-OTA bootloader and it will last running the bootloader for about 16 seconds, and then jump to the sketch. You should ensure that it is running the DFU-OTA bootloader when performing the DFU OTA using the App.

  5. Click on "Upload" to begin uploading the firmware to Blend / BlendMicro Over-The-Air. When upload completed, the sketch begins running if it is valid.
    Alt text

Arduino Upload

  1. Copy the folder "Contents" that under "Tools\Mac OS X\Arduino1.0.5" (or "Arduino1.0.6" if you have installed Arduino version 1.0.6) to cover the Arduino contents folder. The files will be added or replaced are:

    • Info.plist
    • RXTXcomm.jar
    • gnu.io.rxtx.properties

    So you'd better backup these previous files if you want to restore these files in the future.

  2. Run the App and click on the "Associate" button.
    Alt text

  3. Open your sketch with Arduino IDE 1.0.5.

    • Select the board: "Tools > Board > Blend" or "Tools > Board > Blend Micro 3.3v/8MHz".
    • Select the serial port: "Tools > Serial Port > /tmp/tty.RBL-BLE"
      Alt text
  4. Power on Blend / BlendMicro. If there is no sketch running on it, it will run the DFU-OTA bootloader forever. If you have burnt a sketch to it, just reset it to run DFU-OTA bootloader and it will last running the bootloader for about 16 seconds, and then jump to the sketch. You should ensure that it is running the DFU-OTA bootloader when performing the DFU OTA using the App.

  5. Click on the Right Arrow button at the IDE toolbar to begin upload (it will compile first). When upload complete, the App will scan the device with DFU service automatically. If there is a device running DFU-OTA bootloader, it will connect to it and begin uploading. If there is no device found, it will enable the "Upload" button to let you upload the firmware manually. Then you can reset the Blend / BlendMicro to run the DFU-OTA bootloader and click on the "Upload" button to begin uploading. Alt text

Example


In the "Jump2DFU" folder, there is a prepared firmware for Blend / BlendMicro and a sketch to generate the firmware. Here we demonstrate how to upload the firmware to Blend / BlendMicro Over-The-Air using nRF Toolbox on iPod Touch and what the firmware is designed for.

  1. Send the firmware, e.i. the hex file in the "Jump2DFU" folder, to ipod Touch through Gmail (or other Apps as mentioned above).

  2. Power on Blend / BlendMicro and make it run the DFU-OTA bootloader.

  3. Open the received hex file with nRF Toolbox. Click on the "SELECT DEVICE" button to select the device "DFU". Then click "Upload".

  4. After upload complete, the on-board led starts blinking. Use our BLE Controller > Simple Chat App to send the "DFU" string to Blend / Blend Micro, it will jump to the DFU-OTA bootloader.

Clone this wiki locally