Hello, I am trying to enable the use of both uart0 and uart1 in the app cpu while also using the board as a BLE central device.
Ultimately I would like to be able to connect USB to a host PC and to use use one uart for console/logs, and the other for binary transfer. I am basing my project off the Zephyr central_gatt_write sample app (https://docs.zephyrproject.org/latest/samples/bluetooth/central_gatt_write/README.html) and I currently have console + BT working well using uart0 with the app cpu.
From what I have read it seems that uart1 is currently dedicated to the net cpu, which I do see the "*** Booting Zephyr OS build zephyr-v3.4.0-1161-gc022115edb6c ***" messages from uart1. I don't need logs from the net cpu, so I tried remapping the pins by modifying the cpu app's dtsi (https://github.com/zephyrproject-rtos/zephyr/blob/main/boards/arm/nrf5340dk_nrf5340/nrf5340_cpuapp_common.dtsi#L164-L170) to add uart1:
&uart0 { status = "okay"; current-speed = <115200>; pinctrl-0 = <&uart0_default>; pinctrl-1 = <&uart0_sleep>; pinctrl-names = "default", "sleep"; }; &uart1 { status = "okay"; current-speed = <115200>; pinctrl-0 = <&uart1_default>; pinctrl-1 = <&uart1_sleep>; pinctrl-names = "default", "sleep"; };
as well as to add uart1's rts/cts to the pinctrl (github.com/.../nrf5340_cpuapp_common-pinctrl.dtsi
uart1_default: uart1_default { group1 { psels = <NRF_PSEL(UART_TX, 1, 1)>, <NRF_PSEL(UART_RTS, 0, 11)>; }; group2 { psels = <NRF_PSEL(UART_RX, 1, 0)>, <NRF_PSEL(UART_CTS, 0, 10)>; bias-pull-up; }; }; uart1_sleep: uart1_sleep { group1 { psels = <NRF_PSEL(UART_TX, 1, 1)>, <NRF_PSEL(UART_RX, 1, 0)>, <NRF_PSEL(UART_RTS, 0, 11)>, <NRF_PSEL(UART_CTS, 0, 10)>; low-power-enable; }; };
However when I do this, I don't get any output on uart1. I am sure there are better ways to do this with an overlay file, and/or I am missing something, so I am very open to suggestions here! Again, this is ultimately what I am working towards, but I believe I have also reproduced the issue without Zephyr below if that simplifies the problem.
I believe a simpler reproduction of the issue is done by using the above pin modifications + this sample/lesson (https://github.com/NordicDeveloperAcademy/ncs-fund/blob/main/v2.x.x/lesson5/fund_less5_exer1_solution/src/main.c), but changing this line to be uart1 instead of uart0 -- https://github.com/NordicDeveloperAcademy/ncs-fund/blob/main/v2.x.x/lesson5/fund_less5_exer1_solution/src/main.c#L39. This demo produces the expected output of:
nRF Connect SDK Fundamentals Course Press 1-3 on your keyboard to toggle LEDS 1-3 on your development kit
Then by adding `CONFIG_BT=y` to the prj.conf and rebuilding/flashing the cpuapp, I no longer see any output on uart1.
Is this expected that by enabling BT I should no longer see output on uart1? This is with or without an image flashed on the net cpu. Do I have a core misunderstanding about using these uarts, pin mappings, and/or how the uarts interact with BT? Thanks!