Products
-
-
- Accessories
- Breakout boards
This page has deprecated and moved to the new documentation framework of the main Bitcraze website. Please go to https://www.bitcraze.io/documentation/system/
This page aims at documenting how to start developing with Crazyflie. This document should work for both Crazyflie 1 and Crazyflie 2.0.
To develop for Crazyflie you should have a Crazyflie (1 or 2.0) and a Crazyradio (PA). Jtag or SWD programming cable is not strictly required, though if you plan on doing complex development it is very advised.
As for software, this page assumes you are running the bitcraze VM 0.6, it makes it a lot easier to describe a unified enviroment. The virtual machine runs under VirtualBox with 1G of RAM, it means that you will need a computer on Windows, Linux or Mac OS with 4G of ram to run it. Alternatively you can install the required development environment on your machine.
Crazyflie firmware is witten in C. To modify it you should know how to program in C and having some embedded system experience is a plus. Just keep in mind that Crazyflie 1 has 20K of ram and Crazyflie 2.0 196K (which is pretty big by our standard!).
The official host-side lib and client is written in Python so knowledge of python is advised. There are good online material to learn python.
Third party libs and clients exists in other languages as well. Though, for the beginning, it might be easier getting some thing to work in python as it is updated along with the firmware.
All source code repository are managed with Git and hosted on github. You need to be familiar with git in order to save your work and be able to contribute code back.
Clone the crazyflie-firmware project, or update it using the virtual machine “Update all projects” script. For Crazyflie 2.0 or Crazyflie Nano (1.0) make sure the current branch is “master.”
~$ cd projects/crazyflie-firmware/ crazyflie-firmware$ git checkout master # For Crazyflie Nano (1.0) or Crazyflie 2.0
Then make the firmware.
For Crazyflie 2.0:
crazyflie-firmware$ make (...) DFUse cf2.dfu Crazyflie 2.0 build! Build 54:b4b7a369d1f4 (2015.08.1-54) CLEAN Version extracted from git Crazyloader build! text data bss dec hex filename 85844 1248 29856 116948 1c8d4 cf2.elf rm version.c crazyflie-firmware$
Or, for Crazyflie Nano (1.0):
crazyflie-firmware$ make PLATFORM=CF1 (...) DFUse cf1.dfu Crazyflie Nano (1.0) build! Build 54:b4b7a369d1f4 (2015.08.1-54) CLEAN Version extracted from git Crazyloader build! text data bss dec hex filename 66068 356 19796 86220 150cc cf1.elf rm version.c crazyflie-firmware$
To program using the radio bootloader:
For Crazyflie 2.0:
crazyflie-firmware$ make cload
Or, for Crazyflie Nano (1.0):
crazyflie-firmware$ make cload PLATFORM=CF1
To be able to flash code without using the radio and to debug it a Jtag or SWD cable is needed.
By default any cable supported by openODC can be used. STLink-V2 is used by the Bitcraze team. Other cables like JLink can also be used but will require to manually enter the flashing command line and to modify Eclipse configuration.
Makefiles are configured to use STLink-V2 by default, to configure another programming cable create a file named config.mk in the project root folder:
OPENOCD_INTERFACE ?= interface/stlink-v2.cfg OPENOCD_TARGET ?= target/stm32f4x_stlink.cfg
The SEGGER J-LINK can be used for debugging and flashing.
OPENOCD_INTERFACE ?= interface/jlink.cfg OPENOCD_TARGET ?= target/nrf51.cfg OPENOCD_CMDS ?= -c "set WORKAREASIZE 0" -c "transport select swd"
OPENOCD_INTERFACE ?= interface/jlink.cfg OPENOCD_TARGET ?= target/stm32f4x.cfg OPENOCD_CMDS ?= -c "transport select swd"
./JLinkExe -device STM32F405RG -if swd -speed 4000
From command line the flash make target flashed the firmware using programming cable
make flash
The EEPROM stores configuration data, which persists even after a firmware update. You might want to reset this information. For example, if you forget the address of your Crazyflie, you won't be able to connect wirelessly anymore. In order to reset the EEPROM, follow the following steps:
python3 write-eeprom.py
This will find your first Crazyflie (which is the one you connected over USB) and write the default values to the EEPROM.