Bluetooth: hci0: link tx timeout when sending multiple notifications to TxCharacteristic

I'm using the Nordic UART Service to implement BLE communication between an iOS app (central) and a Raspberry Pi (peripheral). Whenever I send a large payload to the central, I break those payloads up and send a notify to send each one. However, whenever I do that, I am seeing some "Bluetooth: hci0: link tx timeout" messages in the syslogs. 

The payload seems to be reaching the central OK, but I do notice some intermittent flakiness. I was wondering if anyone had any insight to what is causing these errors.

class TxCharacteristic(Characteristic):
    """GATT characteristic for transmitting data to connected BLE device

    """
    def __init__(self, bus, index, service):
        Characteristic.__init__(self, bus, index, UART_TX_CHARACTERISTIC_UUID,
                                ['notify'], service)
        self.notifying = False

    def send_tx(self, s):
        if not self.notifying:
            return
        s_bytes = json.dumps(s)

        value = []
        for c in s_bytes:
            value.append(dbus.Byte(c.encode('utf-8')))
            # If payload exceeds MTU, send it in pieces
            if len(value) >= 512:
                self.PropertiesChanged(constants.GATT_CHRC_IFACE, {'Value': value}, [])
                value.clear()

        if len(value) > 0:
                self.PropertiesChanged(constants.GATT_CHRC_IFACE, {'Value': value}, [])

    def StartNotify(self):
        if self.notifying:
            return
        self.notifying = True

    def StopNotify(self):
        if not self.notifying:
            return
        self.notifying = False

Parents Reply Children
No Data
Related