Hello Support Team,
I am currently working with the Murata type ZY module using a DA14580 with SDK 5.0.3. I am working with the barebones example project supplied with the SDK and would like to configure my application to Boot into extended sleep until an interrupt is received from the GPIO (no broadcasting). Once the interrupt is received I would like to have the application start as it normally would, advertising updated manufacturer supplied data. I'm a bit confused on how to implement this in the context of the user space. Any suggestions on where to start or how to approach this would be appreciated. Thanks.
Device:
Hi Dave,
你可以看看智能标记引用design at the app_button_press() function in order to wake up your device while sleeping mode and then start advertising. Also in the same reference design you can have a look in the app_adv_timer_handler at the end of the function to check how you can put the device in permanent sleep. It may be on a different SDK but the api isn't that different on the new SDK. Please check the docs UM-B-050 and UM-B-51.
Thanks MT_dialog
I've been running through some code and have a couple of questions and would like to clarify a few concepts.
1) working off of the barebones example provided with SDK 5, when I edit user_config.h : app_default_sleep_mode=ARCH_EXT_SLEEP_ON; the chip goes into extended sleep mode when not advertising. In the main loop the processor waits for an interrupt to wake up, is this correct? Where is this interrupt coming from that allows it wake up and advertise again?
2)如果我禁用广告将processor remain in sleep until I generate an interrupt ?
3) Referring to page 45, Figure 26 of UM-B-050, Where in the code flow should I be targeting given what I am trying to do (extended sleep until push button interrupt).
Thanks
Hi Dave,
1- Yes in the main loop the da waits for an interrupt in order to wake up, the interrupts are pre-scheduled BLE events, please advice document UM-B-006 for more details about the sleeping mechanism.
2- If you disable advertising and the da doesn't have to do anything (no BLE interrupts are generated) it will remain in sleep mode, eventually will wake up (by default the da wakes up after a short period of time 10s) and it will fall asleep, if you want to avoid the brief waking up you can issue the app_ble_ext_wakeup_on in order to wake up only by an external interrupt.
3- You can try when your database creation has been completed instead of advertising to set your device in permanent sleep but first you have to configure your wake up button and interrupt.
Thansk MT_dialog
Thank you for the suggestions, if I use the original functionality of the bare bones example project I am now able to put the device to sleep (during the db creation as suggested) and then wake it up with a push button. My goal is to have the function mnf_data_update() read a sensor over the i2c bus. I have had this working previously and it still works when not forcing sleep. However when I try to combine the sleep/wakeup functionality with the i2c sensor reading in mnf_data_update() it stops working.
When the app starts i turn on an led when it goes to sleep. The callback function then turns off the led and restarts advertising, this all works with mnf_data_update() in its original form. When I use my i2c code (using i2c api calls), when I press the button to wake up the da the led stays on, no i2c transactions occur (monitored with scope) and Avg Current shoots up to 0.56 mA (monitored with smart snippets). The peak current is around 1.022 mA, so I don't think it's ever trying to advertise. Is there something I've missed that could be causing this behavior? Thanks.
Hi Dave,
Probably there is an issue with the i2c code or the sensor. Can you see your device advertising with a generic application, if not i suppose that your device is stuck in the i2c transaction. Do you re-configure your i2c and your peripherals when waking up from sleep ?
Thanks MT_dialog
I'll have to check to make sure I am re-configuring the i2c and peripherals. I don't see any advertising from the device when I scan with BLE Scanner (android app). Also, I am monitoring the i2c lines with a scope and a transaction never starts. I am setting a GPIO pin low with my pushbutton callback function but the led never turns off leading me to believe that execution never makes it into that function. I'll report back after looking at the code. Thanks again for the help.
That didn't take long... I added a call to my peripheral initialization function to the pushbutton callback function and now it works as expected. Again thank you for the help, it is greatly appreciated.
Hi,Support Team,
Please let me ask the question about EXT_SLEEP mode every certain time. I need wake up it internally. I already read UM-B-006,but I'm a bit confused on how and where to write code .
In SDK5 code, which example is about it.
Please help me!
Hi wuxin_1019,
Please check your other post.
http://support.dialog-semiconductor.com/extsleep-mode-every-certain-time
Thanks MT_dialog