Skip to content
Crazyflie 2.0 nRF51 firmware
Branch: master
Clone or download
Arnaud Taffanel
Latest commit 539ac3c Jun 7, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Include Iinitial commit Dec 17, 2014
bootloaders Iinitial commit Dec 17, 2014
interface #29: Implement P2P packet receive functionality Jun 2, 2019
nrf51_sdk Added script to automatically download dependencies from Nordic Semic… Aug 26, 2015
s110 Implementation of device manager in the BLE code to support pairing Apr 21, 2016
src Closes #33: bypass CRTP path for Bootloader packet Jun 7, 2019
tools/build #27 Added platform file for the tag platform. Moved initialization to… Jan 29, 2019
.gitignore Iinitial commit Dec 17, 2014
.travis.yml #27 Added platform file for the tag platform. Moved initialization to… Jan 29, 2019
CONTRIBUTING.md Create CONTRIBUTING.md Oct 24, 2017
Jenkinsfile
LICENSE.txt Added license file Feb 1, 2016
Makefile
config.mk.example Add config.mk.example file. May 14, 2019
flash.jlink Iinitial commit Dec 17, 2014
gcc_nrf51_blank_xxaa.ld Iinitial commit Dec 17, 2014
gcc_nrf51_common.ld Iinitial commit Dec 17, 2014
gcc_nrf51_s110_xxaa.ld Iinitial commit Dec 17, 2014
gcc_startup_nrf51.s Iinitial commit Dec 17, 2014
generate_flash_script.rb Iinitial commit Dec 17, 2014
lgpl-3.0.txt Iinitial commit Dec 17, 2014
module.json #27 Added targets in release builds to build both cf2 and tag platfor… Jan 29, 2019
nrf51.cfg Iinitial commit Dec 17, 2014
readme.md update readme Sep 23, 2016
reset.jlink Iinitial commit Dec 17, 2014
system_nrf51.c Iinitial commit Dec 17, 2014
tag_nrf.hex #27 Added platform file for the tag platform. Moved initialization to… Jan 29, 2019
tag_nrf.map #27 Added platform file for the tag platform. Moved initialization to… Jan 29, 2019

readme.md

Crazyflie 2.0 NRF51 firmware Build Status

Source code of the firmware running in the Crazyflie 2.0 nRF51822. This microcontroller have a couple of roles:

  • Power management (ON/OFF logic and battery handling)
  • Radio communication
    • Enhanced Shockburst compatible with Crazyradio (PA)
    • Bluetooth low energy using the Nordic Semiconductor S110 stack
  • One-wire memory access

Compiling with bluetooth support requires the nRF51_SDK and S110 packages.

./tools/build/download_deps

will download the zips and unpack them. If you want to download manually from the Nordic semiconductor website, you will find the details in nrf51_sdk/readme and s110/readme.

License

Most of the code is licensed under LGPL-3.0.

Some files under src/ble/ are modified from Nordic semiconductor examples.

Compiling

To compile arm-none-eabi- tools from https://launchpad.net/gcc-arm-embedded should be in the path. On Ubuntu, you can install the tools:

sudo apt-get install gcc-arm-none-eabi gdb-arm-none-eabi binutils-arm-none-eabi

Compilation options can be saved in config.mk. Main targets:

make                 # Make with BLE support
make BLE=0           # Make without BLE support
make BLE=0 S110=0    # Make without BLE and without Softdevice in flash (see bellow)

make flash           # Flash firmware with jtag
make factory_reset   # Erase device and flash softdevice, bootloaders, and firmware

Architecture

When running without softdevice (S110=0) the firmware is loaded at the beginning of the flash and is running alone in the CPU.

When running with Softdevive (S110=1) independent of if BLE is activated or not, the flash is filled as follow:

+--------------+ 256k
|     MBS      |    Write protected
+--------------+ 252k
|  Bootloader  |
+--------------+ 232k
|              |
|              |
|              |
|              |
|              |
|  Firmware    |
+--------------+ 88K
|              |
|              |
|              |
|              |
|              |
|              |
|  Softdevice  |
+--------------+ 4K
|     MBR      |    Write protected
+--------------+ 0
  • MBR Softdevice Master Boot Record.
  • SoftDevice S110 Bluetooth stack
  • Firmware This firmware
  • Bootloader Bluetooth/Shockburst bootloader
  • MBS Master Boot Switch

Boot sequence:

 MBR ----> MBS ----> Bootloader ----> Firmware

The MBR is part of the Softdevice. It boots the CPU and jump to MBS. The MBR contains methods to start the Softdevice and can flash softdevice and bootloader.

The MBS handles the ON/OFF button and communicate the duration of the press to the bootloader so that the bootloader knows what to boot. The reason for the MBS is to allow updating the bootloader over the air while still having a write-protected piece of software that can start the STM32 in USB DFU mode for recovery (the STM32 has access to the NRF51 SWD programming port). The boot switch is as follow:

Press time Blue LED state Program booted
Short Still Firmware
Long (>3s) Slow blink Bootloader
Very long (>5s) Fast blink Stays in MBS and power STM32 in USB DFU mode

The bootloader, if selected, starts the STM32 in bootloader mode and initialize both BLE and Shockburst (ESB) radio. It can flash everything but MBR and MBS. It also acts as a bridge to the STM32 bootloader.

If not selected, the bootloader jumps to the firmware.

You can’t perform that action at this time.