Hi,
I am working on a 2-wire uart to save GPIO and try to get as low current consumption as I can get.
Here is how I want it to be:
My custom 52840 board have 2-wire rx/tx connected to a sensor's UART and there is no RTS/CTS.
After received UART data from the sensor, 52840 will wake up and then process the data sent by the sensor and then back to sleep again.
The sensor will resend uart data until hear UART response from 52840, so I don't need to worry about data lost.
I looked up in devzone and found out that I can not use zephyr uart driver or lpuart to achieve my goal.
(Or is there a valid approach that I do not find?)
I checked sample/nrf/nrfx_prs, I think I can follow this sample and make it works like this:
Config rx pin of 52840 as an GPIO and register an IRQ.
When there were data comes in then reconfig UART at runtime using nrfx_uarte_init() and start sending/recving data.
After no more data comes in, call nrfx_uarte_uninit and reconfig the rx pin to GPIO and register an IRQ to save power.
It works using nrfx_uarte_init() and then use nrfx_uarte_tx() to send data using non-blocking mode.
Then I found this thread: 52833-uart-power-consumption, It looks like using EasyDMA will have a higher current consumption.
So I try to use nrfx_uart to replace nrfx_uarte. This is where I met the issue:
After I changed .overlay to use "nordic,nrf-uart" to replace "nordic.nrf-uarte", and use nrfx_uart_xxx APIs to replace nrfx_uarte_xxx APIs.
Then I put 12 bytes in the tx buffer of nrfx_uart_tx() and only 1 byte recved. (I use a USB-Serial cable to connect 52840 with my PC and with nrfx_uarte_xxx APIs, it works properly)
Then I try to set the callback func to NULL in nrfx_uart_init() to make it works in blocking mode, after that all 12 bytes recved.
Removed all my code and only called nrfx_uart_init() and nrfx_uart_tx() and the issue is still there.
Any suggestions?
How can I use nrfx_uart in non-blocking mode?
Regards,
Anthony Yuan