If the Server already responded with an opcode which is done by the stack in most scenarios, this this operation could be invalid.
I believe this is what you are seeing in your case. Do you have airlogs for this scenario?
I don't have airlogs.
I think that the stack does not respond because I must invoke:
If, inside CYBLE_EVT_GATTS_WRITE_REQ event, I don't call this function, the phone connected to me complains.
The doc says: This function has to be invoked in response to a valid Write Request, but, in some cases, I would like to send an error (the phone should retry later). How can I send an error?
Looks like the issue is with the opcode used, the below code works for me to generate the error response
errrsp.attrHandle=CYBLE_CUSTOM_SERVICE_CUSTOM_CHARACTERISTIC_CHAR_HANDLE;//handle to which write was done
errrsp.opcode= (uint8)CYBLE_GATT_WRITE_REQ;//opcode for error response
errrsp.errorCode=CYBLE_GATT_ERR_INVALID_ATTRIBUTE_LEN ;//ATTr length error
apiresult = CyBle_GattsErrorRsp(cyBle_connHandle,&errrsp);
printf(" ERROR API RESULT %d \n",apiresult);