Skip to content

Commit d108946

Browse files
carlescufiAnas Nashif
authored andcommitted
Bluetooth: hci_uart: Fix init order in hci_uart bootup
bt_enable_raw() needs to be called before spawning the tx thread, otherwise there might be an HCI command processed from the UART before the HCI driver has been opened and therefore initialized. Change-Id: I050158bd48bebaf8fa2cf6b11efb54b531f70079 Signed-off-by: Carles Cufi <[email protected]>
1 parent 97ab403 commit d108946

File tree

1 file changed

+5
-2
lines changed
  • samples/bluetooth/hci_uart/src

1 file changed

+5
-2
lines changed

samples/bluetooth/hci_uart/src/main.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,11 +369,14 @@ void main(void)
369369
k_fifo_init(&tx_queue);
370370
k_fifo_init(&rx_queue);
371371

372+
/* Enable the raw interface, this will in turn open the HCI driver */
373+
bt_enable_raw(&rx_queue);
374+
/* Spawn the TX thread and start feeding commands and data to the
375+
* controller
376+
*/
372377
k_thread_spawn(tx_thread_stack, STACK_SIZE, tx_thread, NULL, NULL,
373378
NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);
374379

375-
bt_enable_raw(&rx_queue);
376-
377380
while (1) {
378381
struct net_buf *buf;
379382

0 commit comments

Comments
 (0)