Device configuration descriptor request failed

81 views
Skip to first unread message

Attaul Haleem

unread,
May 13, 2024, 9:21:34 AMMay 13
to btstack-dev
Hi,

I am new to BLE programming. I am following the blog BTstack Port for STM32 USB – BlueKitchen (bluekitchen-gmbh.com) to port the BTstack to the STM32L4R9I and the CSR 8510. I am stuck on Step 2 - "Inspecting USB Interfaces and Endpoints". 

I get the following logs:
USB Device Connected
USB Device Reset Completed
PID: 1h
VID: a12h
Address (#1) assigned.
ERROR: Control error: Get Device configuration descriptor request failed
USB Device Connected
USB Device Reset Completed
PID: 1h
VID: a12h
Address (#1) assigned.
ERROR: Control error: Get Device configuration descriptor request failed
USB Device Connected
USB Device Reset Completed
PID: 1h
VID: a12h
Address (#1) assigned.
ERROR: Control error: Get Device configuration descriptor request failed
USB Device Connected
USB Device Reset Completed
PID: 1h
VID: a12h
Address (#1) assigned.
ERROR: Control error: Get Device configuration descriptor request failed
Control error, Device not Responding Please unplug the Device.

The VID and PID seem to be correct. Can you provide some insight on what the issue might be? Why does it fail to get the device descriptor?

Attaul Haleem

unread,
May 14, 2024, 5:48:02 AMMay 14
to btstack-dev
Nevermind. I made a mistake when configuring device in Cube MX. I changed the mode in Middleware -> USB Host -> Mode -> Class for FS IP -> Host Supporting All Classes and it works now.

Matthias Ringwald

unread,
May 15, 2024, 3:08:08 AMMay 15
to btsta...@googlegroups.com
Hi Attaul

Glad you found it. I didn't have better suggestions as that worked out of the box for me and I didn't use this USB stack much after the blog post.

Best
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/8492bc6b-9076-4ed7-a55c-bcd786b8852fn%40googlegroups.com.

Attaul Haleem

unread,
May 17, 2024, 4:44:56 AMMay 17
to btstack-dev
Hi Matthias,

Thank you for the response. I am now facing the following issue (with ENABLE_BTSTACK_ASSERT):

BTstack on STM32 F4 Discovery with USB support starting...

[00:00:00.210] LOG -- btstack_tlv.c.48: TLV Instance 0x8019c94

[00:00:00.212] LOG -- le_device_db_tlv.c.159: num valid le device entries 0

[00:00:00.214] LOG -- hci.c.5494: hci_power_control: 1, current mode 0

[00:00:00.216] LOG -- hci_transport_h2_stm32.c.51: hci_transport_h2_stm32_init

[00:00:00.218] LOG -- hci.c.8100: BTSTACK_EVENT_STATE 1

USB Device Connected

USB Device Reset Completed

PID: 1h

VID: a12h

Address (#1) assigned.

Manufacturer : N/A

Product : CSR8510 A10

Serial Number : N/A

Enumeration done.

This device has only 1 configuration.

Default configuration set.

Device remote wakeup enabled

[00:00:02.122] LOG -- usbh_bluetooth.c.67: USBH_Bluetooth_InterfaceInit

Interface 0, endpoint #0: address 0x81, attributes 0x03, packet size 16, poll 1

-> HCI Event

Interface 0, endpoint #1: address 0x02, attributes 0x02, packet size 64, poll 1

-> HCI ACL OUT

Interface 0, endpoint #2: address 0x82, attributes 0x02, packet size 64, poll 1

-> HCI ACL IN

Bluetooth class started.

[00:00:02.133] EVT <= 6E 00

ASSERT in hci.c, line 4357 failed - HALT


Line 4357 of hci.c is:

// release packet buffer without HCI_EVENT_TRANSPORT_PACKET_SENT (as it will be later)

btstack_assert(hci_stack->hci_packet_buffer_reserved); // this is the problem

hci_stack->hci_packet_buffer_reserved = false;


Without ENABLE_BTSTACK_ASSERT:

BTstack on STM32 F4 Discovery with USB support starting...

[00:00:00.210] LOG -- btstack_tlv.c.48: TLV Instance 0x8019918

[00:00:00.212] LOG -- le_device_db_tlv.c.159: num valid le device entries 0

[00:00:00.214] LOG -- hci.c.5494: hci_power_control: 1, current mode 0

[00:00:00.216] LOG -- hci_transport_h2_stm32.c.51: hci_transport_h2_stm32_init

[00:00:00.218] LOG -- hci.c.8100: BTSTACK_EVENT_STATE 1

USB Device Connected

USB Device Reset Completed

PID: 1h

VID: a12h

Address (#1) assigned.

Manufacturer : N/A

Product : CSR8510 A10

Serial Number : N/A

Enumeration done.

This device has only 1 configuration.

Default configuration set.

Device remote wakeup enabled

[00:00:02.107] LOG -- usbh_bluetooth.c.67: USBH_Bluetooth_InterfaceInit

Interface 0, endpoint #0: address 0x81, attributes 0x03, packet size 16, poll 1

-> HCI Event

Interface 0, endpoint #1: address 0x02, attributes 0x02, packet size 64, poll 1

-> HCI ACL OUT

Interface 0, endpoint #2: address 0x82, attributes 0x02, packet size 64, poll 1

-> HCI ACL IN

Bluetooth class started.

[00:00:02.119] EVT <= 6E 00

[00:00:02.122] CMD => 03 0C 00

[00:00:02.129] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.139] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.147] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.158] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.167] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.176] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.185] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.195] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.204] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.214] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.223] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.231] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.241] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.250] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.258] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.268] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.276] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.286] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.295] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.305] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.313] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.323] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.330] LOG -- hci.c.1826: Resend HCI Reset

[00:00:02.338] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.347] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.356] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.365] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.373] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.382] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.391] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.400] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.408] LOG -- usbh_bluetooth.c.240: URB State Event: 02

[00:00:02.418] LOG -- usbh_bluetooth.c.240: URB State Event: 02


Any idea what the issue might be? I was having trouble porting the flash memory part, but for now I have removed that part.

Matthias Ringwald

unread,
May 17, 2024, 4:53:19 AMMay 17
to btsta...@googlegroups.com
Hi Attaul

Please re-test on current master or develop branches. There had been changes to streamline the hci buffer management.

More info: BTstack tracks if the HCI buffer is in used, so the idea is that before writing to it, the code first asserts that hci_packet_buffer_reserved is 0, then sets it to 1 and writes to it.
Then, the HCI packet is handed over to the transport, e.g. your USB drivers, which will emit a HCI_EVENT_TRANSPORT_PACKET_SENT event, when it has sent the HCI packet
to the Controller. Please double check this for your transport.

Best regards
Matthias
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/fde92146-7898-4306-90a0-5d8460899fe9n%40googlegroups.com.

Attaul Haleem

unread,
Jun 7, 2024, 5:58:50 AMJun 7
to btstack-dev
Hi Matthias,

I ended up shifting to UART for the transport layer using STM32L4R9I-DISCO as host and ESP32 as controller. I ran the gap_inquiry example and it works now. As a next step, I would like to shift my code to FreeRTOS and have a dedicated thread running BTstack. The following code is working in a non-RTOS environment.

void port_main(void)
{
    btstack_memory_init();
    btstack_run_loop_init(btstack_run_loop_embedded_get_instance());
    hci_dump_init(hci_dump_embedded_stdout_get_instance());
    hci_init(hci_transport_h4_instance(btstack_uart_block_embedded_instance()), (void*) &config);
    btstack_main(0, NULL);
    btstack_run_loop_execute();
}

I tried replacing "embedded" instances (run loop and uart block) with "freertos" instances from the freertos folder in btstack but the code ends up in a hard fault. I could not find much documentation or examples on freertos. Could you point me in the right direction?

Matthias Ringwald

unread,
Jun 7, 2024, 10:22:00 AMJun 7
to btsta...@googlegroups.com
Hi Attaul

The ESP32 port of BTstack runs on top of FreeRTOS, as well as some customer projects.

Moving the init code to a dedicated thread and using the btstack_run_loop_freertos_get_instance() should be sufficient, btstack_uart_block_embedded.c can be used - it's identical to the FreeRTOS variant since a while.

A blind guess would be that the stack for the BTstack thread is too small, try a larger size, e.g. 8 kB and if it works, you can reduce it further.

Best
Matthias
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/e6b55352-e294-4063-9b78-2dae2a96c793n%40googlegroups.com.

Attaul Haleem

unread,
Jun 7, 2024, 11:10:41 AMJun 7
to btstack-dev
Hi,

Thanks a lot for responding.

I also thought it would be a stack size issue, but I actually needed to add HAVE_FREERTOS_TASK_NOTIFICATIONS to my btstack_config.h. Could not find any documentation regarding it but it seemed to do the trick.


Reply all
Reply to author
Forward
0 new messages