Sleep Configuration for DA14583

Learn MoreFAQsTutorials

9 posts / 0 new
Last post
Utkarash
Offline
Last seen:3 months 6 days ago
Joined:2019-01-18 06:36
Sleep Configuration for DA14583

Hello All,

I am using Dialog's DA14583 based Dev Kit with a I2C based capacitive proximity sensor with touch key.

My main application is to sense the proximity change (i.e., Touch detected) and based on this share few data bytes by updating advertising packet, this advertising packet is collected by the other device.

This sensor has below mentioned properties
- It has an extra Data interrupt pin apart from basic I2C communication pins on sensor side which ideally remains HIGH.
- The sensor pulls the Data interrupt pin LOW whenever the data is ready and is about to send it over the respective I2C pin to the MCU.

I have connected this Data interrupt pin of sensor to my MCU GPIO pin which is configured to give an interrupt whenever this pin goes LOW.

I have programmed the sensor in such a way that whenever there a proxomity change (i.e., Touch detected) the sensor will pull the Data interrupt pin LOW and then MCU can initiate the Read operation. Also i have programmed the sensor in low power mode so that it consumes less power.

在我的应用程序数据中断销对人类行动ment detection will interrupt the MCU and based on read sensor values i will update data in advertising packets.

This Logic works properly in Active Mode, However my device would be battery operated i want to implement Extended Sleep Mode in this device.

For Sleep Mode i have refered "ble_app_sleep_mode" and "proxy_reporter" example code's and made respective changes in code
- In user_config.h file

app_default_sleep_mode = ARCH_EXT_SLEEP_ON

- For Wakeup

arch_disable_sleep(); if (GetBits16(SYS_STAT_REG, PER_IS_DOWN)) { periph_init(); } if (arch_ble_ext_wakeup_get()) { arch_set_sleep_mode(app_default_sleep_mode); arch_ble_force_wakeup(); arch_ble_ext_wakeup_off(); app_easy_wakeup(); }

- For activating Sleep

arch_set_sleep_mode(ARCH_EXT_SLEEP_ON);

For Longer battery life i have changed application as follows,
- First i do the respective sensor configuration and MCU configurations and after that i send the MCU in sleep mode.
- Using the Data interrupt pin i wake the device and then check the sensor data and perform respective operation of updating advertising packet.
- After that i send the device in sleep mode again wait for next interrupt.

Now when i incorparate sleep mode i am not able to get proper response from device, whole logic fails, where i am not able to get proper interuupts or proper data
As a result i also tried few below mentioned changes in the wakeup logic

arch_disable_sleep(); if (GetBits16(SYS_STAT_REG, PER_IS_DOWN)) { periph_init(); } if (arch_ble_ext_wakeup_get()) { arch_set_sleep_mode(app_default_sleep_mode); arch_ble_force_wakeup(); arch_ble_ext_wakeup_off(); app_easy_wakeup(); } i2c_init();

My question is that whether sleep aftects I2C data communication, If yes how can i fix it ?

And is there any minimum specific sleep time for MCU, That is if i get succesive 4 to 5 interrupts every 30 secs will sleep mode work properly.

Please help me with this at the earliest

Thanks and Regards

Device:
PM_Dialog
Offline
Last seen:1 day 21 hours ago
Staff
Joined:2018-02-08 11:03
Hi Utkarash,

Hi Utkarash,

Yes, the sleep mode has an effect on the I2C communication. When the device is in any of sleep modes, all the peripheral domains (SPI. I2C, UART etc. ) are powered down. This means that when the device is in extended sleep mode, it is not possible to have any I2C activity. Additionally, keep in mind that if the devices configured in sleep mode, then it will go into sleep mode between advertising and connection intervals.

Could you please let us if there is an specific reason for using DA14583? Do you have any specific requirement?

If you are starting a new design / project, we would strongly recommend to start with DA14531 or DA14585/586 products and our latest SDK6.0.14, as it is much more improved. We have a lot of code examples and improved documentation, and there is also software roadmap support. There is no software roadmap support for DA14580 product family and SDK5.

Please check out DA14531:

//www.wsdof.com/products/connectivity/bluetooth-low-energy/products/da14531

We also have a DA14531 module, namely DA14531 SmartBond TINY™ Module! It has very small dimensions and is very low power. Follow the link below to find datasheet, documentation and HW collaterals for the module:

//www.wsdof.com/products/bluetooth-module-da14531-smartbond-tiny

There also reference designs that you will help you to reduce the developing stage, as you don’t need to spend so much time in developing your application code.

CodeLes

The CodeLess allows you to quickly get started with wireless IoT applications with a set of AT Commands. The CodeLess AT commands platform allows control over a local UART connected device as well as a remote device via BLE. You can create simple demos / applications / proof of concepts without any code development or build you own application on top!

//www.wsdof.com/products/smartbond-codeless-commands

Dialog Serial Port Service (DSPS)

The DSPS emulates a serial cable communication. It provides a simple substitute for RS-232 connections, including the familiar software flow control logic via Bluetooth low energy. The SPS software distribution includes the application and profile source codes and supports GAP Central/Peripheral roles.

//www.wsdof.com/products/dialog-serial-port-service-dsps

For DA14531, you there is a completed SW examples for reading an I2C interface and sending the values via BLE notification to a peer device. You can take it as a reference!

DA14531-DA14585-586 Reading I2C Accelerometer BLE

Thanks. PM_Dialog

Utkarash
Offline
Last seen:3 months 6 days ago
Joined:2019-01-18 06:36
Thank you for your reply and

Thank you for your reply and suggestions,

Sorry but due few contrains i will not be able to change the Dialog MCU or SDK at this state,

In next version of the device i will defiently refere you suggestions of new MCU and SDK,

However i request you to please help with sleep configuration with curennt version of SDK and MCU.

I had shared the code snipet i refered for sleep configurations so can you please check them and let me known whether i am correct?

Also after refereing ble_app_sleep_mode example i made sleep configuration of extended sleep mode keeping DA14583 limitations in mind.

I obsereved the follwing behaviour. -

Once i flash the code and repower it the device is advertising and after few mins if i again repower it the device stopped advertising.

So can you please help with this that why did the device stop advertising is there anything on which i am missing out?

Please help at the earliest

Thanks and regards

Utkarash

PM_Dialog
Offline
Last seen:1 day 21 hours ago
Staff
Joined:2018-02-08 11:03
Hi Utkarash,

Hi Utkarash,

Are you booting from SPI Flash or System-RAM? Can you please run it in debug mode and check if it gets stauck (NMI, WDG, assertion etc. )?

I would like to highlight again, that when the device is in SLEEP mode, it is NOT POSSIBLE to have any I2C activity.

Thanks, PM_Dialog

Utkarash
Offline
Last seen:3 months 6 days ago
Joined:2019-01-18 06:36

Thank you for your reply and suggestions,

Are you booting from SPI Flash or System-RAM?-- I am booting using SPI Flash, I use the hex file generated after build process and using smart snippet tool i dump the file into my board.

Can you please run it in debug mode and check if it gets stauck (NMI, WDG, assertion etc. )?-- The code now doesnt get stuck in NMI or WDG and the issue of advertising which i mentioned eralier is resolved.

I would like to highlight again, that when the device is in SLEEP mode, it is NOT POSSIBLE to have any I2C activity.——我完全明白I2C并不在extended sleep. However when i wake up the device from sleep at least then the I2C should work. Also in reference to this i am asking whether my sleep configuration which i have made are correct? i.e.,

As explained earlier,

For Sleep Mode i have refered "ble_app_sleep_mode" and "proxy_reporter" example code's and made respective changes in code
- In user_config.h file

app_default_sleep_mode = ARCH_EXT_SLEEP_ON

- For Wakeup

arch_disable_sleep(); if (GetBits16(SYS_STAT_REG, PER_IS_DOWN)) { periph_init(); } if (arch_ble_ext_wakeup_get()) { arch_set_sleep_mode(app_default_sleep_mode); arch_ble_force_wakeup(); arch_ble_ext_wakeup_off(); app_easy_wakeup(); }

- For activating Sleep

arch_set_sleep_mode(ARCH_EXT_SLEEP_ON);

Now Please check these statements and let me know if i am using correct code for sending device in sleep and for waking it up?

Waiting for your response.

Thanks and Regards

Utkarsh

PM_Dialog
Offline
Last seen:1 day 21 hours ago
Staff
Joined:2018-02-08 11:03
Hi Utkarsh,

Hi Utkarsh,

It seems correct – do you want to stop advertising and put the device into permanent sleep mode?

What is the power consumption you are measuring with this implementation?

Please also check the sleep mode tutorial for DA14580 – link is provided below:

//www.wsdof.com/sites/default/files/training_04_sleep_mode_configurations.pdf

Thanks, PM_Dialog

Utkarash
Offline
Last seen:3 months 6 days ago
Joined:2019-01-18 06:36
Thank you for your reply and

Thank you for your reply and suggestions,

do you want to stop advertising and put the device into permanent sleep mode?-- No i dont want to stop advertising and also do not want to put device in permanent sleep. Please check mentioned below points to understanmd where my device should go in sleep and when should it wake up?

- I wakeup the device when there is an interrupt from sensor update the advertising packets and after 5 secs again go to sleep and wait untill next interrupt is received from sensor.

This is how i need the sleep to work, if you need to understand regarding the sensor and my application please refere my initial post.

What is the power consumption you are measuring with this implementation? --我断开连接的传感器和测量只有MCU current which i am getting in the range of 50 to 150 MicroAmps(current varies in this range), which is not ideal for my case i want a current which shoud not exceed more then 50MicroAmps for only MCU . As after connecting my sensor it will again Increase.Also while measuring current i refered the same tutorial suggested by you.

Please also check the sleep mode tutorial for DA14580 – link is provided below: --I have refered this tutorial itself and implemented my sleep logic which i have shared with you also.

Apart from this i have one more question that while implementing sleep i went through few post and i found the below mention comment by Dialog.

"Additionally, since it is DA14583, if the flash is NOW powered down, then the consumption will increased again.
There is a function in order to place the SPI in power down mode - spi_flash_power_down() - and in that case you won’t be able to interact with the flash unless you instruct the SPI flash to be powered up. Before starting to interact with the flash, you should invoke spi_flash_release_from_power_down()."

Now in my case also i am using DA14583 so should i bother about this?

If Yes,then with reference to this comment i have made these changes in my code Please check if it is correct?

  • Before sending device into sleep mode i call spi_flash_power_down, for example,
spi_flash_power_down(); arch_set_sleep_mode(ARCH_EXT_SLEEP_ON);
  • And while waking the device up i again relaese the spi_power_down mode, for example,
arch_disable_sleep(); spi_flash_release_from_power_down(); if (GetBits16(SYS_STAT_REG, PER_IS_DOWN)) { periph_init(); } if (arch_ble_ext_wakeup_get()) { arch_set_sleep_mode(app_default_sleep_mode); arch_ble_force_wakeup(); arch_ble_ext_wakeup_off(); app_easy_wakeup(); }

If No, then should ignore this comment in my case?

Please help at the earliest.

Thanks and regrads

Utkarash

PM_Dialog
Offline
Last seen:1 day 21 hours ago
Staff
Joined:2018-02-08 11:03
Hi Utkarsh,

Hi Utkarsh,

You can use the - spi_flash_power_down() – in DA14583 as well, so that you can power down the flash. This will reduce the current consumption in sleep mode. Then, when the chip wakes up, you should call -da14583_spi_flash_release() – to release the flash from power down mode.

>>>Before sending device into sleep mode i call spi_flash_power_down, for example,

I don’t see anything work - you are calling the correct APIs.

>>>And while waking the device up i again relaese the spi_power_down mode, for example,

Please try to use da14583_spi_flash_release() instead of spi_flash_release_from_power_down().

Thanks, PM_Dialog

Utkarash
Offline
Last seen:3 months 6 days ago
Joined:2019-01-18 06:36
Thank you for your reply and

Thank you for your reply and suggestions,

Please try to use da14583_spi_flash_release() instead of spi_flash_release_from_power_down().--Thank you for your suggestion, i will make the respective changes.

Thanks and regards