1# BTstack Port for STM32WB55 Nucleo Boards using FreeRTOS 2 3This port supports the Nucleo68 and the USB dongle of the [P-NUCLEO-WB55 kit](https://www.st.com/en/evaluation-tools/p-nucleo-wb55.html). Both have 1 MB of Flash memory. 4 5The STM32Cube_FW_WB_V1.3.0 provides the HAL and WPAN, and initializes the device and the initial Makefile. 6For easy development, Ozone project files are generated as well. 7 8## Hardware 9 10In this port, the Nucelo68 or the USB Dongle from the P-NUCLEO-WB55 can be used. 11 12Last test was done using FUS v1.2 and HCI BLE Firmware v1.13 on Nucleo68 13See STM32Cube_FW_WB_V1.13.0/Projects/STM32WB_Copro_Wireless_Binaries/Release_Notes.html for firmware install instructions. 14 15Note: Segger RTT is currently not really usable. When sleep modes ared disabled for debuggin (see port_thread()) 16RTT works, but the output buffer quickly overflows. In Block mode, radio stops working. 17 18### Nucleo68 19 20The debug output is sent over USART1 and is available via the ST-Link v2. 21 22### USB Dongle 23 24To flash the dongle, SWD can be used via the lower 6 pins on CN1: 25 - 3V3 26 - PB3 - SWO (semi hosting not used) 27 - PA14 - SCLK 28 - PA13 - SWDIO 29 - NRST 30 - GND 31 32The debug output is sent over USART1 and is available via PB6. 33 34## Software 35 36FreeRTOS V10.2.0 is used to run stack, you can get this example version by checking out official repo: 37 38 $ cd Middlewares 39 $ git submodule add https://github.com/aws/amazon-freertos.git 40 $ git submodule update 41 & cd amazon-freertos && git checkout v1.4.8 42 43Or by specifying path to FreeRTOS 44 45 $ make FREERTOS_ROOT=path_to_freertos 46 47To build all examples, run make 48 49 $ make 50 51All examples and the .jedbug Ozone project files are placed in the 'build' folder. 52 53## Flash And Run The Examples 54 55The Makefile builds different versions: 56- example.elf: .elf file with all debug information 57- example.bin: .bin file that can be used for flashing 58 59### Nucleo68 60 61There are different options to flash and debug the Nucleo68 board. The Nucleo68 boards comes with an on-board [ST-Link programmer and debugger](https://www.st.com/en/development-tools/st-link-v2.html). As an alternative, the ST-Link programmer can be replaced by an [SEGGER J-Link OB](https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/). Finally, the STM32 can be programmed with any ARM Cortex JTAG or SWD programmer via the SWD jumper. 62 63### USB Dongle 64 65Please use any ARM Cortex SWD programmer via the SWD interface desribed in the hardware section. 66 67## Run Example Project using Ozone 68 69When using an external J-Link programmer or after installing J-Link OB on the Nucleo68 board, you can flash and debug using the cross-platform [SEGGER Ozone Debugger](https://www.segger.com/products/development-tools/ozone-j-link-debugger/). It is included in some J-Link programmers or can be used for free for evaluation usage. 70 71Just start Ozone and open the .jdebug file in the build folder. When compiled with "ENABLE_SEGGER_RTT", the debug output shows up in the Terminal window of Ozone. Note: as mentioned before, Segger RTT currently stops working when CPU2 has started up. 72 73## Debug output 74 75All debug output can be either send via SEGGER RTT or via USART1. To get the console from USART1, simply connect your board under STLink-v2 to your PC or connect PB6 (USART1 TX) of the Nucleo board to an USB-2-UART adapter and open a terminal at 115200. 76 77In src/btstack_config.h resp. in example/btstack_config.h of the generated projects, additional debug information can be enabled by uncommenting ENABLE_LOG_INFO. 78 79Also, the full packet log can be enabled in src/btstack_port.c by uncommenting the hci_dump_init(..) line. The console output can then be converted into .pklg files for OS X PacketLogger or WireShark by running tool/create_packet_log.py 80 81## GATT Database 82In BTstack, the GATT Database is defined via the .gatt file in the example folder. During the build, the .gatt file is converted into a .h file with a binary representation of the GATT Database and useful defines for the application. 83