You are here

PSOC 4 BLE Notification of custom characteristinc returns ERROR code 1 | Cypress Semiconductor

PSOC 4 BLE Notification of custom characteristinc returns ERROR code 1

Summary: 2 Replies, Latest post by Marian-Emanuel Ionascu on 09 Aug 2016 02:20 AM PDT
Verified Answers: 0
Last post
Log in to post new comments.
ionascu.marianemanuel_1654946's picture
29 posts

Hello Everybody,

Today I reach another strange topic that I personally do not get it.

I have a big custom characteristic of 44 bytes(11 int32 fields) that changes often( once at 4 seconds) and therefore I want them to notify the cell phone when the value changed.  Since the code is very long I will put here only the notification part. I may say that a simple slider example works perfectly. Also this example works in some conditions.


 tstSensorsForBLE tstValue;
    tstValue.CO = astSensor[0].i32AvgValue;
    tstValue.SO2 = astSensor[1].i32AvgValue;
    tstValue.NO2 = astSensor[2].i32AvgValue;
    tstValue.O3 = astSensor[3].i32AvgValue;
    tstValue.NO = astSensor[4].i32AvgValue;
    tstValue.Spec = astSensor[5].i32AvgValue;
    tstValue.CO2 = astSensor[6].i32AvgValue;
    tstValue.VOC = astSensor[7].i32AvgValue;
    tstValue.T = astSensor[8].i32AvgValue;
    tstValue.H = astSensor[9].i32AvgValue;
    tstValue.P = astSensor[10].i32AvgValue;

 if(u8ConnectionFlag != 0)
        /* Get a handle for the notification characteristic */
        /* Take the characteristic */
        /* Update the value and specify the lenght */
        tempHandle.value.val = (uint8 *)&tstValue;
        tempHandle.value.len = 44;
        CyBle_GattsWriteAttributeValue(&tempHandle, 0, &cyBle_connHandle, 0);
        /* If the BLE is connected with the phone notify it */
        if(u8Notif != 0)
           char str[20];
            CYBLE_API_RESULT_T result;
            /* Notify the phone that the values are update */
            result  = CyBle_GattsNotification(cyBle_connHandle,  &tempHandle);
            sprintf(str, "ERORR: %d wsdfgrfthjhuy\n",result);


The result code is always 1 which mean that one input parameter is not correct.

I track the problem to the size of the characteristic. If Instead of 44 length I put 20 then there is no error and it notifies correctly but above 20 I always have code 1.

My questions is: Is there a problem because I try to notify a characterstic of 44 bytes? If yes How can I do this notification of such big characteristic? 



SmartPSoC's picture
Cypress Employee
68 posts

Hello Marian,

In BLE 4.1v, the maximum link layer packet size is 27bytes. So you cannot send notification of more than 20bytes.

In BLE 4.2v the  Data length Extension feature supports PDU size of 251 bytes, with which you can send larger size packets.





ionascu.marianemanuel_1654946's picture
29 posts


Thank you for your answer. I enlarged the MTU to 47 bytes and now my custom iOS application is able to receive notification for that characteristic. Thank you!

Log in to post new comments.