BT SDK (CYW20819) Internal HCI API

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ToKo_4602001
Level 4
Level 4
50 sign-ins 25 replies posted 25 sign-ins

Hello

We use CYW20819 in "embedded mode" and we would like to control CYW20819 finely.

For example, we want to set LOCAL_DEVICE_NAME at other than boot/initialize time.

We find wiced_bt_dev_vendor_specific_command() API that sends VS HCI command to CYW20819 and wiced_bt_dev_register_hci_trace() API that register callback for HCI event.

However we could not find the API that enables to send normal (Non-vs) HCI commands.

Does Cypress offers this kinds of API or have the plan to add this function?

1 Solution

I am sorry, it appears that wiced_bt_dev_set_local_name has been erroneously missed from the current version. It will be fixed in an upcomming release of the bt-sdk (probably 2.4). For now, could you please use

    extern wiced_result_t BTM_SetLocalDeviceName(char* p_name);

    BTM_SetLocalDeviceName("Toshiya-san");

View solution in original post

15 Replies
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hi ToKo_4602001ToKo_4602001​San,

We do not have direct API for setting local name.

However you can update the wiced_bt_cfg_settings_t structure parameter device_name in the main.c file even after Bt stack init.

Eg:

in bt config file,

wiced_bt_cfg_settings_t db_cfg_settings =

{

    .device_name                         = (uint8_t *)WICED_DEVICE_NAME,                             // Local device name (NULL terminated)

    .device_class                        = { 0x00, 0x00, 0x00 },                                     // Local device class

    .security_requirement_mask

:

in main.c file, after the BT stack init , change the device name structure parameter

db_cfg_settings.device_name

Could you please try that?

Thanks,
Anjana

Hi,

If you want to send HCI command from an external MCU  and control the device then please go through the below document.

btsdk-docs/WICED-HCI-Control-Protocol.pdf at master · cypresssemiconductorco/btsdk-docs · GitHub

You can check HCI_CONTROL_GROUP_DEVICE group of commands to allow the host to manage the behavior of the CYW20xxx.

Thanks,

-Dheeraj

Dheeraj san

Thank you for this comment.

I will use this method to execute RF testing (Enable Device under Test Mode).

However, I'd like to some command in "embedded mode" (not external MCU) on our firmware.

Thanks

0 Likes

Hi,

You can go through the Hello_sensor application where we change the adv name using the application function hello_sensor_set_advertisement_data(). You may have to call app_set_advertisement_data() before the starting the advertisement (wiced_bt_start_advertisements).

Please use  wiced_bt_ble_advert_elem_t structure to hold the config parameters like name, name_length, etc.

Thanks,

-Dheeraj

lock attach
Attachments are accessible only for community members.

Hi,

Please see the sample application attached to demonstrate the usage of set_advertisement_data() function to change the name.

Thanks,

-Dheeraj

Thank you for your reply and sample code.

I will use it as a reference.

But I think that this can only set LE advertising data and LE GAP characteristic (including a device name information), however it cannot set Classic Bluetooth's GAP Device Name, which can be configured with wiced_bt_cfg_settings at initialization.

If possible I would like to control scan_interval, scan_window, adv interval, device name, and so on in operation.

Regards,

0 Likes

Hello,

If you want to change BT classic name, you have to use wiced_bt_dev_write_eir API similar to wiced_bt_ble_set_raw_advertisement_data in case of BLE before enabling the discoverability

Thanks,
Anjana

0 Likes

Hello

Thank you for this comment.

wiced_bt_dev_write_eir API can set extended inquiry data, which can include name information.

However, it cannot change GAP name.

So when a remote device sends "Remote name Request (== wiced_bt_dev_get_remote_name())" to CYW20819 device, the value set with wiced_bt_cfg_settings will be used.

Regards,

0 Likes

There is a virtual HCI interface between the host and controller parts of the chip, and application can indeed hook to it to see HCI traces. But HCI interface is not exposed for the applications to use. Meanwhile, there are a few API functions which may enable you to do the job. Please have a look at wiced_bt_dev.h and wiced_bt_ble.h.  For example, to set the local name you should be able to use wiced_bt_dev_set_local_name.

I am sorry, it appears that wiced_bt_dev_set_local_name has been erroneously missed from the current version. It will be fixed in an upcomming release of the bt-sdk (probably 2.4). For now, could you please use

    extern wiced_result_t BTM_SetLocalDeviceName(char* p_name);

    BTM_SetLocalDeviceName("Toshiya-san");

Thank you very much.

I get the following link error with the BTM_SetLocalDeviceName().

undefined reference to `BTM_SetLocalDeviceName'

Anyway I'm looking forward to next version of SDK (2.4?).

If possible, I' like you to add some setting functionality including local_name in next version.

Thanks

0 Likes

Interesting. I just checked and BTM_SetLocalDeviceName is in the ROM, so it cannot be undefined. But if you are willing to wait for wiced_set_local_device_name in 2.4, I am pretty sure it will be there.

Note that issue was resolved in ModusToolbox BT SDK​ version 2.4

Thanks to GrCa_1363456​ from Arrow for the heads up.

Hello Anjana san

Thank you for your quick reply.

On the following code, unfortunately the Local_Name in use is still Name1.

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

wiced_bt_cfg_settings_t wiced_bt_cfg_settings = {

    .device_name                         = (uint8_t*) NAME1,            

...

}

APPLICATION_START(){

  wiced_bt_stack_init(app_callback, &wiced_bt_cfg_settings, wiced_bt_cfg_buf_pools);

}

wiced_result_t app_callback( wiced_bt_management_evt_t event, wiced_bt_management_evt_data_t *p_event_data ){

  wiced_result_t status = WICED_BT_SUCCESS;

  switch (event){

  case BTM_ENABLED_EVT:

    wiced_bt_cfg_settings.device_name = (uint8_t*) NAME2;

...

break;

...

  }

  return status;

}

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

On the following code, I could set new Local_Name (Name2).

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

wiced_bt_cfg_settings_t wiced_bt_cfg_settings = {

    .device_name                         = (uint8_t*) NAME1,            

...

}

APPLICATION_START(){

  wiced_bt_stack_init(app_callback, &wiced_bt_cfg_settings, wiced_bt_cfg_buf_pools);

  wiced_bt_cfg_settings.device_name = (uint8_t*) NAME2;

}

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

It seems that once Bluetooth stack has been initialized with a setting,  probably the stack keeps the setting...

If there is a method to change cfg setting parameters after initializing, it is very useful.

Thanks

0 Likes

<Supplementary Information>

Even on the following code, still old name is used.

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

switch (event){

case BTM_ENABLED_EVT:

  NAME1[0] = '?'; //new name "?"

  NAME1[1] = 0;

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

Thanks.

0 Likes