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

Using S140 with nRF52840, UART example question

Hello, I have a problem.

For example, I am using UART, and I had trouble printing everything when I used "app_uart_put ()" continuously.

My source is simple.

int main (void)
{
   uart_init ();

   ...(syncopation)

   for (cnt = 0 ;; cnt ++)
   {
     app_uart_put ('A');
     app_uart_put (cnt);
     nrf_delay_ms (200);
   }
}

If you run the source as above, only "AAAAAA" will be output but the value of cnt variable will not be output. If you comment out 'A' and run it, the value of the cnt variable will be output normally.

Why?

The above is what we have configured for testing, and we are planning to organize the packets and send them to other devices. However, if the intermediate packet is lost, normal communication will not be possible. Do not have a solution?

Parents
  • app_uart_put is a non blocking function (see documentation). This means that if you call it many times without any delays in between the first byte you try to send ('A') may not have been transmitted before you try to transfer another. You should check the return code of app_uart_put() and see if that can give you any clue.

  • Hi, Martin.

    thank you for the reply.

    I've fixed the issue. I was working on applying "uart" to the "hrs" example, and I was requesting app_uart_put using "app_uart.c".

    So, as Martin puts it,   If app_uart_put is requested continuously without putting, <ERROR_NO_MEM> is returned and it is confirmed that the transfer is not performed.

    After changing from "app_uart.c" to "app_uart_fifo.c", I confirmed that the app_uart_put is continuously output even when it requests continuously.

Reply
  • Hi, Martin.

    thank you for the reply.

    I've fixed the issue. I was working on applying "uart" to the "hrs" example, and I was requesting app_uart_put using "app_uart.c".

    So, as Martin puts it,   If app_uart_put is requested continuously without putting, <ERROR_NO_MEM> is returned and it is confirmed that the transfer is not performed.

    After changing from "app_uart.c" to "app_uart_fifo.c", I confirmed that the app_uart_put is continuously output even when it requests continuously.

Children
No Data
Related