nRF5340 Dynamic Connection Event Length

Hi,

I need to use two or more different event lengths for different modes. The event length should be set based on the mode before establishing a connection. I found that sdc_hci_cmd_vs_event_length_set() can be used for this purpose.

To implement this, I added the header:

#include <sdc_hci_vs.h>

Then, I tried to use the function with the following code:

uint8_t err;
static sdc_hci_cmd_vs_event_length_set_t event_length_param;
event_length_param.event_length_us = 5000;

err = sdc_hci_cmd_vs_event_length_set(&event_length_param);
if (err)
    printk("Failed to set event length (err %d)\n", err);
else
    printk("Event length set to %u units\n", event_length_param.event_length_us);

However, I am unable to compile the project due to the following error:
"Undefined reference to sdc_hci_cmd_vs_event_length_set."

Could you help me understand why this error occurs? Are there additional header files or configurations required?

Can you please provide an example implementation to make integration easier?

Parents Reply Children
  • Hi,

    Which NCS version do you use?

    NCS version 2.6.1.

    Is your application based on any of our samples?

    No, Our custom board code. 

    Please check the complete log.

     *  Executing task: nRF Connect: Build: C50T1_RideGrid_nRF5340/build (active) 
    
    Building C50T1_RideGrid_nRF5340
    C:\WINDOWS\system32\cmd.exe /d /s /c "west build --build-dir d:/NORDIC/Projects/C50T1_RideGrid_nRF5340/build d:/NORDIC/Projects/C50T1_RideGrid_nRF5340"
    
    [0/26] Performing build step for 'mcuboot_subimage'
    ninja: no work to do.
    [0/5] Performing build step for 'b0n_subimage'
    ninja: no work to do.
    [3/18] Building C object CMakeFiles/app.dir/src/main.c.obj
    In file included from D:/NORDIC/Projects/C50T1_RideGrid_nRF5340/src/custom_module/MeshConnection.h:2,
                     from D:/NORDIC/Projects/C50T1_RideGrid_nRF5340/src/main.c:19:
    D:/NORDIC/nRFConnectSDK/v2.6.1/zephyr/include/zephyr/random/rand32.h:13:2: warning: #warning "<zephyr/random/rand32.h> is deprecated, include <zephyr/random/random.h> instead" [-Wcpp]
       13 | #warning "<zephyr/random/rand32.h> is deprecated, include <zephyr/random/random.h> instead"
          |  ^~~~~~~
    In file included from D:/NORDIC/Projects/C50T1_RideGrid_nRF5340/src/main.c:26:
    D:/NORDIC/Projects/C50T1_RideGrid_nRF5340/src/legacy_module/inc/fm_config.h:25:1: warning: multi-line comment [-Wcomment]
       25 | // #define FM_UUID_SERV_VAL \
          | ^
    D:/NORDIC/Projects/C50T1_RideGrid_nRF5340/src/legacy_module/inc/fm_config.h:27:1: warning: multi-line comment [-Wcomment]
       27 | // #define FM_MESH_SERVICE_CHAR_UUID_VAL \
          | ^
    D:/NORDIC/Projects/C50T1_RideGrid_nRF5340/src/main.c:86:6: warning: return type of 'main' is not 'int' [-Wmain]
       86 | void main(void)
          |      ^~~~
    D:/NORDIC/Projects/C50T1_RideGrid_nRF5340/src/main.c: In function 'main':
    D:/NORDIC/Projects/C50T1_RideGrid_nRF5340/src/main.c:96:9: warning: implicit declaration of function 'buffer_init' [-Wimplicit-function-declaration]
       96 |         buffer_init();
          |         ^~~~~~~~~~~
    D:/NORDIC/Projects/C50T1_RideGrid_nRF5340/src/main.c:99:9: warning: implicit declaration of function 'ridegrid_device_info_send' [-Wimplicit-function-declaration]
       99 |         ridegrid_device_info_send();
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~
    [5/18] Linking C executable zephyr\zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map D:/NORDIC/Projects/C50T1_RideGrid_nRF5340/build/zephyr/zephyr_pre0.map 
    cmd.exe /C "cd . && D:\NORDIC\nRFConnectSDK\toolchains\cf2149caf2\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe  -gdwarf-4 @CMakeFiles\zephyr_pre0.rsp -o zephyr\zephyr_pre0.elf  && cmd.exe /C "cd /D D:\NORDIC\Projects\C50T1_RideGrid_nRF5340\build\zephyr && D:\NORDIC\nRFConnectSDK\toolchains\cf2149caf2\opt\bin\cmake.exe -E true""
    d:/nordic/nrfconnectsdk/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: app/libapp.a(main.c.obj): in function `main':
    D:/NORDIC/Projects/C50T1_RideGrid_nRF5340/src/main.c:106: undefined reference to `sdc_hci_cmd_vs_event_length_set'
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'D:\NORDIC\nRFConnectSDK\toolchains\cf2149caf2\opt\bin\cmake.EXE' --build 'd:\NORDIC\Projects\C50T1_RideGrid_nRF5340\build'
    
     *  The terminal process terminated with exit code: 1. 
     *  Terminal will be reused by tasks, press any key to close it. 

  • Hi,

    Can you check if you have included CONFIG_BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT in your configuration for the bluetooth controller running on the network core as described in this ticket?

    Best regards,
    Dejan

Related