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

nRF51822 BLE - Android and iOS app development

Hi Nordic,

We are working on Android and iOS apps. Currently using S3 with Android 4.3 and Note to communicate with nRF51822. Baud rate of 19200bps for our serial communication.

Reference to Kristin post dated Nov 20, 2013 on topic: 51822 BLUETOOTH

Q1. How can we synchronize the transmission of 4 packets per connection interval? Based on sample code nRFUART, do we send out consecutively packet of 20 bytes after previous packet was sent out using writeRXCharacteristic ? Or should it pause for 10ms before sending out the next packet?

Q2. We have encountered abnormal behavior on S3 and Note after using writeRXCharacteristic at time interval of 20ms or lower. Is there a way to read transmission status in Android app before using writeRXCharacteristic to send out 20 bytes?

Q3. In our project, data size transmitted can be more than 100kbytes. Is there any further recommendation on Android and iOS app that we need to take note in order to increase data rate and avoid abnormal behavior on devices?

Thank you.

Regards, Paul

Parents
  • Hi Paul

    Q1: I am not aware of that you can get notification on when the Android stack has sent buffered packets, see Q2.

    Q2: I am not aware of that you can read the status of the connection from the Android BLE stack. After you call writeRXCharacteristic, you will receive a callback from the Android stack if the packet has been queued up for transmission in the BLE stack. If the callback is positive, there is buffer space available and you can just go ahead and give another packet to the BLE stack. If the callback is negative, it means that the stack buffer is full and you must try again later to buffer up the same packet. I could recommend to start a timer before suspending the thread and let the timer wake up the thread again later in order to retry.

    Q3: Which direction do you transfer this data, from the nRF51822 to the Android, or in the opposite direction. You can realize expected data rate on this thread when sending data with notifications.

    Write requests from the central will not give you much throughput, see data througput section in the S110 Softdevice Specification, available on our web site. Write commands will however give you higher througput.

    If you use write request from the central you can only send one packet in every second connection interval. This is because there is an acknowledgement required for each packet from the slave before another packet is sent. You can boost your throughput from the central by sending write command instead which does not include acknowledgement. You can also choose to have a GATT server residing on the central device instead of the peripheral device, enabling the central to send notifications.

Reply
  • Hi Paul

    Q1: I am not aware of that you can get notification on when the Android stack has sent buffered packets, see Q2.

    Q2: I am not aware of that you can read the status of the connection from the Android BLE stack. After you call writeRXCharacteristic, you will receive a callback from the Android stack if the packet has been queued up for transmission in the BLE stack. If the callback is positive, there is buffer space available and you can just go ahead and give another packet to the BLE stack. If the callback is negative, it means that the stack buffer is full and you must try again later to buffer up the same packet. I could recommend to start a timer before suspending the thread and let the timer wake up the thread again later in order to retry.

    Q3: Which direction do you transfer this data, from the nRF51822 to the Android, or in the opposite direction. You can realize expected data rate on this thread when sending data with notifications.

    Write requests from the central will not give you much throughput, see data througput section in the S110 Softdevice Specification, available on our web site. Write commands will however give you higher througput.

    If you use write request from the central you can only send one packet in every second connection interval. This is because there is an acknowledgement required for each packet from the slave before another packet is sent. You can boost your throughput from the central by sending write command instead which does not include acknowledgement. You can also choose to have a GATT server residing on the central device instead of the peripheral device, enabling the central to send notifications.

Children
  • Hi Stefan,

    In our project, we want to maximize throughput of sending large size data from smart phone devices (Android/iOS) to nRF51822. We have not find a suitable method yet.

    But in your last paragraph, you mentioned write command which does not include acknowledgement that can boost the throughput. Can this be done on Android?

    I can only see writeRXCharacteristic, BluetoothGatt API - writeCharacteristic function and its corresponding callback.

    Thanks.

    Regards, Paul

Related