Where is the code where BLE goes to deep sleep

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Can anyone show me the code in the BLE stack that puts the system in deep sleep when it is done its connection service duties.

   

I am thinking about trying to put some code there that reads my sensor and puts it in the BLE buffers ready for next connection interval sendout and to process the BLE events.

   

This would make life much easier as I would not have synchronizing problems between my connection interval and my WDT interrupt where I am currently thinking about putting my code.

   

Thanks,

   

Dale

0 Likes
5 Replies
Anonymous
Not applicable

Oh and I would need the same point when it advertises 🙂

   

I am talking about a GATT Server and Gap peripheral setup.

   

Or, is there a way to intercept the following mentioned interrupt so that I can read my sensor and process ble events while the rf section is spooling up and sending/receiving data (3ms each time):

   

'the BLE Sub-system and the micro-controller are woken up by an interrupt every advertisement interval(in case of a GAP Peripheral) or connection interval (in case of GAP Central).'??

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

So I have been searching the whole BLE generated code for this but with my limited understading of things, I can not find any place where I can insert my code.

   

I have created an image of a 3ms connection 'event' from AN92584 which I have attached (if you are having trouble viewing the jpg, treat yourself and install Picassa Photo Viewer, it zooms with scroll wheel and drags around screen with left drag).

   

I only need less than 300us of Active mode to piggyback on.

   

I have tried starting BLE_bless_isr and even with a CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP) in the CY_ISR(BLE_bless_isr_Interrupt), the sytem never goes to DEEP SLEEP and connections actually stop working after the isr is started.

   

Does anyone see the advantages of being able to do what I envision as I do?

0 Likes
Anonymous
Not applicable

Darn, I thought I had a way.

   

I thought I could just use the event in my BLE eventhandler where values are received from the GATT client (CYBLE_EVT_GATTS_WRITE_REQ), but that only executes when the data ACTUALLY CHANGES.  If the data does not change there is still a connection event every connection interval.  I tried all 7 GATTS events and non of them seem to execute every interval.

   

If I keep rambling I am hoping someone takes pity on me 🙂

0 Likes
Anonymous
Not applicable

I found that the BLE subsystem wakes the device from deep sleep at least 4 times per connection/advertising event.

   

The solution was to isolate the first wakeup using CySysClkEcoReadStatus.

0 Likes
ShCh_1406391
Level 1
Level 1

Could you tell me what happens when you and try and debug the code?

   

Shalin

0 Likes