Learn MoreFAQsTutorials

9个帖子/ 0新
Last post
Utkarash
Offline
Last seen:6 months 2 weeks ago
Joined:2019-01-18 06:36
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.

我已将传感器的数据中断引脚连接到我的MCU GPIO引脚,该引脚被配置为每当该引脚变为低电平时都会给出中断。

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
- 在user_config.h文件中

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.

请尽早帮助我

Thanks and Regards

Device:
PM_Dialog
Offline
Last seen:37 min ago
Staff
Joined:2018-02-08 11:03
Hi Utkarash,

Hi Utkarash,

是的,睡眠模式对I2C通信具有效果。当设备处于任何睡眠模式时,所有外围域(SPI。I2C,UART等)断电。这意味着当设备处于扩展睡眠模式时,不可能具有任何I2C活动。此外,请记住,如果在睡眠模式下配置的设备,则将在广告和连接间隔之间进入睡眠模式。

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.

请查看DA14531:

//www.xmece.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.xmece.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.xmece.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.xmece.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:6 months 2 weeks ago
Joined:2019-01-18 06:36
Thank you for your reply and

感谢您的回复和建议,

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

在设备的下一个版本中,我将贴重地裁判新MCU和SDK的建议,

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

我已经分享了我推荐的代码Snipet,所以请你检查一下,让我知道我是否正确?

此外还在裁判BLE_APP_SLEEP_MODE示例后,我做出了延长睡眠模式的睡眠配置,请记住DA14583限制。

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?

请尽早帮助

Thanks and regards

Utkarash

PM_Dialog
Offline
Last seen:37 min ago
Staff
Joined:2018-02-08 11:03
Hi Utkarash,

Hi Utkarash,

您是否从SPI Flash或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:6 months 2 weeks ago
Joined:2019-01-18 06:36

感谢您的回复和建议,

您是否从SPI Flash或System-RAM启动?- 我正在使用spi flash启动,我使用构建过程后生成的十六进制文件,并使用智能播链工具,将文件转化为我的电路板。

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
- 在user_config.h文件中

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);

现在请检查这些陈述,如果我使用正确的代码,请告诉我是否使用正确的代码在睡眠中发送设备并唤醒它?

Waiting for your response.

Thanks and Regards

Utkarsh

PM_Dialog
Offline
Last seen:37 min 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?

使用此实施测量的功耗是多少?

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

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

Thanks, PM_Dialog

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

感谢您的回复和建议,

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.

这就是我如何需要睡眠工作,如果您需要了解传感器和我的申请,请参与我的初始帖子。

使用此实施测量的功耗是多少?--我已经断开了我的传感器,并仅测量了我在50到150微安的范围内(电流在此范围内变化的MCU电流),这对于我的情况不理想,我希望仅作为50微米的电流而不是超过50米浪费MCU。如在连接我的传感器后,它会再次增加。在测量当前时,我将推荐给您建议的相同教程。

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()."

现在在我的情况下也是我使用DA14583所以我应该打扰这个吗?

如是,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);
  • 同时唤醒设备,再次重新安置SPI_POWER_DOWN模式,例如,
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?

请尽早帮助.

Thanks and regrads

Utkarash

PM_Dialog
Offline
Last seen:37 min 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.

>>>在将设备发送到睡眠模式之前,我调用spi_flash_power_down,例如,

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:6 months 2 weeks ago
Joined:2019-01-18 06:36
Thank you for your reply and

感谢您的回复和建议,

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