Problems when whitelisting multiple bd_addr

18 views
Skip to first unread message

Atta

unread,
Jul 2, 2024, 4:52:20 AMJul 2
to btstack-dev
Hi,

I am using a freertos port of BTstack with STM32L4 (host) and ESP32 (controller) and it is working fine. I am running the gap_le_advertisments example with slight modifications in gap_le_advertisments_setup.

static void gap_le_advertisements_setup(void)
{
    static bd_addr_t addr_1 = {0xF8, 0x33, 0x31, 0x5E, 0xBD, 0x1A};       
    static bd_addr_t addr_2 = {0xA0, 0x82, 0x22, 0xD4, 0x4C, 0xB5}; 

    gap_whitelist_add(BD_ADDR_TYPE_LE_PUBLIC, addr_1);
    gap_whitelist_add(BD_ADDR_TYPE_LE_PUBLIC, addr_2);

    // Active scanning, 100% (scan interval = scan window = 30 seconds), white list on
    gap_set_scan_params(1, 48, 48, 1);
    gap_start_scan();

    hci_event_callback_registration.callback = &packet_handler;
    hci_add_event_handler(&hci_event_callback_registration);
}

When I whitelist one address at a time, I am able to see only its advertisements. When adding both, only the advertisments for addr_1 show up. I have noticed that device with addr_1 advertises more frequently than device with addr_2.

Am I using the API correctly? If so, what could be the problem?

Matthias Ringwald

unread,
Jul 2, 2024, 5:06:36 AMJul 2
to btsta...@googlegroups.com
Hi Atta

Your code looks good, the API is used correctly. Could you enable HCI dump, convert it to a .pklg file and share it here to get some insight if there's an issue with the stack or the Controller?
You could also try the same code running BTstack on the ESP32 directly.

Best regards
Matthias
> --
> You received this message because you are subscribed to the Google Groups "btstack-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to btstack-dev...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/03b6e07e-508d-432e-9c79-6e14d2f623f9n%40googlegroups.com.

Atta

unread,
Jul 2, 2024, 6:18:52 AMJul 2
to btstack-dev
Thanks for responding but I solved it. I had foolishly forgotten to increase MAX_NR_WHITELIST_ENTRIES in btstack_config.h. Now I can whitelist multiple device addresses without a problem.

Matthias Ringwald

unread,
Jul 2, 2024, 1:07:37 PM (14 days ago) Jul 2
to btsta...@googlegroups.com
Hi Atta

Glad you've figured it out. There might have been a warning in the HCI Dump, too. Also, almost all API functions return a status code. Especially if something is not working as expected, it's worth to check the status code.
I often just add an btstack_assert(status == ERROR_CODE_SUCCESS), as that fails immediately for case where I didn't expect an error

Cheers
Matthias
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/899d88ef-2867-4076-b822-2b76d5e65640n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages