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

Crash when writing > 20 bytes (from Android)

Hi,

I'm trying to write more than 20 bytes to a custom characteristic, from Android (Cordova BLE Central), but this completely crashes my App

APP_ERROR:ERROR:Fatal

I'm using SDK 12.1 App Template, plus the LED & Button example service LBS

I set the LED (Write) characteristic to have a max size of 256 like this

   attr_md.vloc       = BLE_GATTS_VLOC_STACK;
    attr_md.rd_auth    = 0;
    attr_md.wr_auth    = 0;
    attr_md.vlen       = 0;// variable length set to false (disabled)
    
    memset(&attr_char_value, 0, sizeof(attr_char_value));

    attr_char_value.p_uuid       = &ble_uuid;
    attr_char_value.p_attr_md    = &attr_md;
    attr_char_value.init_len     = sizeof(uint8_t);
    attr_char_value.init_offs    = 0;
    attr_char_value.max_len      = 256;//sizeof(uint16_t);
    attr_char_value.p_value      = NULL;

Do I need to increase some buffer size so I can send more than 20 bytes.

BTW. I am using the nRF51822QFAA (16k) and have the IRAM setting at 0x20001FE8

But perhaps I need to give the SD more RAM ??

Parents
  • Just to update on my continued testing.

    I tried using the proximity example, and I'm writing 21 bytes to the Link Loss service (even though its length is listed as 2 bytes)

    But it doesn't crash like the LBS example code does.

    So I'll need to find what the difference is between these two firmwares is. Because the issue may be in the error handing or lack of it in main, rather than the LBS service its self

    One thing I have noticed however, is that the examples don't seem to have an inactivity timeout.

    IMHO all devices with services should implement in inactivity timeout, otherwise a DOS style attack could be mounted against BLE devices by writing an Android application, which connects but does not disconnect, thus locking the BLE device to further communications and flattening its battery.

Reply
  • Just to update on my continued testing.

    I tried using the proximity example, and I'm writing 21 bytes to the Link Loss service (even though its length is listed as 2 bytes)

    But it doesn't crash like the LBS example code does.

    So I'll need to find what the difference is between these two firmwares is. Because the issue may be in the error handing or lack of it in main, rather than the LBS service its self

    One thing I have noticed however, is that the examples don't seem to have an inactivity timeout.

    IMHO all devices with services should implement in inactivity timeout, otherwise a DOS style attack could be mounted against BLE devices by writing an Android application, which connects but does not disconnect, thus locking the BLE device to further communications and flattening its battery.

Children
No Data
Related