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

UART TO BLE transfer Data Issue

I want to transfer data using UART to BLE by Baud Rate 19200(using nRF51822).

Transfer data speed need to achieve 2KB/sec up.

How can I do it successly?

Thank you.

  • Hi Wang Pai

    Yes, 2KB/s can be achieved with the nRF51822, both on the UART and over the BLE link. To see throughput limitations for the BLE stack, look at S110 Softdevice Specification v1.2, table 26. The UART supports baud rate up to 1Mbps, see nRF51 Series Reference Manual v2.1, section 28.9.10.

    The ble_app_uart example in the SDK is a good template for implementing UART+BLE application. It is documented here. It uses 38400 BAUD rate. It is implemented for the evaluation kit (PCA10001 board) but is easily well suited for the development kit, it is just a matter of mapping the UART pins differently for the development kit. For setup of UART for the development kit, you can look at the uart_example in the SDK (which is UART example which does not use BLE). The setup of the development kit for UART connection is shown here.

    Also, in the ble_app_uart example you need to have hardware flow control enabled to prevent data loss. This is because the CPU is blocked during a BLE connection interval and can only process UART data when the radio is not active.

    Transmitting one packet in a connection interval will block the CPU for ~1ms. Transmitting six packets (maximum) in a connection interval takes ~6ms. UART hardware buffer can hold 6 bytes. So if you transmit 1 packet per connection interval, maximum throughput on the UART is ~6kBps, as you can process UART data once per second. On the other hand, transmitting 6 packets per connection interval gives maximum throughput of ~1kBps on the UART.

    Update 30.10.2014 If hardware flow control is not available on the UART peer device, then the BAUD rate must be low to prevent data loss on the nRF51 side. According to my calculations, up to 9600 BAUD should be safe to use without hardware flow control, even when sending 6 packets per connection event. If the nRF51 only transmits one packet per connection event, then it should be safe to use up to 28,800 BAUD.

    Update 8.2.2016 With S110 softdevice 7.1.0/7.3.0 and nRF51 third revision IC, the nRF51 CPU can be unblocked during a BLE radio event, enabling maximum of around 500 microsecond CPU blocking time during a BLE event. More information on CPU blocking times for S110 softdevice during BLE operation, see the S110 Softdevice Specification 2.0 chapter 12. How to enable CPU unblocking for softdevice 7.1.0/7.3.0, see this thread and this thread. For S110 8.0.0+, which is targeted for nRF51 third revision IC, the CPU is unblocked by default.

  • What could be the strategy to minimize the chance of data loss when UART flow control is not available? I have a device that outputs ~20 bytes of data into UART every second. I could set it to 2400 bps so UART HW buffer takes 20 ms to fill up (and hope that the CPU will empty it during that time). Are there other optimizations I could make?

  • Hi Stefan,

    I just seen your comment that we can sent 2000 samples per seconds using nordic UART profile. I am working on same issue in may application. I have to send SAADC samples over BLE APP at 1000 samples per seconds. I am using UART profile to send data. one packets consists of 20 bytes(12 samples). So I have to send 84 packets in one second. I am getting only 20 packets.Moreover After receiving 20 packets connection with BLE device automatically gets terminated. Min Connection interval is 10ms and max is 100ms.

    Can you please suggest me how can I get 84 packets in one second without connection loss with BLE device?

  • HI,

    Have you done with it??I am getting same issue.

    TIA.

Related