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: Zephyr DIS Exp

Part Number: CC2340R5
Other Parts Discussed in Thread: UNIFLASH

Tool/software:

I am trying to run a BLE example on the #LP-EM-CC2340R5 using the Zephyr OS.  I setup my environment yesterday using the simplelink-zephyr repository, tag v3.7.0-ti-8.20.01_ea, using the process described in the Readme.md.  I've successfully built and ran some basic Zephyr examples, but my attempt to build and run the peripheral_dis example is failing.

I am using VSCode adn west to build the example: 

PS Command:  west build -p always -b lp_em_cc2340r5 samples\bluetooth\peripheral_dis

Zephyr SDK Version:  0.17.0

There is one warning when generating the build environment:

The object file directory

C:/Users/jimd2/Src/ZephyrSandbox/TIZephyr/zephyr/build/modules/ti/simplelink_lpf3/source/ti/devices/cc23x0r5/CMakeFiles/..__modules__hal__ti__simplelink_lpf3__source__ti__devices__cc23x0r5.dir/./

has 195 characters. The maximum full path to an object file is 250
characters (see CMAKE_OBJECT_PATH_MAX). Object file

rf_patches/lrf_rfe_binary_coherent_pll_nopll_cc23x0r5.c.obj

cannot be safely placed under this directory. The build may not work
correctly.

The code builds and links, but there is a warning:

C:/Users/jimd2/Src/ZephyrSandbox/TIZephyr/zephyr/subsys/bluetooth/host/l2cap.c:876:17: warning: implicit declaration of function 'bt_tx_irq_raise' [-Wimplicit-function-declaration]
876 | bt_tx_irq_raise();
| ^~~~~~~~~~~~~~~

I am programming the .HEX file using JFlash Lite Version 7.94i

I am using the nRFConnect Android App to try and connect and inspect the device information.  It connects briefly, but then has a problem.  Here is the log:

nRF Connect, 2024-11-27

DIS peripheral (84:72:93:3C:5B:06)

V 11:02:51.165 Connecting to 84:72:93:3C:5B:06...

D 11:02:51.165 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)

D 11:02:51.451 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2)

I 11:02:51.451 Connected to 84:72:93:3C:5B:06

V 11:02:51.461 Discovering services...

D 11:02:51.461 gatt.discoverServices()

D 11:02:51.474 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED

I 11:02:51.688 PHY updated (TX: LE 2M, RX: LE 2M)

I 11:02:52.083 Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)

I 11:02:56.400 Connection parameters updated (interval: 30.0ms, latency: 0, timeout: 420ms)

D 11:03:21.785 [Callback] Connection state changed with status: 22 and new state: DISCONNECTED (0)

E 11:03:21.785 Error 22 (0x16): GATT CONN TERMINATE LOCAL HOST

I 11:03:21.785 Disconnected

D 11:03:21.821 [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED

I'm not sure if one of these two warnings could be the culprit, or if it is something different all together.  Looking for suggestions.

  • Hello Jim,

    Thanks for reaching out.

    I am working on trying to reproduce the issue. The repository has been updated very recently, could you please update your local branch and try again.

    I only get one warning when building: No SOURCES given to Zephyr library: drivers__entropy.

    In addition, could you please try flashing with XDS using a .hex file?

    BR,

    David.

  • Hi David - Thanks for reaching out.  I have been trying a few things today.

    -Flashing with Uniflash and XDS.  This had no effect on the issue.

    -Local branch version.  I just setup the simplelink-zephyr last week.  I used the tag "v3.7.0-ti-8.20.01_ea" in the west init command.  This is the latest version.

    -The warning about the function bt_tx_irq_raise().  I did a search for this function.  I can find it in the hci_core.c file (in the ../subsys/bluetooth/host folder).  However, I do not find it in any header files.  It's kind of an odd case.  The file diff for commit:ea816e6/tag:v3.7.0-ti-8.20.00 shows the declaration being removed in hci_core.h, but the previous commit/tag (ed5d059/v3.7.0-4eb8fa603cf-ti-8.20.00_ea) does not have the declaration.  So, it seems like this was inserted during development, but then removed.  If I add the declaration back in.  The code compiles with no warnings.  However, the issue remains where the phone connects, but cannot retrieve the characteristics of the DIS, and then disconnects.

    My other thought is perhaps some other tool is the wrong version.  Pasted below is the full output out of the build.

    -Jim

    -------------------------------------------

    Building ./application/peripheral_dis for lp_em_cc2340r5.
    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/Users/jimd2/Src/ZephyrSandbox/TIZephyr/application/peripheral_dis
    -- CMake version: 3.31.0
    -- Found Python3: C:/Users/jimd2/src/ZephyrSandbox/TIZephyr/.venv/Scripts/python.exe (found suitable version "3.12.6", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: C:/Users/jimd2/Src/ZephyrSandbox/TIZephyr/zephyr/.cache
    -- Zephyr version: 3.7.0 (C:/Users/jimd2/Src/ZephyrSandbox/TIZephyr/zephyr)
    -- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
    -- Board: lp_em_cc2340r5, qualifiers: cc2340r5
    -- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
    -- Found host-tools: zephyr 0.17.0 (C:/Users/jimd2/zephyr-sdk-0.17.0)
    -- Found toolchain: zephyr 0.17.0 (C:/Users/jimd2/zephyr-sdk-0.17.0)
    -- Found Dtc: C:/ProgramData/chocolatey/bin/dtc.exe (found suitable version "1.5.0", minimum required is "1.4.6")
    -- Found BOARD.dts: C:/Users/jimd2/Src/ZephyrSandbox/TIZephyr/zephyr/boards/ti/lp_em_cc2340r5/lp_em_cc2340r5.dts
    -- Generated zephyr.dts: C:/Users/jimd2/Src/ZephyrSandbox/TIZephyr/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: C:/Users/jimd2/Src/ZephyrSandbox/TIZephyr/build/zephyr/include/generated/zephyr/devicetree_generated.h
    -- Including generated dts.cmake file: C:/Users/jimd2/Src/ZephyrSandbox/TIZephyr/build/zephyr/dts.cmake
    Parsing C:/Users/jimd2/Src/ZephyrSandbox/TIZephyr/zephyr/Kconfig
    Loaded configuration 'C:/Users/jimd2/Src/ZephyrSandbox/TIZephyr/zephyr/boards/ti/lp_em_cc2340r5/lp_em_cc2340r5_defconfig'
    Merged configuration 'C:/Users/jimd2/Src/ZephyrSandbox/TIZephyr/application/peripheral_dis/prj.conf'
    Configuration saved to 'C:/Users/jimd2/Src/ZephyrSandbox/TIZephyr/build/zephyr/.config'
    Kconfig header saved to 'C:/Users/jimd2/Src/ZephyrSandbox/TIZephyr/build/zephyr/include/generated/zephyr/autoconf.h'
    -- Found GnuLd: c:/users/jimd2/zephyr-sdk-0.17.0/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: C:/Users/jimd2/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
    -- Configuring done (9.3s)
    -- Generating done (0.6s)
    -- Build files have been written to: C:/Users/jimd2/Src/ZephyrSandbox/TIZephyr/build
    ←[92m-- west build: building application
    [1/248] Generating include/generated/zephyr/version.h
    -- Zephyr version: 3.7.0 (C:/Users/jimd2/Src/ZephyrSandbox/TIZephyr/zephyr), build: v3.7.0-ti-8.20.01_ea
    [248/248] Linking C executable zephyr\zephyr.elf
    Memory region Used Size Region Size %age Used
    FLASH: 176028 B 512 KB 33.57%
    RAM: 30516 B 36 KB 82.78%
    FLASH_CCFG: 2 KB 2 KB 100.00%
    IDT_LIST: 0 GB 32 KB 0.00%
    Generating files from C:/Users/jimd2/Src/ZephyrSandbox/TIZephyr/build/zephyr/zephyr.elf for board: lp_em_cc2340r5
    INFO:root:Iterating symbols, looking for prefix: CRC_CCFG
    INFO:root:Inserting CRC section for variable pair with stem: CRC_CCFG_BOOT_CFG = (0x4e020000, 0x4e02000b)
    INFO:root:Updating CRC32 field @ address 0x4e02000c, based on data in the range [0x4e020000, 0x4e02000b]. Value changes from 0x00000000 to 0xffffffff
    INFO:root:Inserting CRC section for variable pair with stem: CRC_CCFG = (0x4e020010, 0x4e02074b)
    INFO:root:Updating CRC32 field @ address 0x4e02074c, based on data in the range [0x4e020010, 0x4e02074b]. Value changes from 0x00000000 to 0x4c1584b6
    INFO:root:Inserting CRC section for variable pair with stem: CRC_CCFG_USER_RECORD = (0x4e020750, 0x4e0207cb)
    INFO:root:Updating CRC32 field @ address 0x4e0207cc, based on data in the range [0x4e020750, 0x4e0207cb]. Value changes from 0x00000000 to 0x15d70e0c
    INFO:root:Inserting CRC section for variable pair with stem: CRC_CCFG_DEBUG = (0x4e0207d0, 0x4e0207fb)
    INFO:root:Updating CRC32 field @ address 0x4e0207fc, based on data in the range [0x4e0207d0, 0x4e0207fb]. Value changes from 0x00000000 to 0x18f46064
    INFO:root:Writing patched ELF file to C:/Users/jimd2/Src/ZephyrSandbox/TIZephyr/build/zephyr/zephyr.elf
    * Terminal will be reused by tasks, press any key to close it.

  • Hello Jim,

    For a quick sanity check, may we do a fresh installation of the latest release? Please make sure to follow the steps in https://github.com/TexasInstruments/simplelink-zephyr/tree/v3.7.0-ti-8.20.01_ea and https://docs.zephyrproject.org/3.7.0/develop/getting_started/index.html, especially considering the required minimum versions of the libraries and the following note in the TI ReadMe?

    NOTE: When running west init in the getting-started guide it's important to instead run west init -m https://github.com/TexasInstruments/simplelink-zephyr --mr {tag-name} zephyrproject in order to use the TI Zephyr repository. The {tag-name} changes with each release from TI.

    BR,

    David.

  • Hello David -

    No luck, unfortunately.  I've pasted all the commands below.  Note, I did change a couple of things from the previous install.  Switched to Python 3.11 vs 3.12 as there is a note in the Zephyr Getting Started about 3.12 not being recommended.  Switched to Zephyr SDK 0.16.8 because 0.17.0 is not listed as compatible for Zephyr 3.7.

    I'm going to try this on a different PC as well.  I will let you know.

    -Jim

    ------------------------------------------------------------------

    Commands:

    C:\Users\jimd2>python -m venv ti\.venv
    C:\Users\jimd2>ti\.venv\Scripts\activate.bat
    (.venv) C:\Users\jimd2>pip install west
    (.venv) C:\Users\jimd2>west init -m github.com/.../simplelink-zephyr --mr v3.7.0-ti-8.20.01_ea ti
    (.venv) C:\Users\jimd2>cd ti
    (.venv) C:\Users\jimd2\ti>west update
    (.venv) C:\Users\jimd2\ti>wget github.com/.../zephyr-sdk-0.16.8_windows-x86_64.7z
    (.venv) C:\Users\jimd2\ti>7z x zephyr-sdk-0.16.8_windows-x86_64.7z
    (.venv) C:\Users\jimd2>cd zephyr-sdk-0.16.8
    (.venv) C:\Users\jimd2\zephyr-sdk-0.16.8>setup.cmd
    (.venv) C:\Users\jimd2\ti\zephyr>west build --pristine=always --board=lp_em_cc2340r5 samples\basic\blinky (fails, I missed a step)
    (.venv) C:\Users\jimd2>pip install -r C:\Users\jimd2\ti\zephyr\scripts\requirements.txt (realized I forgot this earlier)

    (.venv) C:\Users\jimd2\ti\zephyr>west build --pristine=always --board=lp_em_cc2340r5 samples\basic\blinky (works fine)
    (.venv) C:\Users\jimd2\ti\zephyr>west build --pristine=always --board=lp_em_cc2340r5 samples\basic\blinky (works fine)west build --pristine=always --board=lp_em_cc2340r5 samples\bluetooth\peripheral_dis (this builds with the same warning as before about the bt_tx_irq_raise()function)

    Flashed with both UniFlash/XDS and Segger JLink. No difference

    Serial Terminal Output:
    *** Booting Zephyr OS build v3.7.0-ti-8.20.01_ea ***
    Slabs used: 1 / 2
    Slabs used: 2 / 2
    Bluetooth initialized
    Advertising successfully started
    Connected
    Disconnected (reason 0x13)

  • Same results on three different computers.

  • Hello Jim,

    I will try to reproduce this on my end again and come back to you tomorrow max. Please bear with me.

    May I ask if you are executing west zephyr-export? I don't see it in your previous steps.

    BR,

    David.

  • Hi David - Yes, I did.  I post documented the steps and realized I made errors in that process.  I originally copied only the command, but later added the Command Shell prompt to show the location.  However, in that step I also marked some of the prompts as (.venv) when they were not.  Sorry for the poor documenting.

  • Hello Jim,

    Apologies the delay. I am trying to reproduce your scenario however I do not end up with the same warning. Please allow me until tomorrow to try with a fresh setup.

    BR,

    David.

  • Hello Jim,

    I have done a clean installation, I was able to reproduce the issue and I am working on the problem you are referring to. So far I see the device stops executing any type of BLE task after the central attempts a gatt discovery and remains in idle.

    Sniffer Log

    Btool (central device)

    Terminal (peripheral device)

    BR,

    David.

  • Hello Jim,

    Please go to zephyr - boards - ti - lp_em_cc2340r5 - Kconfig.defconfig and use the following:                           

    if BOARD_LP_EM_CC2340R5
    
    
    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
    
    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_COMPANY_ID=0x000D
    CONFIG_BT_RECV_WORKQ_SYS=y
    
    endif # BT
    
    endif # BOARD_LP_EM_CC2340R5

    I am able to discover the service correctly with this modifications. The issue has been reported and will be soon fixed in the release itself.

    Best Regards,

    David.

  • Thanks David.  This worked.  Just an FYI for you.  I still see the build warning for bt_tx_irq_raise() still.  The other thing I noticed is that if I disconnect my phone after connecting and reading the device information, the board does not go back to advertising.  However, I didn't look into if it is supposed to.