I'm stucking in my project (see attachment) and need your help. My project is based on the BLE_HID_Joystick example with some changes for my requirements. I did not change the BLE modul and copied the BLE code, but I get an api error 100 (CYBLE_ERROR_INVALID_PARAMETER) and 300 after connecting to CySmart. My hardware is the CY8CKIT-042-BLE with the black PRoC board.
I couldn't find what error 300 is and I don't know how to solve error 100 (CYBLE_ERROR_INVALID_PARAMETER). It would be great if anyone would help me. I used PSoc creator 3.3 and 4.0.
The UART output:
BLE HID Keyboard Example Project <\r><\n> Bluetooth On, StartAdvertisement with addr: c04929199580<\r><\n> EVT_ADVERTISING, state: 3 <\r><\n> EVT_ADVERTISING, state: 3 <\r><\n> EVT_ADVERTISING, state: 3 <\r><\n> EVT_GATT_CONNECT_IND: 0, 4 <\r><\n> EVT_GAP_DEVICE_CONNECTED: connIntv = 0 ms <\r><\n> API Error: 300 <\r><\n> API Error: 10<\0>API Error:<\0>API Erro?API Error: 300 <\r><\n> API Error: 300 <\r><\n> CYBLE_EVT_GATTS_XCNHG_MTU_REQ, final mtu=<\0>API Erro<2>
There is a small issue in your code:
Before you enable Battery notification from the Central / Client, the "fbatteryMeasureNotify" is 0.
You define the error code as CYBLE_API_RESULT_T apiResult; When you do this, a garbage value may be stored in apiResult. This can be 300 or 100. So before you enable the notification, the following part of code alone gets executed in BatteryService_Cyclic () function:
if(apiResult != CYBLE_ERROR_OK)
DBG_PRINTF("API Error: %x \r\n", apiResult);
fbatteryMeasureNotify = false;
Here because of garbage value in apiResult, it will print as 300 or 100.
So, please change the declaration of apiResult as "CYBLE_API_RESULT_T apiResult = CYBLE_ERROR_OK;"
Also, please leave your E-mail ID for our internal records.
thanks, now there is no error at connecting. But after enabling all notifications I get api error 1 (CYBLE_ERROR_INVALID_PARAMETER) once. If I hit the button often sometimes I get one or two notifications. I'll try to find where it happens.
Where should I leave my mail address?
OK, I found the error: my batteryLevel was over 100, but only 100 % are allowed. Now it works and I can start to go on. Thank you very much.