Then I decided that I wanted to send a bit more data to the iPhone and everything fell apart.
I know you can only send 20 bytes at a time, that's not the problem. The problem seems to be when you send many packets. Exactly how many packets before it chokes up seems to vary. The board seems to be able to receive a huge amount of data very quickly without any issues, however.
Here's the relevant bits of the Arduino side:
Code: Select all
#define ADAFRUITBLE_REQ 10
#define ADAFRUITBLE_RDY 1 // This should be an interrupt pin, on Uno thats #2 or #3
#define ADAFRUITBLE_RST 9
Adafruit_BLE_UART BTLEserial = Adafruit_BLE_UART(ADAFRUITBLE_REQ, ADAFRUITBLE_RDY, ADAFRUITBLE_RST);
void btleTest() {
uint8_t buffer[20];
for (uint8_t i = 0; i < 20; i++) { buffer[i] = i; }
while(true) {
BTLEserial.write(buffer, 20);
delay(1000);
}
}
Code: Select all
func peripheral(peripheral: CBPeripheral!, didUpdateValueForCharacteristic characteristic: CBCharacteristic!, error: NSError!) {
NSLog("Received data: %@", readCharacteristic!.value)
}
Code: Select all
Received data: <00010203 04050607 08090a0b 0c0d0e0f 10111213>
Received data: <00010203 04050607 08090a0b 0c0d0e0f 10111213>
Received data: <00010203 04050607 08090a0b 0c0d0e0f 10111213>
Received data: <00010203 04050607 08090a0b 0c0d0e0f 10111213>
Received data: <00010203 04050607 08090a0b 0c0d0e0f 10111213>
Any idea what's going on here? It's driving me insane. I simply want to send a few hundred bytes shortly after initial connection, and having an indeterminate amount of data simply not arrive is kind of deal breaker.