I want to disable and enable UART at runtime. I don't use DMA and interrupt.
I read this thread.
https://devzone.nordicsemi.com/f/nordic-q-a/52496/nrf9160-uart-pull-up-and-power-consumption/216096#216096
I tried this code but doesn't work. Any help?
#define TXD_PIN 24 void enable_uart(){ NRF_UARTE3->ENABLE = 8; NRF_UARTE3->TASKS_STARTTX = 1; NRF_UARTE3->TASKS_STARTRX = 1; } void disable_uart(){ NRF_UARTE3->TASKS_STOPRX=1; while(NRF_UARTE3->EVENTS_RXTO == 0); NRF_UARTE3->EVENTS_RXTO = 0; NRF_UARTE3->TASKS_STOPTX = 1; while(NRF_UARTE3->EVENTS_TXSTOPPED == 0); NRF_UARTE3->EVENTS_TXSTOPPED = 0; NRF_UARTE3->ENABLE = 0; NRF_UARTE3->PSEL.TXD = 0xFFFFFFFF; NRF_P0_NS->OUTCLR = (1 << TXD_PIN); }
Thanks!