Hi.
I'm trying to add Bluetooth capability to the "Asset Tracker V2" project. I was able to do it on the nRF9160DK board. I could not find a working example to make the Bluetooth work on Thingy91! I've tried these links:
https://devzone.nordicsemi.com/f/nordic-q-a/51693/hci_uart-on-thingy-91
https://devzone.nordicsemi.com/f/nordic-q-a/56147/making-thingy91-a-peripheral-bluetooth-device
I used the ".hex" files provided on those pages and flashed it on Thingy91 (Both hex files for the nRF9160 and nRF52840 SoC); It does not work for me. I can see in the RTT terminal that it fails to communicate with the Bluetooth module. I get this in the RTT terminal:
SEGGER J-Link V7.58b - Real time terminal output J-Link OB-K22-NordicSemi compiled Jul 2 2021 10:44:28 V1.0, SN=960090377 Process: JLink.exe ***** Booting Zephyr OS build v2.0.99-ncs1 ***** [00:00:00.505,981] <err> at_host: UART check failed: 12. Dropping buffer and retrying. Application started Initializing Bluetooth.. [00:00:00.835,998] <wrn> bt_hci_core: opcode 0x0000 pool id 5 pool 0x2002f390 != &hci_cmd_pool 0x2002f36c Establishing LTE link (this may take some time) ... Bluetooth ready Scanning... [00:00:01.264,465] <dbg> lte_lc.w_lte_lc_connect: Network mode: AT%XSYSTEMMODE=1,0,1,0 [00:00:02.444,335] <dbg> lte_lc.parse_nw_reg_status: Network registration status: 2 [00:00:02.593,322] <wrn> bt_driver: Discarding event 0x3e [00:00:28.907,348] <dbg> lte_lc.parse_nw_reg_status: Network registration status: 2 [00:00:28.946,655] <wrn> bt_driver: Discarding event 0x3e [00:00:28.978,057] <wrn> bt_driver: Discarding event 0x3e
I'm using the Thingy91 V1.6.0 (PCA20035) and nRF9160DK V1.1.0 (PCA10090) hardware for my tests.
I tried this, and it works (for nRF9160DK):
- Build the hci_lpuart project for the nRF9160DK board
- Build the asset_tracker_v2 project
- Added this to nrf9160dk_nrf9160_ns.overlay file:
&nrf52840_reset {
status = "okay";
gpios = <&interface_to_nrf52840 5 GPIO_ACTIVE_HIGH>;
};
/ {
chosen {
zephyr,bt-uart=&lpuart;
};
};
&gpiote {
interrupts = <49 NRF_DEFAULT_IRQ_PRIORITY>;
};
&uart2 {
current-speed = <1000000>;
status = "okay";
tx-pin = <18>; /* <&interface_to_nrf52840 1 0>; */
rx-pin = <17>; /* <&interface_to_nrf52840 0 0>; */
/delete-property/ rts-pin;
/delete-property/ cts-pin;
/delete-property/ hw-flow-control;
lpuart: nrf-sw-lpuart {
compatible = "nordic,nrf-sw-lpuart";
status = "okay";
label = "LPUART";
req-pin = <21>; /* <&interface_to_nrf52840 3 0>; */
rdy-pin = <19>; /* <&interface_to_nrf52840 2 0>; */
};
};
- Added this to nrf9160dk_nrf9160_ns.conf file:
CONFIG_NRF_SW_LPUART=y CONFIG_NRF_SW_LPUART_INT_DRIVEN=y CONFIG_UART_2_ASYNC=y CONFIG_UART_2_INTERRUPT_DRIVEN=n CONFIG_UART_2_NRF_HW_ASYNC=y CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2
- Added Bluetooth functionality to send out a notification alert message on button press
This works with no problem on the nRF9160DK board.
I tried to do the same for Thingy91:
- Build the hci_lpuart project for the Thingy91 board (selected the board from "Nordic boards"; it was not listed in Compatible boards). It uses the P1.0, P0.25, P0.19 and P0.22 as UART1 to communicate with nRF9160. These pins are connected to P0.22 to P0.25 of the nRF9160.
- Build the asset_tracker_v2 project
- Added this to thingy91_nrf9160_ns.overlay file:
/ {
chosen {
zephyr,bt-uart=&lpuart;
};
};
&uart1 {
current-speed = <1000000>;
status = "okay";
tx-pin = <22>; /* <&interface_to_nrf52840 1 0>; */
rx-pin = <23>; /* <&interface_to_nrf52840 0 0>; */
/delete-property/ rts-pin;
/delete-property/ cts-pin;
/delete-property/ hw-flow-control;
lpuart: nrf-sw-lpuart {
compatible = "nordic,nrf-sw-lpuart";
status = "okay";
label = "LPUART";
req-pin = <24>; /* <&interface_to_nrf52840 3 0>; */
rdy-pin = <25>; /* <&interface_to_nrf52840 2 0>; */
};
};
&gpiote {
interrupts = <49 NRF_DEFAULT_IRQ_PRIORITY>;
};
&nrf52840_reset {
status = "okay";
gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
};
- Added this to thingy91_nrf9160_ns.conf file:
CONFIG_NRF_SW_LPUART=y CONFIG_NRF_SW_LPUART_INT_DRIVEN=y # CONFIG_UART_1_NRF_UARTE=y CONFIG_UART_1_ASYNC=y CONFIG_UART_1_INTERRUPT_DRIVEN=n CONFIG_UART_1_NRF_HW_ASYNC=y CONFIG_UART_1_NRF_HW_ASYNC_TIMER=2
- Added Bluetooth functionality to send out a notification alert message on button press
It hangs up on Bluetooth initialization, and WDT resets the chip after time out. No errors are coming out!
I'm not sure what to do next! Any suggestion is appreciated.