This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf_serial_write don't work in blocking mode

Hi!

I'm working on the NRF52832. I'm using the function "nrf_serial_write()" to send data over uart. I want it to work in blocking mode. As I can read in the infocenter, if I put a time into the "timeout_ms" parameter, the function should work in blocking mode. But the function seems to work in nonblocking mode because without the delay of 50 ms, the "nrf_serial_uninit()" function stops the data transmission. There is my code:

              //Uart speed is 9600 bps
              //BUF_LEN = 26
              nrf_serial_write(&serial_uart, &buf, BUF_LEN, NULL, 1000); // Send byte over OW
              nrf_delay_ms(50);
              nrf_serial_uninit(&serial_uart);
*

*I send 26 bytes at 9600 bps. A timeout of 1000 ms should be enough.

I expect the problem is with the timer initialization of the uart timer. There is my code:

    ret_code_t ret;

    ret = nrf_drv_clock_init();
    APP_ERROR_CHECK(ret);
    nrf_drv_clock_lfclk_request(NULL);
    ret = app_timer_init();
    APP_ERROR_CHECK(ret);

What am I missing?

Thank you!

Related