xref: /btstack/port/stm32-wb55xx-nucleo-freertos/README.md (revision 0561b2d8d5dba972c7daa57d5e677f7a1327edfd)
1*0561b2d8STREFOU Felix# BTstack port for STM32WB55 Nucleo Boards using FreeRTOS
2*0561b2d8STREFOU Felix
3*0561b2d8STREFOU FelixThis 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*0561b2d8STREFOU Felix
5*0561b2d8STREFOU FelixThe STM32Cube_FW_WB_V1.3.0 provides the HAL and WPAN, and initializes the device and the initial Makefile.
6*0561b2d8STREFOU FelixFor easy development, Ozone project files are generated as well.
7*0561b2d8STREFOU Felix
8*0561b2d8STREFOU Felix## Hardware
9*0561b2d8STREFOU Felix
10*0561b2d8STREFOU FelixIn this port, the Nucelo68 or the USB Dongle from the P-NUCLEO-WB55 can be used.
11*0561b2d8STREFOU FelixDevelopment was done using FUS v1.0.1 and v1.0.2 and Full BLE Stack v1.3.1.
12*0561b2d8STREFOU FelixSee STM32Cube_FW_WB_V1.3.0/Projects/STM32WB_Copro_Wireless_Binaries/Release_Notes.html for update instructions.
13*0561b2d8STREFOU Felix
14*0561b2d8STREFOU FelixNote: Segger RTT currently doesn't work as output stops after CPU2 (radio controller) has started up.
15*0561b2d8STREFOU Felix
16*0561b2d8STREFOU Felix### Nucleo68
17*0561b2d8STREFOU Felix
18*0561b2d8STREFOU FelixThe debug output is sent over USART1 and is available via the ST-Link v2.
19*0561b2d8STREFOU Felix
20*0561b2d8STREFOU Felix### USB Dongle
21*0561b2d8STREFOU Felix
22*0561b2d8STREFOU FelixTo flash the dongle, SWD can be used via the lower 6 pins on CN1:
23*0561b2d8STREFOU Felix  - 3V3
24*0561b2d8STREFOU Felix  - PB3 - SWO (semi hosting not used)
25*0561b2d8STREFOU Felix  - PA14 - SCLK
26*0561b2d8STREFOU Felix  - PA13 - SWDIO
27*0561b2d8STREFOU Felix  - NRST
28*0561b2d8STREFOU Felix  - GND
29*0561b2d8STREFOU Felix
30*0561b2d8STREFOU FelixThe debug output is sent over USART1 and is available via PB6.
31*0561b2d8STREFOU Felix
32*0561b2d8STREFOU Felix## Software
33*0561b2d8STREFOU Felix
34*0561b2d8STREFOU FelixFreeRTOS V10.2.0 is used to run stack, you can get this example version by checking out official repo:
35*0561b2d8STREFOU Felix
36*0561b2d8STREFOU Felix	$ cd Middlewares
37*0561b2d8STREFOU Felix	$ git submodule add https://github.com/aws/amazon-freertos.git
38*0561b2d8STREFOU Felix	$ git submodule update
39*0561b2d8STREFOU Felix	& cd amazon-freertos && git checkout v1.4.8
40*0561b2d8STREFOU Felix
41*0561b2d8STREFOU FelixOr by specifying path to FreeRTOS
42*0561b2d8STREFOU Felix
43*0561b2d8STREFOU Felix	$ make FREERTOS_ROOT=path_to_freertos
44*0561b2d8STREFOU Felix
45*0561b2d8STREFOU FelixTo build all examples, run make
46*0561b2d8STREFOU Felix
47*0561b2d8STREFOU Felix	$ make
48*0561b2d8STREFOU Felix
49*0561b2d8STREFOU FelixAll examples and the .jedbug Ozone project files are placed in the 'build' folder.
50*0561b2d8STREFOU Felix
51*0561b2d8STREFOU Felix## Flash And Run The Examples
52*0561b2d8STREFOU Felix
53*0561b2d8STREFOU FelixThe Makefile builds different versions:
54*0561b2d8STREFOU Felix- example.elf: .elf file with all debug information
55*0561b2d8STREFOU Felix- example.bin: .bin file that can be used for flashing
56*0561b2d8STREFOU Felix
57*0561b2d8STREFOU Felix### Nucleo68
58*0561b2d8STREFOU Felix
59*0561b2d8STREFOU FelixThere 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.
60*0561b2d8STREFOU Felix
61*0561b2d8STREFOU Felix### USB Dongle
62*0561b2d8STREFOU Felix
63*0561b2d8STREFOU FelixPlease use any ARM Cortex SWD programmer via the SWD interface desribed in the hardware section.
64*0561b2d8STREFOU Felix
65*0561b2d8STREFOU Felix## Run Example Project using Ozone
66*0561b2d8STREFOU Felix
67*0561b2d8STREFOU FelixWhen 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.
68*0561b2d8STREFOU Felix
69*0561b2d8STREFOU FelixJust 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.
70*0561b2d8STREFOU Felix
71*0561b2d8STREFOU Felix## Debug output
72*0561b2d8STREFOU Felix
73*0561b2d8STREFOU FelixAll 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.
74*0561b2d8STREFOU Felix
75*0561b2d8STREFOU FelixIn 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.
76*0561b2d8STREFOU Felix
77*0561b2d8STREFOU FelixAlso, the full packet log can be enabled in src/btstack_port.c by uncommenting the hci_dump_open(..) line. The console output can then be converted into .pklg files for OS X PacketLogger or WireShark by running tool/create_packet_log.py
78*0561b2d8STREFOU Felix
79*0561b2d8STREFOU Felix## GATT Database
80*0561b2d8STREFOU FelixIn 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.
81