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

Problem with frame length to sent of APP

Hello,
I am developing a system where I have a app and a Rigado BMD-300 Module. I am using, for experiment, the nRF Connect App and in program, I use SDK 14.2 and s132 softdevice.
My question is that I want sending 5 bytes (40 bits) but the App only permite sending 4 bytes (32 bits).
I don't understand if my problem is in APP or in my code.
I believe that it is in APP and/or in definition of parameter GATT because I got following error when I send a frame: error 13 (0xd): GATT INVALID ATTR LEN.
I, also, thought that can to be limitation of Bluetooth but I don't no idea.
I want help for understand the error and I want meet a solution for problem.
Thanks and the best regards,
Daniel Fernandes

  • Hi Daniel, 

    can you post the snippet from the application code where you add the characteristic that you're trying to write to? I want to make sure that the size of the characteristic is set 5 and not 4.

    Best regards

    Bjørn 

  • I don't know if I understand your question, but I send this short part of my code. 

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    static uint32_t our_char_add(ble_os_t * p_our_service, ble_gatts_char_handles_t* p_chandle, uint16_t chuuid, bool notifyenabled, bool writeenabled, uint32_t* p_value)
    {
    uint32_t err_code;
    ble_uuid_t char_uuid;
    ble_uuid128_t base_uuid = BLE_UUID_OUR_BASE_UUID;
    char_uuid.uuid = chuuid;
    err_code = sd_ble_uuid_vs_add(&base_uuid, &char_uuid.type);
    APP_ERROR_CHECK(err_code);
    // Add read only properties to our characteristic
    ble_gatts_char_md_t char_md;
    memset(&char_md, 0, sizeof(char_md));
    char_md.char_props.read = 1;
    char_md.char_props.write = 0;
    if (notifyenabled) {
    // Configuring Client Characteristic Configuration Descriptor metadata
    // for notification and add to char_md structure
    // This should be read/write
    static ble_gatts_attr_md_t cccd_md;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Exactly what I wanted. In your code you'll see that the length of the characteristic value is set to 4, i.e. 4 bytes.

    attr_char_value.max_len = 4;
    attr_char_value.init_len = 4;

    If you change this to 

    attr_char_value.max_len = 5;
    attr_char_value.init_len = 5;

    Then you should be able to write 5bytes to the characteristic. 

    Best regards

    Bjørn 

  • Thanks, I didn't already remember this part of code. When, I sent for you this part of code and I saw this lines I did remember that it are this.

  • OK, are you now able to write 5 bytes to the characteristic?

1 2