UART LF CR

Hello,

I am using the peripheral uart sample and it works fine. My issue is that whenever the buffer is full it automatically sends the data from the com. How do I stop that from happening (meaning data from the com is sent IF AND ONLY IF I press the send key and not if the buffer is full)?

  • Hi,

    Are you referring to this example?

    The UART peripheral example in the nRF5SDK will not wait for the FIFO to be full, but will rather send a character as long as there is any data in the FIFO buffer by using app_uart_get and app_uart_put.

    If you want to only send data when you press a button, then you have to combine something like the bsp example with the uart example. You can then call app_uart_get and app_uart_put in the bsp_evt_handler(), or even better set a flag in the bsp event handler that indicates that a button has been pressed and then call app_uart_get and app_uart_put in the main loop.

    best regards

    Jared

  • I am referring to this sample on the nrf Connect for VS Code.

    Originally the maximum size of bytes is 40. When using the tera term or PuTTY com for example, it sends the data either when the "enter" key is pressed or when the 40 bytes capacity is reached. I only want it to send data when the "enter" key is pressed.

  • Hi,

    I don't know, as I can't see how this would be directly related to our example. As far as I know, there isn't anything in our example that would restrict the COM side to only 40 characters. I think you have to refer to the documentation for the COM that you're using.

    regards

    Jared 

Related