1 2 Previous Next 15 Replies Latest reply on Apr 23, 2020 10:21 AM by MichaelF_56

    BT SDK (CYW20819) Internal HCI API

    ToKo_4602001

      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. Re: BT SDK (CYW20819) Internal HCI API
          AnjanaM_61

          Hi Toshiya Koyama 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

          1 of 1 people found this helpful
          • 2. Re: BT SDK (CYW20819) Internal HCI API
            DheerajP_41

            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

            1 of 1 people found this helpful
            • 3. Re: BT SDK (CYW20819) Internal HCI API
              ToKo_4602001

              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

              • 4. Re: BT SDK (CYW20819) Internal HCI API
                ToKo_4602001

                <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.

                • 5. Re: BT SDK (CYW20819) Internal HCI API
                  ToKo_4602001

                  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

                  • 6. Re: BT SDK (CYW20819) Internal HCI API
                    DheerajP_41

                    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

                    1 of 1 people found this helpful
                    • 7. Re: BT SDK (CYW20819) Internal HCI API
                      DheerajP_41

                      Hi,

                       

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

                       

                      Thanks,

                      -Dheeraj

                      1 of 1 people found this helpful
                      • 8. Re: BT SDK (CYW20819) Internal HCI API
                        ToKo_4602001

                        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,

                        • 9. Re: BT SDK (CYW20819) Internal HCI API
                          AnjanaM_61

                          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

                          • 10. Re: BT SDK (CYW20819) Internal HCI API
                            ToKo_4602001

                            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,

                            • 11. Re: BT SDK (CYW20819) Internal HCI API
                              VictorZ_46

                              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.

                              1 of 1 people found this helpful
                              • 12. Re: BT SDK (CYW20819) Internal HCI API
                                VictorZ_46

                                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");

                                2 of 2 people found this helpful
                                • 13. Re: BT SDK (CYW20819) Internal HCI API
                                  ToKo_4602001

                                  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

                                  • 14. Re: BT SDK (CYW20819) Internal HCI API
                                    VictorZ_46

                                    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.

                                    1 of 1 people found this helpful
                                    1 2 Previous Next