User Tools

Site Tools


misc:hacks:betaflight

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
misc:hacks:betaflight [2017-04-07 16:34]
theseankelly [Flashing]
misc:hacks:betaflight [2021-06-24 16:43] (current)
kimberly
Line 1: Line 1:
 +<WRAP center round important 60%>
 +This page has deprecated and will be archived. Please go to [[https://www.bitcraze.io/]].
 +</WRAP>
 +
 +
 ====== Betaflight for Crazyflie 2.0 ====== ====== Betaflight for Crazyflie 2.0 ======
  
Line 4: Line 9:
  
 One of the hallmark features of the Betaflight/Cleanflight/Baseflight ecosystem is support for an extensible "target" framework which allows the firmware to run on a wide variety of ARM chips/boards. This wiki details the CRAZYFLIE2 target. One of the hallmark features of the Betaflight/Cleanflight/Baseflight ecosystem is support for an extensible "target" framework which allows the firmware to run on a wide variety of ARM chips/boards. This wiki details the CRAZYFLIE2 target.
 +
 +===== What's Supported =====
 +This target currently supports basic functionality required to fly - motors, accel/gyro, LEDs, and handling of the syslink/crtp protocols (though, limited to commander packets) from the NRF51.
 +
 +The NRF51 code was intentionally left unchanged so all existing crazyflie clients ought to continue working without modification (including Bluetooth clients). However, currently only DeviationTx and the Android mobile app have been tested. Mileage on the other clients may vary -- please report findings in the forum.
 +
 +The target currently doesn't support the magnetometer, the barometer, or any expansion decks. It also doesn't support many of the crazyflie core features like the logging framework, the parameter framework, etc. 
 +
  
 ====== Setup Instructions ====== ====== Setup Instructions ======
Line 11: Line 24:
  
 ===== Building ===== ===== Building =====
-<WRAP center round info> 
-TEMPORARY: As of this writing, the changes for the Crazyflie 2.0 target have not been merged back into the Betaflight repo -- temporarily working out of a [[https://github.com/theseankelly/betaflight/commits/cf2|private fork]]. Intent is to merge into Betaflight ASAP once a few bugs in the latest Betaflight are ironed out. 
-</WRAP> 
 Execute the following from a bash shell (uses the same toolchain as the crazyflie-firmware project -- this can be done on the [[projects:virtualmachine:index|Bitcraze]] VM for example) Execute the following from a bash shell (uses the same toolchain as the crazyflie-firmware project -- this can be done on the [[projects:virtualmachine:index|Bitcraze]] VM for example)
-  - git clone https://github.com/theseankelly/betaflight +  - git clone https://github.com/betaflight/betaflight
-  - git checkout cf2+
   - export TARGET=CRAZYFLIE2   - export TARGET=CRAZYFLIE2
   - make   - make
-You should see "betaflight_3.2.0_CRAZYFLIE2.hex" appear in the obj directory of the project.+You should see "betaflight_3.2.0_CRAZYFLIE2.hex" (version number may be newer) appear in the obj directory of the project.
  
 ===== Flashing ===== ===== Flashing =====
-To flash the board, follow the [[https://github.com/betaflight/betaflight/wiki/Installing-Betaflight|Betaflight flashing instructions]].+To flash the board, follow the [[https://github.com/betaflight/betaflight/wiki/Installing-Betaflight|Betaflight flashing instructions]]. Be sure to choose 'full chip erase' for the first flash. 
 + 
 +These instructions call for booting with the BOOT0 pin held high to boot the chip into DFU mode. The Crazyflie can be [[projects:crazyflie2:development:dfu|booted in to DFU mode]] without needing to short this pin. Note that the Betaflight configurator will reboot the STM32 after flashing but it will not reset the NRF51 -- the whole board must be power cycled after flashing in order to restore the NRF51's Rx functionality.  
 + 
 +Note: If you've previously installed the libusb-win32 driver on the Crazyflie 2.0 device node using Zadig in Windows, the driver must be changed before it will enumerate as a COM device after flashing. To change the driver, follow these steps: 
 +  - Open device manager 
 +  - Navigate to the 'libusb-win32' device node 
 +  - Right click on Crazyflie 2.0 and choose 'update drivers' 
 +  - select 'browse my computer for driver software' 
 +  - select 'let me pick from a list of available drivers on my computer' 
 +  - select 'USB Serial Device' 
 + 
 +===== Configuring Betaflight ===== 
 +The defaults after flashing should be sufficient for flight.  
 + 
 +Some things of note: 
 +  * It's suggested to change the brushed motor PWM to something higher to reduce audible noise - 24khz works well. 
 +  * Configured to use a TARGET_CUSTOM serial Rx protocol - this is a new feature in betaflight for the crazyflie so that the NRF51 firmware does not need to change. This option was very recently added to the betaflight/cleanflight configurators, so make sure you're using the latest version of the configurators (or just don't change the serialRx protocol drop down -- it will be a blank white box on earlier configurators 
 +  * PIDs have not been tuned for the crazyflie -- the stock PIDs seem to be doing quite well though. 
 + 
 +===== Configuring Transmitter ===== 
 +The NRF51 defaults to 2mbps, channel 2. 
 + 
 +To use a client that uses the legacy commander packet type (cfclient, mobile apps, older versions of DeviationTx) ensure the max roll/pitch angles are set to 50.0 degrees and the max yaw rate is set to 400deg/s. The handler for this packet type rescales the degree setpoint into a PWM-style value (range of 1000-2000) and assumes these values as max values when making the conversion. Using other values should work but might produce unexpected results. 
 + 
 +Using the new CPPM Emulation commander type (supported in [[https://github.com/DeviationTX/deviation/commit/3d61a2b6c0968db2b83878c44266293386c2bc18|Deviation]]) is recommended because it allows up to 10 additional auxiliary channels. 
 + 
  
-These instructions call for booting with the BOOT0 pin held high to boot the chip into DFU mode. The Crazyflie can be [[projects:crazyflie2:development:dfu|booted in to DFU mode]] without needing to short this pin. 
  
  
misc/hacks/betaflight.1491575652.txt.gz · Last modified: 2017-04-07 16:34 by theseankelly