xref: /btstack/port/max32630-fthr/README.md (revision 70efcd36d83d98993fc16d9be6d723cfce99eae4)
149a45ad9SMatthias Ringwald# BTstack Port for the Maxim MAX32630FTHR ARM Cortex-M4F
249a45ad9SMatthias Ringwald
3*70efcd36SMatthias RingwaldThis port uses the [MAX32630FTHR ARM Cortex M4F Board](https://www.maximintegrated.com/en/products/microcontrollers/MAX32630FTHR.html) with the onboard TI CC2564B Bluetooth controller. It usually comes with the [DAPLINK Programming Adapter](https://developer.mbed.org/teams/MaximIntegrated/wiki/MAXREFDES100HDK).
491401e37SMatthias RingwaldThe DAPLINK allows to upload firmware via a virtual mass storage device (like mbed), provides a virtual COM port for a console, and enables debugging via the SWD interface via OpenOCD.
549a45ad9SMatthias Ringwald
649a45ad9SMatthias RingwaldThe port uses non-blocking polling UART communication with hardware flow control for Bluetooth controller. It was tested and achieved up to 1.8 Mbps bandwidth between two Max32630FTHR boards.
749a45ad9SMatthias Ringwald
849a45ad9SMatthias Ringwald## Software
949a45ad9SMatthias Ringwald
10*70efcd36SMatthias RingwaldThe [Maxim ARM Toolchain](https://www.maximintegrated.com/en/products/microcontrollers/MAX32630.html/tb_tab2) is free software that provides peripheral libraries, linker files, initial code and some board files. It also provides Eclipse Neon and Maxim modified OpenOCD to program the microcontroller together with various examples for Maxim Cortex M4F ARM processors.
1149a45ad9SMatthias Ringwald
1291401e37SMatthias RingwaldFor debugging, OpenOCD can be used. The regular OpenOCD does not support Maxim ARM microcontrollers yet, but a modified OpenOCD for use with Maxim devices can be found in the Maxim ARM Toolchain.
1391401e37SMatthias Ringwald
1491401e37SMatthias Ringwald## Toolchain Setup
1591401e37SMatthias Ringwald
1691401e37SMatthias RingwaldIn the Maxim Toolchain installation directory, there is a setenv.sh file that sets the MAXIM_PATH. MAXIM_PATH needs to point to the root directory where the tool chain installed. If you're lucky and have a compatible ARM GCC Toolchain in your PATH, it might work without calling setenv.sh script.
1749a45ad9SMatthias Ringwald
1849a45ad9SMatthias Ringwald## Usage
1949a45ad9SMatthias Ringwald
2091401e37SMatthias RingwaldThe examples can be compiled using GNU ARM Toolchain. A firmware binary can be flashed either by copying the .bin file to the DAPLINK mass storage drive, or by using OpenOCD on the command line, or from Eclipse CDT.
2149a45ad9SMatthias Ringwald
2249a45ad9SMatthias Ringwald## Build
2349a45ad9SMatthias Ringwald
2491401e37SMatthias RingwaldCheckt that MAXIM_PATH points to the root directory where the tool chain installed.
2591401e37SMatthias RingwaldThen, go to the port/max32630-fthr folder and run "make" command in terminal to generate example projects in the example folder.
2649a45ad9SMatthias Ringwald
2791401e37SMatthias RingwaldIn each example folder, e.g. port/max323630-fthr/example/spp_and_le_streamer, you can run "make" again to build an .elf file in the build folder which is convenient for debugging using Eclipse or GDB.
2849a45ad9SMatthias Ringwald
2991401e37SMatthias RingwaldFor flashing via the virtual USB drive, the "make release" command will generate .bin file in the build folder.
3049a45ad9SMatthias Ringwald
3149a45ad9SMatthias Ringwald## Eclipse
3249a45ad9SMatthias Ringwald
3391401e37SMatthias RingwaldToolchain and Eclipse guide can be found in README.pdf file where the Maxim Toolchain is installed. Please note that this port was done using Makefiles.
3449a45ad9SMatthias Ringwald
3549a45ad9SMatthias Ringwald## Flashing Max32630 ARM Processor
3649a45ad9SMatthias Ringwald
3791401e37SMatthias RingwaldThere are two ways to program the board. The simplest way is drag and drop the generated .bin file to the DAPLINK mass storage drive. Once the file is copied to the mass storage device, the DAPLINK should program and then run the new firmware.
3849a45ad9SMatthias Ringwald
3991401e37SMatthias RingwaldAlternatively, OpenOCD can be used to flash and debug the device. A suitable programming script can be found in the scripts folder.
4049a45ad9SMatthias Ringwald
4191401e37SMatthias Ringwald## Debugging
4249a45ad9SMatthias Ringwald
4391401e37SMatthias RingwaldOpenOCD can also be used for developing and especially for debugging. Eclipse or GDB via OpenOCD could be used for step by step debugging.
4449a45ad9SMatthias Ringwald
4549a45ad9SMatthias Ringwald## Debug output
4649a45ad9SMatthias Ringwald
4791401e37SMatthias Ringwaldprintf messages are redirected to UART2. UART2 is accessible via the DAPLINK Programming Adapter as a virtual COM port at 115200 baud with no flow control. If this doesn't work for you, you can connect P3_1 (UART TX) of the MAX32630FTHR board to a USB-to-UART adapter.
4849a45ad9SMatthias Ringwald
4991401e37SMatthias RingwaldAdditional debug information can be enabled by uncommenting ENABLE_LOG_INFO in the src/btstack_config.h header file and a clean rebuild.
5049a45ad9SMatthias Ringwald
5149a45ad9SMatthias Ringwald## TODOs
52f39cc24dSMatthias Ringwald  - Support for BTSTACK_STDIN
5391401e37SMatthias Ringwald  - Add flash-openocd to Makefile template
5491401e37SMatthias Ringwald  - Add Eclipse CDT projects for max32630fthr
55f39cc24dSMatthias Ringwald  - Implement hal_led.h to control LED on board
56f39cc24dSMatthias Ringwald
57