This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2340R5: CC2340R5 Zephyr BLE peripheral support status for minimal custom GATT app

Part Number: CC2340R5

I am trying to determine the current practical status of Bluetooth LE peripheral support for LP-EM-CC2340R5 using TI’s Zephyr support.

We have a very small Zephyr BLE peripheral application that already runs on Nordic Zephyr targets, and we would like to use the same application as a CC2340R5 reference-stack baseline.

The application is intentionally minimal and uses standard Zephyr Bluetooth/GATT APIs:

  • bt_enable(NULL)

  • bt_le_adv_start(...)

  • BT_GATT_SERVICE_DEFINE

  • BT_GATT_PRIMARY_SERVICE

  • BT_GATT_CHARACTERISTIC

  • BT_CONN_CB_DEFINE

The GATT database is:

  • custom 128-bit primary service UUID: 0000b100-0000-1000-8000-00805f9b34fb

  • readable Status characteristic: 0000b101-0000-1000-8000-00805f9b34fb

  • writable Command characteristic: 0000b102-0000-1000-8000-00805f9b34fb

The central transaction is also simple:

  1. connect to the peripheral

  2. perform targeted service discovery

  3. perform targeted characteristic discovery

  4. write one byte to the Command characteristic

  5. read one byte from the Status characteristic

  6. disconnect

  7. repeat for power measurement

The current prj.conf is minimal:

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y

CONFIG_BT_DEVICE_NAME="BlueJoule-GATT"
CONFIG_BT_DEVICE_APPEARANCE=0

CONFIG_BT_AUTO_PHY_UPDATE=n
CONFIG_BT_CTLR_PHY_2M=n
CONFIG_BT_CTLR_PHY_CODED=n
CONFIG_BT_DATA_LEN_UPDATE=n
CONFIG_BT_SMP=n
CONFIG_BT_SETTINGS=n
CONFIG_BT_GATT_CACHING=n

CONFIG_SERIAL=n
CONFIG_CONSOLE=n
CONFIG_PRINTK=n
CONFIG_LOG=n

On Nordic we also set controller TX power to 0 dBm and restrict advertising to channel 37 for easier sniffer capture, but those are not essential for initial bring-up.

Questions:

  1. Does TI’s current Zephyr support include functional BLE peripheral mode on CC2340R5?

  2. Is LP-EM-CC2340R5 currently supported for custom GATT peripheral applications using the standard Zephyr Bluetooth APIs above?

  3. Which repository, branch/tag, and SDK version should be used today?

  4. What is the correct Zephyr board target? Is it lp_em_cc2340r5?

  5. Is zephyr/samples/bluetooth/peripheral known to work on LP-EM-CC2340R5?

  6. What is the recommended build command for a minimal BLE peripheral?

  7. What is the recommended flash/debug flow? For example, should we use J-Link with west flash, CCS/XDS110, or another flow?

  8. Are there required or recommended CC2340R5-specific Kconfig settings for BLE peripheral mode?

  9. Are there important limitations compared with TI’s native BLE5 stack, especially around GATT peripheral behavior, connection stability, power management, RAM usage, logging, or controller features?

  10. If Zephyr BLE peripheral mode is not currently ready or not recommended for CC2340R5, is TI’s native BLE5 stack the recommended path for a reference-stack BLE peripheral baseline?

The goal is not to use any advanced BLE feature. We only need a minimal custom GATT peripheral that can complete a repeated connect/discover/write/read/disconnect transaction for power measurement.

I can attach the full main.c and prj.conf if helpful.

Thanks,

Bob (with help from my ChatGPT assistant)

  • Hi !

    The CC2340R5 is completely fit for your needs.

    1. Yes, We have functional BLE peripheral mode on this device

    2. Yes

    3. Currently, our releases are marked as EA for Early Access. We are planning to make a big release very soon that will be out first GA (General Availability) release, which means our release is production-ready. We are waiting for the GA release to be done before starting to contribute to the Zephyr upstream. For now, the recommended way to run Zephyr on the CC2340R5 device is to use TI's Zephyr downstream. The latest branch for CC23xx devices is v3.7.0-9.20.00. I recommend you to read our SimpleLink Academy guide on how to setup the Zephyr downstream in order to get started.

    4. Yes

    5. Yes

    6. The build command is irrelevant for the BLE peripheral, what matters will be the content of your prj.conf and your code. If your project on the Nordic targets is already a minimal working BLE application, it should build on the CC2340R5 target.

    7. We have another SimpleLink Academy guide on how to flash and debug a Zephyr project with the XDS110 and VSCode. Using west flash is also supported using a JLink. Using west flash with an XDS110 also works, but it requires to set the TI_OPENOCD_INSTALL_DIR environment variable to the path of the TI OpenOCD executable (see the zephyr\boards\ti\lp_em_cc2340r5\board.cmake file)

    8. Nope, the magic of Zephyr should make your project work on the CC2340R5 without any change to your original project

    9. For now, the Zephyr SDK implementation is consuming a little bit more RAM compared to the SimpleLink SDK implementation which uses FreeRTOS. The BLE features are the same for now, except for channel sounding which is not available on Zephyr

    10. You should be able to use BLE on Zephyr using the CC2340R5 without any issues. The only problem you might face is the lack of RAM, as the device is constrained in RAM (only 34 kB). If you find yourself in a position where you're lacking RAM, it's possible to remove some features in prj.conf and optimize some things away, or to upgrade to the CC2340R53 which has double the RAM.

    Kind regards,
    Lea

  • hi lea,

    thank you for the detailed (and encouraging) reply!!!

    i was able to get my minimal BLE peripheral program running -- essentially the same one i already have benchmarked on the nRF52 and nRF54....

    a few "gotchas" along the way -- python3.10, cmake3.x, etc -- which zephyr (TI) should document more clearly....

    there are also a few "newer" symbolic constants (eg, BT_LE_ADV_OPT_CONN) that are not supported in your downstream fork (no big deal)....

    and yes, RAM space was an issue with the standard bluetooth/peripheral example; had to remove some stuff....

    you may have heard about BlueJoule -- a standard BLE advertising benchmark i helped develop and promote last year (https://novelbits.io/bluejoule/)

    we're starting work on the next benchmark in the family, which is a minimal peripheral connection.... (https://github.com/em-foundation/bluejoule-gatt/)

    i'll shortly post a report on my CC2340R5 energy efficiency results -- which honestly, could use some improvement in the sleep current area....

    specifically, the benchmark will "sleep" for 1s between connection transaction -- and was a little surprised to see current in the ~7uA range....

    are there TI-specific CONFIG options i should be using for power mgmt and/or the BLE stack???

    i'm also finishing up a version of the BlueJoule-GATT benchmark using the SimpleLink SDK -- which we'll compare against the zephyr version....

    finally, i have managed to port my "tiny" BLE peripheral stack to the CC2340R5 -- which it consumes ~8K of code!!!!!!!

    as i said, an early report of CC2340R5 benchmark results is forthcoming....

    [bios]bob

  • Hi Bob !

    Just to give a few pointers : 

    - The reason why some defines are not present (BT_LE_ADV_OPT_CONN for example) might be because we are still running on Zephyr 3.7.0 LTS in our downstream. Some defines were added in the Zephyr 4.X.X releases. We are planning to start working on upgrading to Zephyr 4.4 when we are done releasing our GA release.

    - As for the sleep current, the CONFIG_PM=y is enabled by default in our CC2340R5 LaunchPad board files. A 7uA current consumption during sleep is expected if you have not removed the external flash on the LaunchPad, as it consumes between 6 to 7 uA. To remove the external flash, you can remove resistor R25 on the board. This should allow you to reach current consumption very close to the one advertised in our Datasheet : https://www.ti.com/lit/ds/swrs272f/swrs272f.pdf?ts=1781184845995. In sleep, you should reach around 0.74uA, and in shutdown you should reach around 165 nA. If you're not able to reach those levels, please create a new thread or reply to this one, we'll be happy to help.

    - There are a lot of things you can disable/remove to gain on code size and RAM size. For one, if you're not using it, you can disable UART by adding CONFIG_SERIAL=n

    Kind regards,
    Lea