Skip to main content
Visitor II
September 3, 2024
Question

STMWB05xZ Enable CTE

  • September 3, 2024
  • 1 reply
  • 795 views

Hi,

I am working on a project which will require a connectionless CTE to be added to the advertisement. From what I understand, there are not currently any examples of a configured CTE beacon. What would be the best example project to modify to create a connectionless CTE beacon? Are there any examples anywhere floating around that I am unaware of? Or could someone point me in the right dire

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    September 4, 2024

    Hello @atrujillo 

    STM32WB05 devices support standard Bluetooth LE Direction Finding Features and, as consequence, both connection and connection less mode.
    Youl could refer to the related Bluetooth LE stack v4.x programming manual available on ST web site:https://www.st.com/resource/en/programming_manual/pm0274-bluetooth-low-energy-stack-v4x-programming-guidelines-stmicroelectronics.pdf
    Section 2.11 Direction finding

    Associated commands and events are documented on related Application Note: https://www.st.com/resource/en/application_note/an6142-introduction-to-stm32wb0-bluetooth-low-energy-wireless-interface-stmicroelectronics.pdf

    Best regards

    STTwo-32

    atrujilloAuthor
    Visitor II
    September 5, 2024

    I have some code here for configuring a beacon. However, it doesn't seem to correctly configure the CTE. The functions all return BLE_STATUS_SUCCESS, but when sniffing the packets using wireshark, they do not seem to have a CTE attached. They do look like extended periodic advertising packets, but I do not see a CTE.

     

     Advertising_Set_Parameters_t Advertising_Set_Parameters;
     tBleStatus ret = BLE_STATUS_SUCCESS;
    
     uint8_t b_index = 0;
     extended_beacon[b_index] = 0x02;
     extended_beacon[++b_index] = AD_TYPE_FLAGS;
     extended_beacon[++b_index] = FLAG_BIT_LE_GENERAL_DISCOVERABLE_MODE | FLAG_BIT_BR_EDR_NOT_SUPPORTED;
     extended_beacon[++b_index] = strlen(ext_beacon_name) + 1;
     extended_beacon[++b_index] = AD_TYPE_COMPLETE_LOCAL_NAME;
    
     memcpy(&extended_beacon[++b_index], &ext_beacon_name, strlen(ext_beacon_name));
     b_index += strlen(ext_beacon_name);
    
     uint8_t m_data_len = 19;
    
     extended_beacon[++b_index] = m_data_len;
     extended_beacon[++b_index] = AD_TYPE_MANUFACTURER_SPECIFIC_DATA;
     --m_data_len;
     extended_beacon[++b_index] = 0x30;
     --m_data_len;
     extended_beacon[++b_index] = 0x00;
     --m_data_len;
     // set some extra data
     for (uint8_t i = 0; i < m_data_len; ++i)
     {
     extended_beacon[++b_index] = i;
     }
    
     extended_beacon[++b_index] = 0x02;
     extended_beacon[++b_index] = AD_TYPE_TX_POWER_LEVEL;
     extended_beacon[++b_index] = 0x18;
    
    
     Advertising_Set_Parameters.Advertising_Handle = 0;
     Advertising_Set_Parameters.Duration = 0;
     Advertising_Set_Parameters.Max_Extended_Advertising_Events = 0;
    
     // set advertising parameters
     ret = aci_gap_set_advertising_configuration(Advertising_Set_Parameters.Advertising_Handle,
     GAP_MODE_GENERAL_DISCOVERABLE,
     (HCI_ADV_EVENT_PROP_TXPOWER_INC),
     2056,
     2056,
     HCI_ADV_CH_ALL,
     HCI_ADDR_PUBLIC, /* ignored param */
     peeraddr, /* No peer address */
     HCI_ADV_FILTER_NONE,
     0, /* 0 dBm */
     HCI_PHY_LE_1M, /* Primary advertising PHY */
     0, /* 0 skips */
     HCI_PHY_LE_1M, /* Secondary advertising PHY. Not used with legacy advertising. */
     1, /* SID */
     0x00 /* No scan request notifications */);
     check_ble_success(ret, "aci_gap_set_advertising_configuration");
    
     // set advertising data
     ret = aci_gap_set_advertising_data(Advertising_Set_Parameters.Advertising_Handle, ADV_COMPLETE_DATA, sizeof(extended_beacon), extended_beacon);
     check_ble_success(ret, "aci_gap_set_advertising_data");
    
     ret = GAP_set_extended_advertising_data(Advertising_Set_Parameters.Advertising_Handle, ADV_COMPLETE_DATA, sizeof(extended_beacon), extended_beacon);
     check_ble_success(ret, "GAP_set_extended_advertising_data");
    
     // set periodic advertisement parameters
     ret = hci_le_set_periodic_advertising_parameters(Advertising_Set_Parameters.Advertising_Handle,
     1000,
     2056,
     0x0040);
     check_ble_success(ret, "hci_le_set_periodic_advertising_parameters");
    
     // set connectionless cte parameters
     ret = hci_le_set_connectionless_cte_transmit_parameters(Advertising_Set_Parameters.Advertising_Handle,
     0x14, // length (0x02...x014)
     CTE_AOA, //type (AoA tone extension)
     0x01, // count
     0x00, // antenna count
     NULL /*antenna array*/);
     check_ble_success(ret, "hci_le_set_connectionless_cte_transmit_parameters");
    
     // enable periodic advertisement
     ret = hci_le_set_periodic_advertising_enable(0x02, Advertising_Set_Parameters.Advertising_Handle);
     check_ble_success(ret, "hci_le_set_periodic_advertising_enable");
    
     // set connectionless cte transmit enable
     ret = hci_le_set_connectionless_cte_transmit_enable(Advertising_Set_Parameters.Advertising_Handle ,1);
     check_ble_success(ret, "hci_le_set_connectionless_cte_transmit_enable");
    
     // enable advertising
     ret = aci_gap_set_advertising_enable(1, 1, &Advertising_Set_Parameters);
     check_ble_success(ret, "aci_gap_set_advertising_enable");