1# BTstack Port for Renesas Target Board TB-S1JA with CC256x 2 3This port uses the Renesas TB-S1JA with TI's CC256XEM ST Adapter Kit that allows to plug in a CC256xB or CC256xC Bluetooth module. 4Renesas e2 Studio (Eclise-based) was used with the SSP HAL and without an RTOS. 5For easy debugging, Ozone project files are generated as well. 6 7## Hardware 8 9Renesas Target Board TB-S1JA: 10- [TB-S1JA Target Board Kit](https://www.renesas.com/eu/en/products/synergy/hardware/kits/tb-s1ja.html) 11 12- CC2564B Bluetooth Controller: 13 1. The best option is to get it as a BoostPack 14 - Info: BOOST-CC2564MODA: http://www.ti.com/tool/BOOST-CC2564MODA 15 2. Alternatively, get the evaluation module together with the EM Wireless Booster pack and a 32.768 kHz oscillator 16 - EM Wireless Booster Pack: 17 - [Info](http://www.ti.com/tool/BOOST-CCEMADAPTER) 18 - [User Guide](http://www.ti.com/lit/pdf/swru338) 19 - CC256x Bluetooth module: 20 - [CC2564B Dual-mode Bluetooth® Controller Evaluation Module](https://store.ti.com/cc2564modnem.aspx) 21 - [CC2564C Dual-mode Bluetooth® Controller Evaluation Module](https://store.ti.com/CC256XCQFN-EM-CC2564C-Dual-Mode-Bluetooth-Controller-Evaluation-Module-P51277.aspx) 22 - The module with the older CC2564B is around USD 20, while the one with the new CC2564C costs around USD 60 23 24The projects are configured for the CC2564C. When using the CC2564B, *bluetooth_init_cc2564B_1.8_BT_Spec_4.1.c* should be used as cc256x_init_script. You can update this in the create_examples.py script. 25 26Connct the Target Board to the TI Boosterpack, see Booster Pack Pinout: http://www.ti.com/ww/en/launchpad/dl/boosterpack-pinout-v2.pdf 27 28 29J2 PIN | S1JA PORT | S1JA Signal | Boosterpack 30-------|-----------|-------------|------------ 312 | P301 | RXD0 | 3 (LP1) 324 | P302 | TXD0 | 4 (LP1) 336 | P304 | CTS0 | 36 (LP2) 348 | P303 | RTS0 | 37 (LP2) 3510 | VCC | VCC | 1 (LP1) 3612 | VSS | GND | 20 (LP2) 3714 | P112 | nShutdown | 19 (LP1) 38 39## Software 40 41Generate example projects 42 43 $ python create_examples.py 44 45This will generate an e2 Studio project for each example. 46 47### Excluded Examples 48 49The a2dp examples (a2dp_source_demo and a2dp_sink_demo) were disabled as the C open-source SBC codec 50with compile option -O2 wasn't fast enough to provide real-time encoding/decoding. 51 52 53## Build, Flash And Run The Examples in e2 Studio 54 55Open the e2 Studio project and press the 'Debug' button. Debug output is only available via SEGGER RTT. You can run SEGGER's JLinkRTTViewer or use Ozone as described below. 56 57 58## Run Example Project using Ozone 59 60After compiling the project with e2 Studio, the genereated .elf file can be used with Ozone (also e.g. on macOS). 61In Ozone, the debug output is readily available in the terminal. A .jdebug file is provided in the project folder. 62 63 64## Debug output 65 66All debug output is send via SEGGER RTT. 67 68In 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. 69 70Also, the full packet log can be enabled in src/hal_entry.c by uncommenting the hci_dump_init(...) call. 71The console output can then be converted into .pklg files by running tool/create_packet_log.py. The .pklg file can be 72analyzed with the macOS X PacketLogger or WireShark. 73 74## GATT Database 75In BTstack, the GATT Database is defined via the .gatt file in the example folder. The create_examples.py script converts the .gatt files into a corresponding .h for the project. After updating a .gatt file, the .h can be updated manually by running the provided update_gatt_db.sh or update_gatt_db.bat scripts. 76 77Note: In theory, this can be integrated into the e2 Studio/Eclipse project. 78 79 80## Notes 81- HCI UART is set to 2 mbps. Using 3 or 4 mbps causes hang during startup 82 83 84## Nice to have 85- Allow compilation using Makefile/CMake without the e2 Studio, e.g. on the Mac. 86