This repository contains the source code for the Bitcraze Crazyflie 2.0/2.1 utilizing ARM Mbed OS.
Below are step by step instructions to program the Bitcraze Crazyflie 2.0/2.1.
The first step is to fork this repository, which means to create a copy of this repository in your own GitHub account:
- Click on
Fork
After you have forked the repository, you should import it to Mbed Studio, an IDE designed specific for ARM Mbed OS (Windows/Mac/Linux):
- Install and open Mbed Studio
- Click on
File
>Import Program...
- Paste
https://github.com/user_name/crazyflie-firmware/
underURL
and then clickAdd Program
Don't forget to change user_name
with your GitHub username.
Next step is to set the target you'll be utilizing, that's it, the microcontroller you will be developing for. The microcontroller from Bitcraze Crazyflie 2.0/2.1 (STM32F405RG) is not available for ARM Mbed OS. However, the microcontroller from Seeed Arch Max development board (STM32F407VE) is very similar and can be utilized with little adjustments:
- Click on
Target
and chooseSeeed Arch Max (ARCH-MAX)
- Navigate to file
mbed-os
>targets
>TARGET_STM
>TARGET_STM32F4
>TARGET_STM32F407xG
>device
>TOOLCHAIN_ARM_STD
>STM32F407xx.sct
and modify the code of line 9:
#define MBED_APP_START 0x08004000
- Navigate to file
mbed-os
>targets
>TARGET_STM
>TARGET_STM32F4
>TARGET_STM32F407xG
>TARGET_ARCH_MAX
>PeripheralPins.c
and add a line of code between lines 135 and 136:
{PB_11, PWM_2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM2_CH4
Now you're ready to build your program, in other words, to create an binary file from your source code:
- Click on
Build program
Last step is to send this binary file to your microcontroller, which is called flash. This can be done wirellesly with the Bitcraze Crazyradio PA, an USB radio dongle, and the crazyflie-clients-python, an PC client:
- Install crazyflie-clients-python
- Plug in the Bitcraze Crazyradio PA
- Put the Bitcraze Crazyflie 2.0/2.1 in program mode:
- Turn off the drone
- Hold down the push button for about 1 second until you the blue led starts blinking
- Release the push button button
- Open console (
CRTL
`
) - Change directory to where the project is located (type
cd crazyflie-firmware
in the console) - Send the binary file to the drone (type
make flash
in the console)
The source code is organized as follows:
./ | Root
main.cpp | Main program
programs | Program files
| examples | Examples
| labs | Labs
src | Source files
| drivers | Sensor drivers
| modules | Controller modules
| utils | Utility files
mbed-os | ARM Mbed OS library (automatically imported)
USBDevice | USB Device library (automatically imported)