This is a modified "BLE_Default_App". It doesn't use retargetStdout() which allows it to work with online Libs available on 20150123 (nRF51822, BLE_API)

Dependencies:   BLE_API mbed nRF51822

FOTA Notes

Just a gathering of notes from my first FOTA test on an nRF51822-mkit, then an nRF51822-EK, and also nRFBeacon (using JLink Lite, or wire to nRF51822-EK)

Troubleshooting:

  1. 20150129PR: To clear the cache immediately after loading a different application by FOTA using Android nRF-MCP:
    • Click "Disconnect", Click "...", click "Refresh Device Cache", click back "<N", click "SCAN"
    • New Device name should appear
    • If "DfuTarg" appears then FOTA Loading was aborted and still in load mode, either:
      • Connect and click "DFU" to retry loading, or
      • Reset Target to exit DfuTarg mode and return to previous application in device.
  2. 20150129PR: If a connection or FOTA DFU loading fails it may be a gatt error occurred due to changes in Device Info not matching cached data (Common in development, unlikely in released devices unless new features added in an upgrade). To Recover:
    • Use Android App "nRF Master Control Panel" (MCP)
      • (I haven't tried this on iPhone App "LightBlue")
    • Note: Device may appear as "DfuTarg" if aborted during FOTA
    • Click "Scan", Click on Device, Instead of connect click "..." then "Refresh Device Cache"
    • Correct device name should appear, now you should be able to connect

FYI: Miscellaneous Notes

  1. After FOTA loading any unused GPIO may hold previous state, initialize all GPIO or reset to clear.
  2. When using the BLE UART in a FOTA App it 'may be necessary' to ensure all transmissions from mbed FOTA are terminated with "/n" to push the transmission over BLE.

FOTA Sample Programs:

  1. Import to your mbed online compiler:

A: Prep mbed Platform for FOTA

  1. Download the FOTA initial hex file from "Default Bootloader" section of:
  2. Copy the hex file to the mbed USB drive of your platform
    • Connect Platform to computer, a virtual drive should appear with file "mbed.htm" (If anything else you are in the wrong mode)
    • When powering up the platform by connecting USB don't press reset or any other buttons
    • drag the hex file to the virtual USB drive
    • wait till the file is fully processed (drive disconnects, then reappears and file is gone
  3. disconnect the USB to powerdown the platform, then reconnect to powerup with FOTA
    • LED1 blinks with initial app installed
    • Debug available on USB Serial "ping..." (TeraTerm 9600,8N1)
    • You may need to Press reset and/or restart TeraTerm depending on what else you do
  4. Use Android App "nRF UART 2.0"
    • Connect to [DefaultApp]
    • Confirm regular "ping" messages
  5. Check FOTA:
    • Start Android App "nRF Master Control Panel" (MCP)
    • Connect to device [DefaultApp]
    • There should be 5 services, including Device Firmware update service
      • If not then disconnect and reconnect to refresh the services list (May be caches from your previous tests)
  6. To restore non-FOTA operation and mbed virtual drive see "Firmware Update" section in

B. Compile sample project for FOTA Platform

  1. Get sample program to your compiler (See Section above "Sample FOTA Programs")
  2. Ensure FOTA variant of your platform is selected
    • i.e. for the mkit select "Nordic nRF51822 FOTA" (not "Nordic nRF51822 mkit")
  3. Option: Modify main.cpp so Device Name and Ping Message will show new program was loaded
  4. Compile, download Hex File. (*Don't copy to mbed drive as this isn't that format)
    • FOTA Hex file should be under 100KB (Application only, no bootloader or softdevice)
    • (Normal mkit non-FOTA hex file should be >250KB)

C. Loading sample project using MCP

  1. copy hex file to Android device (Maybe to the folder "Download")
    • Options: Shared folder, copy over USB cable, email to phone, etc.
  2. Start MCP
  3. Connect to [DefaultApp] which is device name when FOTA Initial is loaded.
  4. Click [DFU] Button, Follow prompts to select Application hex file
    • At this time use "No" for "Init Packet" (Future Feature?)
  5. Allow bootloader to process file
    • New project should run automatically after completed

D. Check loaded sample project

  1. Use MCP to connect
    • In MCP it may be necessary to disconnect/reconnect to refresh the services for new Project on mkit
    • See also Troubleshooting section above
  2. If program supports BLE Serial then use Android App "nRF UART 2.0"
    • Connect to Device
    • Confirm correct device name
    • Confirm ping message and/or echo of typing (FOTA4 can support if enabled)

. ======================================================================================

E. FOTA on an nRF51822-EK (Not an mbed platform, but can run mbed using FOTA)

  1. Start nRFgo Studio on PC
  2. Select the nRF51822-EK
  3. Do [Erase All]
  4. Select Tab [Program Application]
  5. Select the FOTA Initial hex file for the Platform
  6. Program the application (Option: verify)
  7. Disconnect the USB from the nRF51822-EK
  8. Powerup the nRF51822-EK with Battery or USB
  9. Continue with steps A5 through B,C,D
    • Serial Debug over BLE works using App nRF UART 2.0
    • LEDs and Buttons may need IO redefinitions

. ======================================================================================

F. FOTA on an nRF51822-Beacon PCA20006 (Not an mbed platform, but can run mbed using FOTA)

  1. Check that the Beacon still works, and record the LED Behaviour when insert battery (Needed for check in later step)
  2. Remove battery from nRFBeacon, disconnect USB from JLink Lite or EK
  3. Wire P2 on the nRFBeacon to the SWD on the Jlink-Lite from the nRF51822-DK kit, or the nRF51822-EK (PCA10001)
    • use P2 instead of testpoints as less likely to damage circuit if burn these pads. Its tiny work so get help if uncertain of your soldering skills
    • It may be useful to wire in a connector so can disconnect/reconnect the 4 signals later.
    • Signals Required(4): V+ Target, Gnd, SWDIO(=T_TMS), SWDCLK(=T_CLK)
      • The serial signals aren't required for programming (They are only for USB Serial Debug)
    • For the nRF51822-EK turn off SW4, and wire the signals to the mbed IC side of the isolation buffers (Between U4 and R15/R16).
  4. Check before Powering:
    • Check your wiring for incorrect wiring and shorts.
    • Insert Battery in Beacon, Ensure LED still blinks same as before wiring
    • Test that the beacon still transmits properly to a smartphone (nRF MCP App)
  5. Start nRFgo Studio on PC
  6. Select "nRF51 Programming"
  7. Do [Erase All]
  8. Select Tab [Program Application]
  9. Select the FOTA Initial hex file for the Platform
  10. Program the application (Option: verify)
  11. Disconnect:
    • Unplug USB
    • Remove battery
    • Disconnect the nRFBeacon from the programming wiring (or leave if you expect to re-use)
  12. Insert Battery
  13. Continue with steps A5 through B,C,D
    • Serial Debug over BLE works using App nRF UART 2.0
    • LEDs and Buttons may need IO redefinitions

. ======================================================================================

G. You can use mkit or nRF51822-EK to load FOTA onto non-mbed nRF51822 PCBs with easy soldering:

  • To use mkit or EK as a JLINK:
  1. turn off SW4 (isolates JLINK signals)
  2. Solder wires to R15 and R16 (side away from MCU) and Gnd (any header)
    • Signals: GND, SWDIO=T_TMS=R15, SWCLK=T_TCK=R16
    • Ensure Target is same voltage as EK (3.3V) to avoid overdriving and damaging any signals.
  3. Connected signals to a header and glue gunned header to EK for stability
  4. Proceed same as for nRF51822-EK in section E above
  • This works (Worked on nRFBeacon and also on Atomwear).
    • EK's BLE stays active so ensure you connect to correct device
      • EK: use nRFgoStudio to erase EK's nRF51822 before turning off SW4.
      • mkit: If using mkit you can turn off power to nRF51822)
    • Unplugging any connection to JLink header and turning on SW4 re-enables normal EK functionality.

. ======================================================================================


All wikipages