This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Max Blob Read/Write Size

Other Parts Discussed in Thread: CC2540

Hi,

I am trying to write/read long byte stream from Andorid/iOS device to CC2540. I defined characteristic value length as 255 byte. When I connect to CC2540 with BTool, I can read/write 255 Byte with blob readings/writings. I also sniff the packets in the air by using SmartRF Packet Sniffer at the same time. It looks good.

However, when I try to write 255 bytes on Android, Android gives me Error Status 9. I tried to investigate the Error Status Code 9, however, even in Bluedroid stack of Android, I haven't found any clue about that. Then, I tried to reduce number of bytes I am writing, if I write 90 bytes or less then 90 bytes, I can successfully write byte stream to fob's characteristic. Else if I try to write more than 90 bytes, I always have Error Code 9 and can not write byte stream to characteristic.

According to Bluetooth Low Energy Specs, I am able to write/read up to 512 bytes with blob operations. So here are my questions:


1) Is this limit (90 bytes) up to stack implementer?

2) Is there a way to learn from device max blob write/read size?

3) Can I write 255 byte from Android and iOS to fob with Blob Operations?

4) What I want to do design something that works with Android and iOS devices. So if iOS and Android have different max limits for data read/write, what is your suggestion to exchange long characteristics?

Thank you for your help and time,

  • Hello dnz,

    The error codes for Bluetooth can be found in the Core Specs v4.0 Section D.

    • 2.9 CONNECTION LIMIT EXCEEDED (0X09) The Connection Limit Exceeded error code indicates that an attempt to create another connection failed because the Controller is already at its limit of the number of connections it can support. The number of connections a device can support is implementation dependent.

    This doesn't seem to apply with what you are doing.  Did you get the same results with an iOS?  Are you sending the data to the Android device using BTool or the CC2540?

    Thanks,

  • Hi Greenja,
    Thank you for your helpful reply. As you said, it does not make sense for me as well. I send data from Android Nexus 5 to CC2540 fob. Here is the code I use to send the data array mPayloadToSend:

    mBluetoothLeService.writeCharacteristic(FobServices.UUID_CHARACTERISTIC_MY_CHAR, mPayloadToSend);

    So, this is pretty much straight fwd from Android perspective. I assume, Android writes the mPayloadToSend into BLE buffer and send BLOBs toe to toe. On the other side, I haven't tried to exchange information on iOS yet.

  • Hello dnz,

    This may be something for you to search for on stackoverflow or a similar site.  Since you are able to send the blob with BTool from a CC2540 to another CC2540, it does appear to be an Android issue.  You can also search for the same thing in relation to the iOS.

    Perhaps someone with more Android experience can help you on this one.

    Thanks,

  • The TI stack lets you break a few BLE rules. Android and IOs are more strict and will terminate a connection for breaking rules that the CC2540 might ignore. 

    For example, the BLE spec says the max blob read size is 512 bytes.  A CC2540 will let you do blob reads of any size. Android will stop you at around 560 bytes, and IOs will stop at 524 bytes. 

    Trying to break this rule will only result in less data sent, but other rules such as connection parameters or pactet formatting may have more serious consequences. 

  • So Henrik,


    Do you think, I am getting this error because, my connection interval values are not good enough for iOS and Android, so I am getting this Error?


    #define DEFAULT_ADVERTISING_INTERVAL          160
    #define BLE_STOP_ADVERTIMENT_INTERVAL         10 
    #define DEFAULT_DESIRED_MIN_CONN_INTERVAL     10  
    #define DEFAULT_DESIRED_MAX_CONN_INTERVAL     16   
    #define DEFAULT_DESIRED_SLAVE_LATENCY         0      
    #define DEFAULT_DESIRED_CONN_TIMEOUT          100    
    #define DEFAULT_ADVERTISE_OFF_TIME            7500     
    #define DEFAULT_ENABLE_UPDATE_REQUEST         TRUE
    #define DEFAULT_CONN_PAUSE_PERIPHERAL         5

    uint8 initial_advertising_enable = FALSE;
    uint16 gapRole_AdvertOffTime = DEFAULT_ADVERTISE_OFF_TIME;
    uint8 enable_update_request = DEFAULT_ENABLE_UPDATE_REQUEST;
    uint16 desired_min_interval = DEFAULT_DESIRED_MIN_CONN_INTERVAL;
    uint16 desired_max_interval = DEFAULT_DESIRED_MAX_CONN_INTERVAL;
    uint16 desired_slave_latency = DEFAULT_DESIRED_SLAVE_LATENCY;
    uint16 desired_conn_timeout = DEFAULT_DESIRED_CONN_TIMEOUT;