1. Could you please let me know in which state (whether it is in advertising state or in connected state) the device rarely enters into the low power mode ?
2. Could you please check with the AN92584.zip example projects (in different GATT Profile roles) and let me know your observations.
3. Please refer to the 'AN92584 - Designing for Low Power and Estimating Battery Life for BLE Applications' datasheet for more information on Designing of low power applications.
Hello Yugandhar, here are my answers....
1) The device is in original rest state (after reset hw), where both Observer and Advertiser are active: I can get remote device's Broadcart frames and simultaneously do Advertisement. It seems to work fine, but rarely the LowPower state is entered.
If I modify the BLE device defining it Advertising only, the Main() LowPower state enters for most time.
What's important in this application is getting LowPower in original rest state (Observer and Advertiser are active) then in connected state it does not matter if LowPower can't be achieved: it'll stay there for a short time!
2) 3) I'll have a look: but I know it's quite complex.....
Thanks a lot for your kind collaboration!
1. The BLESS will wakeup the device from Deep sleep and generates an interrupt for every Advertisement interval (when the device is in Peripheral role) or for every scan interval (when the device is in Central role). If you are doing both observer and advertiser together in the project, then the BLESS will wakeup for every scan interval and advertisement interval.
2. In your project, increasing of Advertisement and scan interval values(with less scan window) will give minimum power consumption.
3. In the Scan parameters, scan interval will indicates how often you want to scan, while the scan window indicates the duration of the scan as shown in attached image. So, higher scan interval value with lesser scan window will reduce the power consumption of your device.
Dear Yugandhar, here I am again on this Project.....
I told you the Dual Role prj was running Ok, power consumption apart....I saw you answered me about this item but at the moment I have more priority on same job about BLE communication:
I don’t receive Client written data on my characteristic (write and write without response properties)
when I try connection using a real APP. Please notice that this trouble also arises using "LightBlue" standard APP. >> But using CySmart it works!
In other words: using “LightBlue” I can’t receive data written on my “Custom Characteristic 2” if before Client has enabled Notifications…. If Client does not enable my Notifications, I receive data!
As stated before it all works If I enable Notifications by the use of CySmart, writing 0x01 on “Client Characteristic Configuration”
In both cases, by the use of a breakpoint, I see my application reaches the same point on my code, where I do the following code:
errore = CyBle_GattsWriteAttributeValue(&wrReqParam->handleValPair, 0, &cyBle_connHandle,CYBLE_GATT_DB_PEER_INITIATED);
Could it be that this function call is not correct and it disables something on the stack?
Here attached my project...
Sure you will help me about this all, thanks in advance.
Please refer to the below attached project.
Whenever a write request occurs, CyBle_GattsWriteRsp() function has to be invoked in response to a valid Write Request event from the GATT Client(CYBLE_EVT_GATTS_WRITE_REQ) to acknowledge that the attribute has been successfully written.
Please check the return value of GATT Error code specified in 'CYBLE_GATT_ERR_CODE_T' for CyBle_GattsWriteAttributeValue() API and send the write response (on successful operation) or error response as shown below in CYBLE_EVT_GATTS_WRITE_REQ event.
gattErr = CyBle_GattsWriteAttributeValue(&wrReqParam->handleValPair,0,&cyBle_connHandle,CYBLE_GATT_DB_PEER_INITIATED);
if(gattErr != CYBLE_GATT_ERR_NONE)
err_param.opcode = (uint8) CYBLE_GATT_WRITE_REQ;
err_param.attrHandle = wrReqParam->handleValPair.attrHandle;
err_param.errorCode = gattErr;
/* Send Error Response */
Please let me know if you have any questions.