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

Use app_uart_put() to send data

After I add uart function to ble_example, I use app_uart_put()to send data,but data only one byte.What can I do?My board is nRF52-DK.SDK is nRF5_SDK_11.0.0_89a8197.This is my code main.c

Parents
  • There is no other way in Nordic UART driver then using app_uart_put() function and flush bytes to UART Tx stream one by one. You have it on many instances of your code so I suppose you do it properly. One way how streamline this is to use UART with FIFO module which simply adds all Tx and Rx bytes to the queue and in case of outgoing transfer it handles UART events such as NRF_DRV_UART_EVT_TX_DONE and outputs next byte (until end of current queue depth is reached). I believe nrf_log module is using it y default if you go with UART and not RTT...

    Or does your "but data only one byte" means that you never get more than one byte on the other side of UART regardless how many times you call app_uart_put()? That would indicate rather problem with the interpretation on receiver's side (is that some Terminal program on PC and using UART to USB serial convertor or something similar?)

Reply
  • There is no other way in Nordic UART driver then using app_uart_put() function and flush bytes to UART Tx stream one by one. You have it on many instances of your code so I suppose you do it properly. One way how streamline this is to use UART with FIFO module which simply adds all Tx and Rx bytes to the queue and in case of outgoing transfer it handles UART events such as NRF_DRV_UART_EVT_TX_DONE and outputs next byte (until end of current queue depth is reached). I believe nrf_log module is using it y default if you go with UART and not RTT...

    Or does your "but data only one byte" means that you never get more than one byte on the other side of UART regardless how many times you call app_uart_put()? That would indicate rather problem with the interpretation on receiver's side (is that some Terminal program on PC and using UART to USB serial convertor or something similar?)

Children
No Data
Related