From cae7b49c359082ac30c14d33f6708c3325844e7e Mon Sep 17 00:00:00 2001 From: Shawn Nock Date: Wed, 26 Jun 2019 10:55:43 -0400 Subject: [PATCH] Enables HFXO to ensure UART clock stability --- src/main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 0c407d7..96b9994 100644 --- a/src/main.c +++ b/src/main.c @@ -603,6 +603,9 @@ static int h5_open(struct device *unused) uart_irq_rx_disable(hci_uart_dev); uart_irq_tx_disable(hci_uart_dev); + /* Enable HFXO so that UART clock is stable for 115200 bitrate */ + *(uint32_t *)0x40000000 = 0x1; + bt_uart_drain(hci_uart_dev); uart_irq_callback_set(hci_uart_dev, bt_uart_isr); @@ -617,7 +620,8 @@ static int h5_open(struct device *unused) #if defined(CONFIG_BT_CTLR_ASSERT_HANDLER) void bt_ctlr_assert_handle(char *file, u32_t line) { - printk("Assert %s:%u", file, line); + printk("BT_CTLR Assert %s:%u", file, line); + sys_reboot(SYS_REBOOT_COLD); } #endif /* CONFIG_BT_CTLR_ASSERT_HANDLER */ @@ -756,5 +760,3 @@ next: net_buf_unref(buf); } } - -