Hello,
My board contains nRF9160 and two nRF52840. One of nRF52840 is a HCI controller (based on HCI lpuart example). nRF9160 communicates with each nRF52840 over separate UART.
I want to be able to perform firmware update for both nRF52840 with mcumgr over the same pins that are used for regular communication. What would you suggest to achieve that?
I found out that it is possible to change a pinctrl state during the runtime so what would you say about the following solution:
Let's say that I configure three UARTS (one of them is assigned to bt-uart to communicate with HCI controller, one of them is used for communication with the second nRF52840 and the last UART is assigned to uart_mcumgr for firmware updates). During the normal work, the mcumgr uart pins are configured to pins that hangs. When I need to perform DFU for the HCI controller, I switch bt-uart pins to these hanging pins and assign pins connected to HCI conroller to mcumgr UART.
Here is what the device tree for UARTs would look like:
&pinctrl { uart0_default_alt: uart0_default_alt { group1 { psels = <NRF_PSEL(UART_TX, 0, 18)>, <NRF_PSEL(UART_RX, 0, 17)>; }; }; uart0_off_alt: uart0_off_alt { group1 { psels = <NRF_PSEL(UART_TX, 0, 19)>, <NRF_PSEL(UART_RX, 0, 25)>; }; }; uart1_default_alt: uart1_default_alt { group1 { psels = <NRF_PSEL(UART_TX, 0, 6)>, <NRF_PSEL(UART_RX, 0, 5)>; }; }; uart1_off_alt: uart1_off_alt { group1 { psels = <NRF_PSEL(UART_TX, 0, 19)>, <NRF_PSEL(UART_RX, 0, 25)>; }; }; uart2_default_alt: uart2_default_alt { group1 { psels = <NRF_PSEL(UART_TX, 0, 19)>, <NRF_PSEL(UART_RX, 0, 25)>; }; }; uart2_nrf1_alt: uart2_nrf1_alt { group1 { psels = <NRF_PSEL(UART_TX, 0, 18)>, <NRF_PSEL(UART_RX, 0, 17)>; }; }; uart2_nrf2_alt: uart2_nrf2_alt { group1 { psels = <NRF_PSEL(UART_TX, 0, 6)>, <NRF_PSEL(UART_RX, 0, 5)>; }; }; };
Setup:
Custom board with nRF9160 and two nRF52840
NCS v2.6.1
Best regards,
Filip