Skip to content

Commit

Permalink
simplelink: ti: Add CC2340R53, Mesh example and BLE FOTA to Demo II
Browse files Browse the repository at this point in the history
- Add support for TI LP_EM_CC2340R53 board
- Update crc-tool requirement to new name
- Add support for Mesh example on LP_EM_CC2340R53
- Enable onchip/offchip BLE FOTA on cc2340r5x

Signed-off-by: Lars Thalian Morstad <[email protected]>
Signed-off-by: Cameron Soviero <[email protected]>
Signed-off-by: Jenny Tong <[email protected]>
Signed-off-by: Ging Gonzalez <[email protected]>
  • Loading branch information
LarsMorstadTI committed Dec 20, 2024
1 parent 970a7ec commit 33a4f02
Show file tree
Hide file tree
Showing 34 changed files with 975 additions and 21 deletions.
60 changes: 45 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,10 @@ support them in the upstream repositories.
Supported by this release:

- [CC2340R52](https://www.ti.com/product/CC2340R5)

Beta support:

Limited testing was also performed on the `CC2340R53`, a variant of the CC2340R5
with 64kB of SRAM. Please note that some examples that require more RAM should
be run on the CC2340R53. Please see the release notes for more details.

To use this device, change [`cc2340r5.dtsi`](dts/arm/ti/cc2340r5.dtsi)
as follows:

```dts
sram0: memory@20000000 {
reg = <0x20000000 DT_SIZE_K(64)>;
};
```
- [CC2340R53](https://www.ti.com/product/CC2340R5)
- Tested only on the following examples:
- samples/bluetooth/mesh_demo/
- samples/bluetooth/mesh/

Supported by the Zephyr community:

Expand All @@ -68,6 +57,7 @@ Supported by the Zephyr community:
Supported by this release:

- [lp_em_cc2340r5](https://www.ti.com/tool/LP-EM-CC2340R5)
- lp_em_cc2340r53

Supported by the Zephyr community:

Expand All @@ -94,6 +84,46 @@ the environment and building your first application.
> https://github.com/TexasInstruments/simplelink-zephyr/tags

## BLE FOTA

TI supports BLE FOTA for Bluetooth Peripheral samples. To enable, add the following
configurations to your project's `prj.conf`.

```
# Enable BLE DFU FOTA MCUMGR MCUBOOT
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_TI_MCUMGR_BT_OTA_DFU=y
```

The following configurations should also be applied to your project's `prj.conf`
to reduce flash and RAM consumption.

```
CONFIG_LOG=n
CONFIG_BT_RECV_WORKQ_SYS=y
CONFIG_MCUMGR_TRANSPORT_NETBUF_COUNT=2
CONFIG_MCUMGR_TRANSPORT_WORKQUEUE_STACK_SIZE=1100
```

You can then build MCUboot and the Bluetooth Peripheral sample using the following
commands

```
west build -p=always -b lp_em_cc2340r5 -d build_mcuboot_f3 bootloader/mcuboot/boot/zephyr
west build -p=always -b lp_em_cc2340r5 -d build_peripheral_fota_f3 zephyr/samples/bluetooth/peripheral_fota/
```

By default, BLE FOTA uses the internal flash as the secondary slot for MCUboot.
For applications that require more flash, the external flash on the `lp_em_cc2340r5x`
can be used as the secondary slot instead. To enable this, TI provides Snippets
that can be applied at build time to enable offchip BLE FOTA. Use the commands below
as reference

```
west build -p=always -b lp_em_cc2340r5 -d build_mcuboot_offchip_f3 bootloader/mcuboot/boot/zephyr -S ti-spi-nor-secondary-bl
west build -p=always -b lp_em_cc2340r5 -d build_peripheral_offchip_fota_f3 zephyr/samples/bluetooth/peripheral_fota/ -S ti-spi-nor-secondary-app
```

## Tools support

Currently the XDS110 debugger supplied with TI Launchpads is not natively
Expand Down
5 changes: 5 additions & 0 deletions boards/ti/lp_em_cc2340r5/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 Texas Instruments Incorporated
#
# SPDX-License-Identifier: Apache-2.0

rsource "../lpf3_common/Kconfig"
10 changes: 9 additions & 1 deletion boards/ti/lp_em_cc2340r5/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Copyright (c) 2024 Texas Instruments Incorporated
#
# SPDX-License-Identifier: Apache-2.0

rsource "../lpf3_common/Kconfig.defconfig"

if BOARD_LP_EM_CC2340R5


Expand All @@ -9,7 +15,7 @@ config ZEPHYR
help
Bluetooth TI Controller on ZEPHYR OS.
default y

config BT_LL_HEAP_SIZE
hex "LL Heap memory pool size (in bytes)"
default 0x1800
Expand All @@ -22,6 +28,8 @@ CONFIG_BT_BUF_EVT_RX_SIZE=255
CONFIG_BT_BUF_ACL_RX_SIZE=255
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_CMD_TX_SIZE=255
config BT_HCI_ACL_FLOW_CONTROL
default n

endif # BT

Expand Down
4 changes: 4 additions & 0 deletions boards/ti/lp_em_cc2340r5/lp_em_cc2340r5-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
pinmux = <11 DIO11_SPI0_CSN>;
bias-disable;
};
spi0_flash_cs: spi0_flash_cs {
pinmux = <6 DIO6_SPI0_CSN>;
bias-disable;
};

/* ADC0 */
adc0_ch0: adc0_ch0 {
Expand Down
42 changes: 41 additions & 1 deletion boards/ti/lp_em_cc2340r5/lp_em_cc2340r5.dts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
zephyr,shell-uart = &uart0;
zephyr,bt_hci = &ti_bt_hci;
zephyr,bt-c2h-uart = &uart0;
zephyr,code-partition = &slot0_partition;
zephyr,uart-mcumgr = &uart0;
};

aliases {
Expand All @@ -37,6 +39,8 @@
pwm-led0 = &pwm_green;
pwm-led1 = &pwm_red;
watchdog0 = &wdt0;
mcuboot-led0 = &led1;
mcuboot-button0 = &btn1;
};

leds {
Expand Down Expand Up @@ -85,6 +89,28 @@
};
};

/delete-node/ &slot0_partition;
&flash0 {
partitions {
/* 40 KiB (0xa000) for MCUboot */
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0x0000a000>;
};

/* 233472 Bytes (0x39000) per slot for application */
slot0_partition: partition@a000 {
label = "image-0";
reg = <0x0000a000 0x00039000>;
};

slot1_partition: partition@43000 {
label = "image-1";
reg = <0x00043000 0x00039000>;
};
};
};

&cpu0 {
clock-frequency = <48000000>;
};
Expand All @@ -105,8 +131,22 @@
pinctrl-0 = <&spi0_sck_default
&spi0_mosi_default
&spi0_miso_default
&spi0_cs_default>;
&spi0_flash_cs>;
pinctrl-names = "default";
cs-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
mx25r80: mx25r8035f@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <12000000>;
size = <0x800000>;
jedec-id = [c2 28 14];
sfdp-bfp = [
e5 20 f1 ff ff ff 7f 00 44 eb 08 6b 08 3b 04 bb
ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52
10 d8 00 ff 23 72 f5 00 82 ed 04 b7 44 83 38 44
30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff
];
};
};

&i2c0 {
Expand Down
2 changes: 1 addition & 1 deletion boards/ti/lp_em_cc2340r5/lp_em_cc2340r5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ identifier: lp_em_cc2340r5
name: TI SimpleLink CC2340R5 LaunchPad
type: mcu
arch: arm
ram: 80
ram: 36
flash: 512
toolchain:
- zephyr
Expand Down
3 changes: 3 additions & 0 deletions boards/ti/lp_em_cc2340r5/lp_em_cc2340r5_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ CONFIG_DYNAMIC_THREAD_STACK_SIZE=1500

CONFIG_PM=n

#CONFIG_BT_RECV_WORKQ_SYS=y

CONFIG_BT_COMPANY_ID=0x000D
5 changes: 5 additions & 0 deletions boards/ti/lp_em_cc2340r53/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2024 Texas Instruments Incorporated
#
# SPDX-License-Identifier: Apache-2.0

rsource "../lpf3_common/Kconfig"
56 changes: 56 additions & 0 deletions boards/ti/lp_em_cc2340r53/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Copyright (c) 2024 Texas Instruments Incorporated
#
# SPDX-License-Identifier: Apache-2.0

rsource "../lpf3_common/Kconfig.defconfig"

if BOARD_LP_EM_CC2340R53


if BT

config ZEPHYR
bool "Bluetooth TI Controller on ZEPHYR"

help
Bluetooth TI Controller on ZEPHYR OS.
default y

config BT_LL_HEAP_SIZE
hex "LL Heap memory pool size (in bytes)"
default 0x1800

config BT_HCI_ACL_FLOW_CONTROL
default n

endif # BT

config BT_HCI_ACL_FLOW_CONTROL
default n

if BT_MESH

config BT_TINYCRYPT_ECC
default y

config BT_LONG_WQ
default y

config BT_BUF_EVT_RX_SIZE
default 255

config BT_BUF_ACL_RX_SIZE
default 255

config BT_BUF_ACL_TX_SIZE
default 251

config BT_BUF_CMD_TX_SIZE
default 255

config BT_PERIPHERAL_PREF_TIMEOUT
default 150

endif # BT_MESH

endif # BOARD_LP_EM_CC2340R53
11 changes: 11 additions & 0 deletions boards/ti/lp_em_cc2340r53/Kconfig.lp_em_cc2340r53
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2024 Texas Instruments Incorporated
# Copyright (c) 2024 BayLibre, SAS
#
# SPDX-License-Identifier: Apache-2.0

config BOARD_LP_EM_CC2340R53
select SOC_CC2340R53

config BOARD_USE_LF_XOSC
bool "Use external low-frequency crystal"
default y
7 changes: 7 additions & 0 deletions boards/ti/lp_em_cc2340r53/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright (c) 2024 Texas Instruments Incorporated
# Copyright (c) 2024 BayLibre, SAS
#
# SPDX-License-Identifier: Apache-2.0

board_runner_args(jlink "--device=CC2340R53")
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
5 changes: 5 additions & 0 deletions boards/ti/lp_em_cc2340r53/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
board:
name: lp_em_cc2340r53
vendor: ti
socs:
- name: cc2340r53
39 changes: 39 additions & 0 deletions boards/ti/lp_em_cc2340r53/boosterpack_connector.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2024 Texas Instruments Incorporated
* Copyright (c) 2024 BayLibre, SAS
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
boosterpack_header: connector {
compatible = "ti,boosterpack-header";
#gpio-cells = <2>;
gpio-map = <3 0 &gpio0 22 0>,
<4 0 &gpio0 20 0>,
<7 0 &gpio0 18 0>,
<8 0 &gpio0 3 0>,
<9 0 &gpio0 24 0>,
<10 0 &gpio0 0 0>,

<12 0 &gpio0 9 0>,
<13 0 &gpio0 10 0>,
<14 0 &gpio0 12 0>,
<15 0 &gpio0 13 0>,
<17 0 &gpio0 19 0>,
<18 0 &gpio0 11 0>,

<23 0 &gpio0 23 0>,
<24 0 &gpio0 25 0>,
<25 0 &gpio0 1 0>,
<26 0 &gpio0 2 0>,
<27 0 &gpio0 5 0>,
<28 0 &gpio0 7 0>,

<36 0 &gpio0 8 0>,
<37 0 &gpio0 21 0>,
<38 0 &gpio0 6 0>,
<39 0 &gpio0 14 0>,
<40 0 &gpio0 15 0>;
};
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 33a4f02

Please sign in to comment.