xref: /btstack/port/max32630-fthr/README.md (revision 49a45ad9fdd8e9904c01b63e1d7d6091211e6efb)
1*49a45ad9SMatthias Ringwald# BTstack Port for the Maxim MAX32630FTHR ARM Cortex-M4F
2*49a45ad9SMatthias Ringwald
3*49a45ad9SMatthias RingwaldThis port uses the MAX32630FTHR ARM Cortex M4F Board onboard TI's CC2564B Bluetooth controller.
4*49a45ad9SMatthias Ringwald
5*49a45ad9SMatthias RingwaldMaxim ARM Toolchain is free software that provides peripheral libraries, linker files, initial code and some board files.
6*49a45ad9SMatthias RingwaldThe toolchain also provides Eclipse Neon and Maxim modified OpenOCD to program the microcontroller.
7*49a45ad9SMatthias RingwaldIt also provides various examples for Maxim Cortex M4F ARM processors. Maxim released OpenOCD was used to flash and debug the max32630fthr port.
8*49a45ad9SMatthias Ringwald
9*49a45ad9SMatthias RingwaldThe port uses non-blocking polling UART communication with hardware flow control for Bluetooth controller. It was tested and achieved up to 1.8Mbps bandwidth between two Max32630FTHR boards.
10*49a45ad9SMatthias Ringwald
11*49a45ad9SMatthias Ringwald## Hardware
12*49a45ad9SMatthias Ringwald
13*49a45ad9SMatthias Ringwald- [MAX32630FTHR Board] (https://www.maximintegrated.com/en/products/digital/microcontrollers/MAX32630FTHR.html)
14*49a45ad9SMatthias Ringwald
15*49a45ad9SMatthias Ringwald## Software
16*49a45ad9SMatthias Ringwald
17*49a45ad9SMatthias RingwaldYou need to install Maxim ARM Toolchain. The Libraries and the toolchain can be downloaded from [Maxim Toolchains] (https://www.maximintegrated.com/en/products/digital/microcontrollers/MAX32630.html/tb_tab2) page. Regular openocd does not support Maxim ARM microcontrollers yet. Maxim modified OpenOCD can be found in the toolchain.
18*49a45ad9SMatthias Ringwald
19*49a45ad9SMatthias RingwaldIn the Maxim Toolchain installation directory, there is a setenv.sh file that sets the MAXIM_PATH. This file needs to run at the beginning and set the enviromental variables.
20*49a45ad9SMatthias Ringwald
21*49a45ad9SMatthias Ringwald## Usage
22*49a45ad9SMatthias Ringwald
23*49a45ad9SMatthias RingwaldThe example can be compiled using GNU ARM Toolchain and the firmware binary can be flashed using OpenOCD or eclipse.
24*49a45ad9SMatthias Ringwald
25*49a45ad9SMatthias Ringwald## Build
26*49a45ad9SMatthias Ringwald
27*49a45ad9SMatthias RingwaldGo to port/max32630fthr folder and run "make" command in terminal. You can also open the project using Eclipse and build it.
28*49a45ad9SMatthias RingwaldMAXIM_PATH needs to point to the root directory where the tool chain installed. Or makefile could be modified to point to the libraries.
29*49a45ad9SMatthias Ringwald
30*49a45ad9SMatthias Ringwald"make" command will build and generate .elf file which is convenient for debugging using Eclipse or GDB.
31*49a45ad9SMatthias Ringwald$ make
32*49a45ad9SMatthias Ringwald
33*49a45ad9SMatthias Ringwald"make release" command will generate .bin file that can be used to program using Daplink adapter.
34*49a45ad9SMatthias Ringwald
35*49a45ad9SMatthias Ringwald## Eclipse
36*49a45ad9SMatthias Ringwald
37*49a45ad9SMatthias RingwaldToolchain and Eclipse guide can be found in README.pdf file where the Maxim Toolchain installed.
38*49a45ad9SMatthias RingwaldPlease note that this development was not made with eclipse.
39*49a45ad9SMatthias Ringwald
40*49a45ad9SMatthias Ringwald## Flashing Max32630 ARM Processor
41*49a45ad9SMatthias Ringwald
42*49a45ad9SMatthias RingwaldThere are two ways to program the board. The simplest way is drag and drop the max3263x.bin file to DAPLINK mass storage drive. Once the file is copied to the mass storage device, it should program and then run the new firmware.
43*49a45ad9SMatthias Ringwald
44*49a45ad9SMatthias RingwaldOpenOcd also can be used for developing and especially for debugging. Eclipse or GDB could be used for step by step debugging.
45*49a45ad9SMatthias Ringwald
46*49a45ad9SMatthias RingwaldThe programming script can be found in the scripts folder.
47*49a45ad9SMatthias RingwaldTo flash the microcontroller, 'flash_Max32630_hdk.sh' script needs to be run in the max32630fthr directory.
48*49a45ad9SMatthias Ringwald
49*49a45ad9SMatthias Ringwald
50*49a45ad9SMatthias Ringwald## Debug output
51*49a45ad9SMatthias Ringwald
52*49a45ad9SMatthias Ringwaldprintf messages are redirected to UART2.
53*49a45ad9SMatthias RingwaldTo get the console output, connect P3_1 (UART TX) of the MAX32630FTHR board to a USB-to-UART adapter and open a terminal at 115200 baudrate with no hardware/software flow control.
54*49a45ad9SMatthias Ringwald
55*49a45ad9SMatthias 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.
56*49a45ad9SMatthias Ringwald
57*49a45ad9SMatthias Ringwald
58*49a45ad9SMatthias Ringwald## Modifications to the GATT Database
59*49a45ad9SMatthias Ringwald
60*49a45ad9SMatthias RingwaldIn BTstack, the GATT Database is defined via the .gatt file in the example folder. Before it can be used, run the following command in max32630fthr directory.
61*49a45ad9SMatthias Ringwald
62*49a45ad9SMatthias Ringwald$ make generate_header_file
63*49a45ad9SMatthias Ringwald
64*49a45ad9SMatthias Ringwaldor
65*49a45ad9SMatthias Ringwald
66*49a45ad9SMatthias Ringwald$ python ../../tool/compile_gatt.py spp_and_le_streamer.gatt spp_and_le_streamer.h
67*49a45ad9SMatthias Ringwald
68*49a45ad9SMatthias Ringwald
69*49a45ad9SMatthias Ringwald## Notes
70*49a45ad9SMatthias Ringwald
71*49a45ad9SMatthias Ringwald - bluetooth_init_cc2564B_1.6_BT_Spec_4.1.c file added as default. If "include ${BTSTACK_ROOT}/chipset/cc256x/Makefile.inc" is enabled in the Makefile, it will automatically download the bts files and convert it to a c file.
72*49a45ad9SMatthias Ringwald
73*49a45ad9SMatthias Ringwald## TODOs
74*49a45ad9SMatthias Ringwald  - Add Eclipse project for max32630fthr
75*49a45ad9SMatthias Ringwald  - link to sources instead of copying into every example project
76*49a45ad9SMatthias Ringwald  - support link-key-db for on flash memory
77