Hi all!
I am developing an application with Zephyr (commit b21a91e46833cfcf4f2bda9e3e0f9d8c2150882e) on nrf52833 and a Ublox SARA R5. I communicate with the module via the UART and I am now trying to optimise the power consumption. When I run the code with the UART1 status 'disabled' on the devicetree I get the expected power consumption (uA), but when I try to enable it (even without using it, just setting the status to "okay") the power consumption stays on the mA range.
I have the following settings enabled:
CONFIG_PM=y CONFIG_PM_DEVICE=y CONFIG_PM_DEVICE_RUNTIME=y
and I think the power management is working fine without the UART. I tried to force the UART to sleep with the following code:
int error = pm_device_state_set(DEVICE_DT_GET(DT_NODELABEL(uart1)), PM_STATE_SOFT_OFF, NULL, NULL);
But the function return a -134 error, which I think is a "non supported" error. Moreover, I tried to be sure that the UART has no IRQ or RX active, running this code:
uart_irq_tx_disable(uart); uart_irq_rx_disable(uart); int error = uart_rx_disable(uart);
but the consumption doesn't change and the 'uart_rx_disable' returns -14, which if I am not mistaken means the UART RX is already disabled.
Do you have any pointers on how to turn off the UART at runtime?
Thanks a lot!