xref: /btstack/port/stm32-f4discovery-usb/README.md (revision 34fd36da1820bede7fdeb1f09f53c180688c8c25)
1*34fd36daSMatthias Ringwald# BTstack Port for STM32 F4 Discovery Board with USB Bluetooth Controller
2*34fd36daSMatthias Ringwald
3*34fd36daSMatthias RingwaldThis port uses the STM32 F4 Discovery Board with an USB Bluetooth Controller plugged into its USB UTG port.
4*34fd36daSMatthias RingwaldSee [blog post](https://bluekitchen-gmbh.com/btstack-stm32-usb-port/) for details.
5*34fd36daSMatthias Ringwald
6*34fd36daSMatthias RingwaldSTCubeMX was used to provide the HAL, initialize the device, and the Makefile. For easy development, Ozone project files are generated as well.
7*34fd36daSMatthias Ringwald
8*34fd36daSMatthias Ringwald## Hardware
9*34fd36daSMatthias Ringwald
10*34fd36daSMatthias RingwaldSTM32 Development kit with USB OTG adapter and USB CSR8510 Bluetooth Controller
11*34fd36daSMatthias Ringwald- [STM32 F4 Discovery Board](http://www.st.com/en/evaluation-tools/stm32f4discovery.html)
12*34fd36daSMatthias Ringwald
13*34fd36daSMatthias Ringwald## Software
14*34fd36daSMatthias Ringwald
15*34fd36daSMatthias RingwaldTo build all examples, run make
16*34fd36daSMatthias Ringwald
17*34fd36daSMatthias Ringwald	$ make
18*34fd36daSMatthias Ringwald
19*34fd36daSMatthias RingwaldAll examples and the .jedbug Ozone project files are placed in the 'build' folder.
20*34fd36daSMatthias Ringwald
21*34fd36daSMatthias Ringwald
22*34fd36daSMatthias Ringwald## Flash And Run The Examples
23*34fd36daSMatthias Ringwald
24*34fd36daSMatthias RingwaldThe Makefile builds different versions:
25*34fd36daSMatthias Ringwald- example.elf: .elf file with all debug information
26*34fd36daSMatthias Ringwald- example.bin: .bin file that can be used for flashing
27*34fd36daSMatthias Ringwald
28*34fd36daSMatthias RingwaldThere are different options to flash and debug the F4 Discovery board. The F4 Discovery 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.
29*34fd36daSMatthias Ringwald
30*34fd36daSMatthias Ringwald## Run Example Project using Ozone
31*34fd36daSMatthias Ringwald
32*34fd36daSMatthias RingwaldWhen using an external J-Link programmer or after installing J-Link OB on the F4 Discovery 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.
33*34fd36daSMatthias Ringwald
34*34fd36daSMatthias RingwaldJust 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.
35*34fd36daSMatthias Ringwald
36*34fd36daSMatthias Ringwald
37*34fd36daSMatthias Ringwald## Debug output
38*34fd36daSMatthias Ringwald
39*34fd36daSMatthias RingwaldThe debug output can send via SEGGER RTT.
40*34fd36daSMatthias Ringwald
41*34fd36daSMatthias RingwaldIn 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.
42*34fd36daSMatthias Ringwald
43*34fd36daSMatthias RingwaldAlso, the full packet log can be enabled in src/port.c resp. btstack/port/stm32-f4discovery-cc256x/src/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
44*34fd36daSMatthias Ringwald
45*34fd36daSMatthias Ringwald## GATT Database
46*34fd36daSMatthias RingwaldIn BTstack, the GATT Database is defined via the .gatt file in the example folder. The Makefile contains rules to update the .h file when the .gatt was modified.
47*34fd36daSMatthias Ringwald
48*34fd36daSMatthias Ringwald
49*34fd36daSMatthias Ringwald## Maintainer Notes - Updating The Port
50*34fd36daSMatthias Ringwald
51*34fd36daSMatthias RingwaldThe Audio BSP is from the STM32F4Cube V1.16 firmware and not generated from STM32CubeMX. To update the HAL, run 'generate code' in CubeMX. After that, make sure to re-apply the patches to the UART and check if the hal config was changed.
52*34fd36daSMatthias Ringwald
53