xref: /btstack/port/stm32-l073rz-nucleo-em9304/README.md (revision 34fd36da1820bede7fdeb1f09f53c180688c8c25)
1*34fd36daSMatthias Ringwald# BTstack Port for STM32 Nucleo L073RZ Board with EM9304 Controller
2e8380792SMatthias Ringwald
3e8380792SMatthias RingwaldThis port uses the STM32 Nucleo-L073RZ Board with EM's EM9304 Shield.
4e8380792SMatthias Ringwald
5e8380792SMatthias RingwaldThe STM32CubeMX tool was used to provide the HAL, initialize the device, and create a basic Makefile. The Makefile has been exteneded to compile all BTstack LE examples.
6e8380792SMatthias RingwaldFor easy development, Ozone project files are generated as well.
7e8380792SMatthias Ringwald
8e8380792SMatthias Ringwald## Hardware
9e8380792SMatthias Ringwald
10e8380792SMatthias RingwaldIn this port, the EM9304 is conencted via the SPI1 interface and configured for 8 Mhz. [Datasheet for the EM9304](http://www.emmicroelectronic.com/sites/default/files/public/products/datasheets/9304-ds_0.pdf)
11e8380792SMatthias Ringwald
12e8380792SMatthias RingwaldIt assumes that the EM9304 does not contain any patches and uploads the latest Metapatch during startup.
13e8380792SMatthias Ringwald
14e8380792SMatthias Ringwald## Software
15e8380792SMatthias Ringwald
16e8380792SMatthias RingwaldTo build all examples, run make
17e8380792SMatthias Ringwald
18e8380792SMatthias Ringwald	$ make
19e8380792SMatthias Ringwald
20e8380792SMatthias RingwaldAll examples and the .jedbug Ozone project files are placed in the 'build' folder.
21e8380792SMatthias Ringwald
22e8380792SMatthias Ringwald## Flash And Run The Examples
23e8380792SMatthias Ringwald
24e8380792SMatthias RingwaldThe Makefile builds different versions:
25e8380792SMatthias Ringwald- example.elf: .elf file with all debug information
26e8380792SMatthias Ringwald- example.bin: .bin file that can be used for flashing
27e8380792SMatthias Ringwald
28e8380792SMatthias 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.
29e8380792SMatthias Ringwald
30e8380792SMatthias Ringwald## Run Example Project using Ozone
31e8380792SMatthias Ringwald
32e8380792SMatthias 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.
33e8380792SMatthias Ringwald
34e8380792SMatthias 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.
35e8380792SMatthias Ringwald
36e8380792SMatthias Ringwald## Debug output
37e8380792SMatthias Ringwald
38e8380792SMatthias RingwaldAll debug output can be either send via SEGGER RTT or via USART2. To get the console from USART2, connect PA2 (USART2 TX) of the Discovery board to an USB-2-UART adapter and open a terminal at 115200.
39e8380792SMatthias Ringwald
40e8380792SMatthias 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.
41e8380792SMatthias Ringwald
4209df40bdSMatthias RingwaldAlso, the full packet log can be enabled in 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
43e8380792SMatthias Ringwald
44e8380792SMatthias Ringwald## GATT Database
45e8380792SMatthias RingwaldIn 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.
46e8380792SMatthias Ringwald
47e8380792SMatthias Ringwald## Image
48e8380792SMatthias Ringwald![EM9304 DVK](EM9304DVK.jpg)
49