Nordic Semiconductor nRF51822 Firmware for Background Data Recording

#Nordic Semiconductor nRF51822 Firmware for Background Data Recording

Updating on https://github.com/scytulip/nrf51-back-rec


Design Objective

This firmware is designed for low-cost long-time low-power unattended data recording.

  • Low-cost: All collected data is preserved in nRF51822, sharing the FLASH memory with the SoftDevice and the program.
  • Unattended: The firmware executes automatic data collection and preservation until data memory area in the FLASH is full.
  • Low-power: The firmware automatically turns off BLE and redundant hardware to extend battery life.

BLE Link could be intentionally enabled to transfer data. When a BLE connection is created, the firmware will report the data reading through BLE Heart Rate Monitor (HRM) service to the central device instantly. If a file transfer command is issued by the central device. The firmware will stop data recording and start the file transfer. After the transfer is finished, the central device should issue a resume command to restart data recording.

This demo version implements a MAXIM DS1621+ I2C interface temperature sensor as the data source for temperature collection. You can modify it for any other purpose.


Function Description

Sleep Mode

  • After the first power cycle (the battery is replaced or the RESET button is pressed), both LED0 and LED1 are ON for a short time to initialize the firmware, and then turn OFF. System goes into the Sleep Mode.
  • Power OFF
    • When the device is activated (not in the Sleep Mode), pushing and holding BUTTON 0 can put the device into the Sleep Mode. Both LED0 and LED1 are ON if the button is recognized.
    • When the device is activated (not in the Sleep Mode), pushing and holding BUTTON 1 can clear the data memory in the FLASH and then put the device into the Sleep Mode. Both LED0 and LED1 are ON if the button is recognized.

Recording Mode

  • Press BUTTON 0 to activate the device. When activated, both of LED0 and LED1 may flash. The firmware is in Recording Mode.
    • If only LED0 is flashing, data is being recorded.
    • If both LED0 and LED1 are flashing alternatively, recording is not going on and the data memory in the FLASH is full.
  • In the Recording Mode, click BUTTON 0 to turn on the BLE Discovery Mode.

BLE Discovery Mode

  • In the BLE Discovery Mode, LED0 keeps ON and LED1 keeps OFF.
    • If BLE is not connected in APP_ADV_TIMEOUT_IN_SECONDS seconds, the firmware will disable the BLE and goes back to Recording Mode.
    • If BLE is connected, the firmware enters the BLE Connected Mode.
  • At any time in the BLE Discovery Mode, click BUTTON 0 to return back to the Recording Mode.

BLE Connected Mode

  • In the BLE Connected Mode, LED0 will go OFF and LED1 keeps ON. Several BLE services can be accessed.
    • By default, collected data is sent instantly through the BLE Heart Rate Monitor service (even it's temperature data) to be visualized on a central device. In this case, the background recording is still in progress.
    • If a file transfer command is issued by the central, background recording will be stopped and the content of the data memory in the FLASH will be sent through Nordic BLE UART service. It takes some time to finish. After the transfer, the firmware will wait for a resume command to restart background recording.
    • If BLE is disconnected at any time, the firmware will go back to the Recording Mode.
  • At any time in the BLE Connected Mode, click BUTTON 0 to disconnect and return back to the Recording Mode.

Firmware Information

Development Environment

  • Evaluation Kit: PCA 10001 V2.2.0 2014.15
  • SoftDevice: S110-SD-v7 7.1.0
  • SDK: nrf51 SDK v6.1.0

Hardware Configuration

  • Board Configuration Board
  • Same issue. Digging found that Nordic UART Service "nus" isn't included in SDK6.1.0, but is in experimental project of SDK6.0.0, so I extracted only experimental\ble_app_uart from SDK6.1.0 (nrf51_sdk_v6_0_0_43681.zip):

    • ...\board\pca10001\s110\experimental\ble_app_uart

    Then copied ble_nus.c and ble_nus.h to this project:

    • ...\board\pca10001\s110\nrf51-back-rec

    It compiles OK now and connects with Andoid App nRF UART v2.0, it seems to run as describes but further testing required to confirm.

  • I'm trying to compile however it cannot find ble_nus.h in ..\peri\back_dat.c. Please let me know where I can find this. Thank you. I am using the correct SDK.