API Cy_BLE_GetBatteryLevel() occupies no any external resources, and it's work flow is pretty simple.
Could you tell how your code is going with calling the API Cy_BLE_GetBatteryLevel()? Have you ever tried the project attached in thread -
Yes I've tried the project but it didn't work, when I call Cy_BLE_GetBatteryLevel () I cannot connect the ble and he gives me an error
Cy_BLE_GetBatteryLevel API Error: 160004
I've found also this other thread How to get Voltage of PSOC 6 without ADC but I don't know how the LVD works and in which way I can recall it..
Have you any suggestions or part of code which I can refer to?
Please refer to below tips with use of Cy_BLE_GetBatteryLevel()
a. You can not pool Cy_BLE_GetBatteryLevel function in "while" loop.Those function is a non-blocking function and value is informed through 'CY_BLE_EVT_RADIO_VOLTAGE_LEVEL' event. Please add some logic to call next time only if previous completed (receive CY_BLE_EVT_RADIO_VOLTAGE_LEVEL) event.
b. the parameter comes with CY_BLE_EVT_RADIO_VOLTAGE_LEVEL event should be generic event.
cy_stc_ble_events_param_generic_t *param = (cy_stc_ble_events_param_generic_t *)eventParam;
if(param->status == 0u)
DBG_PRINTF("CY_BLE_EVT_RADIO_VOLTAGE_LEVEL: %u \r\n", *(uint16 *)param->eventParams);
c. The voltage measured through Cy_BLE_GetBatteryLevel() is VDDR_HVL, not VDDR.
Let me know if the above helps.