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

Read uart data while advertising beacon

I want to use UART to read GPS data while advertising. After I add uart function to ble_beacon_example, UART API app_uart_get() always return NRF_ERROR_NOT_FOUND.What can I do? Board is nRF52-DK. SDK is nRF5_SDK_11.0.0_89a8197. This is my codemain.c

Parents
  • The peripheral\uart example is continuously calling the app_uart_get() function in order to check if there have been received any data in UART FIFO. But, when you also want to do BLE advertising or connection (as done in e.g. ble_app_uart), you don't have time to check the FIFO all the time. You only want to call app_uart_get() when you know that there is some data available. So for BLE, you want an interrupt/event(APP_UART_DATA_READY ) telling you when the UART have available data in the FIFO. You should therefore use the APP_UART_DATA_READY event when using BLE+UART.

Reply
  • The peripheral\uart example is continuously calling the app_uart_get() function in order to check if there have been received any data in UART FIFO. But, when you also want to do BLE advertising or connection (as done in e.g. ble_app_uart), you don't have time to check the FIFO all the time. You only want to call app_uart_get() when you know that there is some data available. So for BLE, you want an interrupt/event(APP_UART_DATA_READY ) telling you when the UART have available data in the FIFO. You should therefore use the APP_UART_DATA_READY event when using BLE+UART.

Children
No Data
Related