大家好,
我使用的是Dialog的基于DA14583的开发套件,带有基于I2C的电容式接近传感器和触摸键。
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.
-当数据准备就绪并即将通过相应的I2C引脚发送到MCU时,传感器将数据中断引脚拉低。
我已将传感器的数据中断引脚连接到我的MCU GPIO引脚,该引脚被配置为每当该引脚变为低电平时都会给出中断。
我对传感器进行了编程,这样每当出现proxomity变化(即检测到触摸)时,传感器就会将数据中断引脚拉低,然后MCU就可以启动读取操作。此外,我已经在低功耗模式下编程的传感器,使它消耗更少的权力。
在我的应用程序数据中断销对人类行动ment detection will interrupt the MCU and based on read sensor values i will update data in advertising packets.
此逻辑在活动模式下正常工作,但是我的设备将由电池供电。我想在此设备中实现扩展睡眠模式。
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(); }
-激活睡眠
arch\设置\睡眠\模式(arch\ EXT\睡眠\开启);
为了延长电池寿命,我改变了应用程序如下:,
-首先,我做相应的传感器配置和MCU配置,然后我在睡眠模式下发送MCU。
- 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.
现在,当我进入睡眠模式时,我无法从设备获得正确的响应,整个逻辑失败,我无法获得正确的接口或正确的数据
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();
我的问题是,睡眠后是否影响I2C数据通信,如果是,我如何修复它?
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.
请尽早帮助我
感谢致敬
你好,乌特卡拉什,
是的,睡眠模式对I2C通信具有效果。当设备处于任何睡眠模式时,所有外围域(SPI。I2C,UART等)断电。这意味着当设备处于扩展睡眠模式时,不可能具有任何I2C活动。此外,请记住,如果在睡眠模式下配置的设备,则将在广告和连接间隔之间进入睡眠模式。
您能告诉我们使用DA14583的具体原因吗?你有什么特别的要求吗?
如果您要开始一个新的设计/项目,我们强烈建议您从DA14531或DA14585/586产品和我们最新的SDK6.0.14开始雷电竞官网登录,因为它有了很大的改进。我们有很多代码示例和改进的文档,还有软件路线图支持。T型这里没有DA14580产品系列和SDK5的软件路线图支持。
请查看DA14531:
//www.wsdof.com/雷电竞官网登录products/connectivity/bluetooth-low-energy/products/da14531
我们还有一个DA14531模块,即DA14531 SmartBond TINY™ 模块!它有非常小的尺寸和非常低的功率。请按以下链接查找本模块的数据表、文档和硬件资料:
//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.
科德莱斯
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读取I2C加速度计
Thanks. PM_Dialog
感谢您的回复和建议,
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
乌特卡拉什
你好,乌特卡拉什,
您是否从SPI Flash或System-RAM启动?你能在调试模式下运行它并检查它是否得到了stauck(NMI,WDG,assertion等等)吗?
I would like to highlight again, that when the device is in SLEEP mode, it is NOT POSSIBLE to have any I2C activity.
谢谢,下午好
感谢您的回复和建议,
您是否从SPI Flash或System-RAM启动?- 我正在使用spi flash启动,我使用构建过程后生成的十六进制文件,并使用智能播链工具,将文件转化为我的电路板。
你能在调试模式下运行它并检查它是否得到了stauck(NMI,WDG,assertion等等)吗?-- 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在长时间睡眠中不起作用。不过,当我从睡眠中唤醒设备时,I2C至少应该可以工作。同样关于这一点,我在问我的睡眠配置,我已经作出的是正确的?即。,
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文件中
- For Wakeup
-激活睡眠
现在请检查这些陈述,如果我使用正确的代码,请告诉我是否使用正确的代码在睡眠中发送设备并唤醒它?
Waiting for your response.
感谢致敬
乌特卡什
嗨,乌特卡什,
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.wsdof.com/sites/default/files/training\u 04\u sleep\u mode\u configurations.pdf
谢谢,下午好
感谢您的回复和建议,
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?
-我唤醒设备时,有一个中断,从传感器更新广告包,并在5秒后再次进入睡眠状态,等待直到下一个中断是从传感器收到。
这就是我如何需要睡眠工作,如果您需要了解传感器和我的申请,请参与我的初始帖子。
使用此实现测量的功耗是多少?--我已经断开了我的传感器,并仅测量了我在50到150微安的范围内(电流在此范围内变化的MCU电流),这对于我的情况不理想,我希望仅作为50微米的电流而不是超过50米浪费MCU。如在连接我的传感器后,它会再次增加。在测量当前时,我将推荐给您建议的相同教程。
Please also check the sleep mode tutorial for DA14580 – link is provided below: --我已经参考了这个教程本身,并实现了我的睡眠逻辑,我也与大家分享。
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.
“此外,由于它是DA14583,如果现在关闭闪存,那么消耗量将再次增加。
有一个函数可以将SPI置于掉电模式—SPI\ U flash\ U power\ U down()—在这种情况下,除非您指示SPI闪存通电,否则您将无法与闪存交互。在开始与flash交互之前,您应该调用spi\u flash\u release\u from\u power\u down()。“
现在在我的情况下也是我使用DA14583所以我应该打扰这个吗?
如是,那么关于这个评论,我已经在我的代码中做了这些更改,请检查它是否正确?
如果没有,那么在我的情况下应该忽略这个评论吗?
请尽早帮忙。
谢谢,谢谢
乌特卡拉什
嗨,乌特卡什,
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,例如,
我看什么都没用-你调用的是正确的API。
>>>在唤醒设备的同时,我再次重新设置spi\u power\u down模式,例如,
Please try to use da14583_spi_flash_release() instead of spi_flash_release_from_power_down().
谢谢,下午好
感谢您的回复和建议,
请尝试使用da14583\u spi\u flash\u release()而不是spi\u flash\u release\u from\u power\u down()--谢谢你的建议,我会做相应的修改。
Thanks and regards