Modified based on the open source project tiny-blackbox, it is suitable for flight control external black box recording. Default onboard 16M
tiny box black box
Tiny Blackbox is an open source ultra-light external recorder for micro drones.
Dimensions: 9 x 14 mm
Weight: 0.47 g
Recording rate: up to 4 kHz
Data rate: 1.5 Mbit/s
Current consumption: < 30 mA
Flash memory: 16 MB, W25Q128JVPIQ
Microcontroller: STM32F042G6U6

Setup

Connect the device to the flight control (RX-> Any available UART port on TX, TX->RX).
Set up the black box in the betaflight configurator:
Ports tab: Peripherals -> Black box logging, speed 1500000.
Modes tab: blackbox -> assign to any available AUX switch. @vinvaa Note: You can also not set this switch. By default, the log will be recorded directly in
the Blackbox tab: Recording Device -> Serial Port.
Screenshot

: The flight control log data is recorded by default after powering on.
Press and hold for 1 second to read the log mode.
Press and hold again for 3 seconds to clear all logs.

Read the recorded log
and configure the flight control bf_uart_number value in config.json to match the black box port number in Betaflight.
Connect the flight controller to the computer.
Press and hold the button for 1 second to switch to read mode (two flashes).
Run the Python script tinybb.py. This script automatically converts the flight controller to serial pass-through mode.
Use the r command to save logs from flash memory to a file.
Open the file using Black Box Explorer and enjoy :-)
'
You may need to install the pySerial module before running the script. Type pip3 install pyserial into the command prompt (cmd.exe or terminal).
CLI output example: Open /dev/cu.usbmodemFA131 successfully
===== Betafligh CLI mode =====>> Entering CLI Mode, type 'exit' to return, or 'help'>> # serialpassthrough 1 500000>> Port1: 1>> Port2: 20>> Port1 opened, baud = 500000.>> Forwarding, power cycle to exit.======================== ======
Flash memory: 38.0% full
i - Informationr - Read memory - Dump full memory - Erasex - Exit
Enter command: > r
Downloading:Press ctrl+c to stop..... ..... 1 Mb............. 2 Mb............. 3 Mb....... ......... 4 Mb............ 5 Mb............ 6 Mb.6391040 bytes receivedBlackbox_Log_20210213_112830.bbl saved>
For developers and enthusiasts
building firmware using STM32CubeIDE
Flash pre-built hex firmware with STM32CubeProg or STLink toolset.
Connect the ST-Link programmer to the following pins:

Future plans
Cross-platform GUI
support 8 kHz recording rate
Feel free to contact me on Telegram: @AlexeyStn