⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
22个职位/0个新职位
Last post
mapart
Offline
最后一次见到:1 month 3 weeks ago
加入:2018-11-30 15:58
I2C广告

Hi,

我们希望定期读取传感器,优选地,当DA14585唤醒以进行BLE广告时。
要读取传感器,我们必须首先通过驱动一个高引脚唤醒传感器,等待~1ms,然后通过i2c读取8字节的数据。
这个序列本身就可以工作,但当我尝试在回调user\u app\u main\u loop\u callbacks.app\u on\u system\u powered或user\u app\u main\u loop\u callbacks.app\u sleep之前执行时,我不知怎么就卡住了。

从periph_init调用的初始化i2c的序列:

void init\u acc\u i2c(无效)
{
SetBits16(CLK_PER_REG, I2C_ENABLE, 1); // enable clock for I2C
SetWord16(I2C_ENABLE_REG, 0x0); // Disable the I2C controller
设置字16(I2C\ CON\ REG,0x0063)//12c主机,7位从机地址,100kbit
setword16(i2c_tar_reg,Accelerometer_i2c_addr);

设置字16(I2C_ENABLE_REG,0x1);//启用I2C控制器
}

The code to read the sensor data, which I try to call from the callback described above:

void read_sensor_sequentially(void)
{
国际一级;
uint8数据[8];
GPIO\ U SetActive(加速计\ U ENABLE\端口、加速计\ U ENABLE\引脚);
systick_wait(1000);
全局\u INT \u DISABLE();
设置字16(I2C\数据\命令\注册表,0x00);
for(i=0;i<7;i++)
{
请稍候,I2C FIFO已满();
设置字16(I2C\数据\命令\寄存器,0x0100);
}
全局\u INT \u RESTORE();

for(i=0;i<7;i++)
{
wait_for_received_byte();//等待收到的数据
数据[i]=(0xFF&GetWord16(I2C_data_CMD_REG));//获取接收到的字节
}

GPIO\ U SetInactive(加速计\ U ENABLE\端口、加速计\ U ENABLE\引脚);
等待_I2C _FIFO _为空();//等待Tx FIFO为空
等待_,直到_NO _MASTER _ACTIVITY();//等到没有主活动

}

是否有可能使用任何回调来实现这一点?

Best regards
马丁

设备:
PM\U对话框
Offline
最后一次见到:1天3小时前
Staff
加入:2018-02-08 11:03
Hi mapart,

Hi mapart,

如果定期读取传感器,可以使用app\u easy\u timer()API。每次计时器过期时,都会触发已注册的回调,因此需要注册正在读取传感器的回调。如果每次读到DA1458的传感器,你能分享更多的细节吗?设备在播发或连接间隔之间进入休眠模式。您是否将其配置为进入深度睡眠模式,如SDK的ble\u app\u sleepmode示例所示?

谢谢,下午好

mapart
Offline
最后一次见到:1 month 3 weeks ago
加入:2018-11-30 15:58
Hi,

Hi,

提供一些背景:
SDK version, 6.0.10.511.
我们在这个项目中使用ble\u app\u security作为基础,但将其配置为使用扩展睡眠模式。这使得设备在广告之间进入休眠状态。
理想情况下,我们希望每次da14585醒来做广告时都能读取这个传感器。
如果我们将使用app_easy_timer(),那么设备将从睡眠中唤醒,只是为了做传感器读取,正确?
当设备已经醒来时,我们最好的是要做传感器读数。

Best regards
马丁

PM\U对话框
Offline
最后一次见到:1天3小时前
Staff
加入:2018-02-08 11:03
Hi mapart,

Hi mapart,

With the usage of the use the app_easy_timer(), you could implement the periodically reading of the sensor. Your device is initially advertising and while it’s adverting the sensor should be read periodically by the application, After an amount of time, you stop adverting and when the device wakes up by configuring the wake up controller, the application should start reading again the sensor periodically. Is that correct? Or you would like to read the sensor in every advertising interval? Please let me know and share what you exactly want to accomplish. It would be very helpful in order to provide you the correct guidelines.

谢谢,下午好

mapart
Offline
最后一次见到:1 month 3 weeks ago
加入:2018-11-30 15:58
Hi,

Hi,
是的,我想在每个广告间隔(687.5毫秒)读取传感器。
I think I managed to get this working by using the callback:
user_app_main_loop_callbacks.app_on_system_powered

Thank you for your help.
致以最诚挚的问候
马丁

PM\U对话框
Offline
最后一次见到:1天3小时前
Staff
加入:2018-02-08 11:03
Hi mapart,

Hi mapart,

很高兴你解决了问题,谢谢你接受了答案。

谢谢,下午好

Rajucoolsuraj.
Offline
最后一次见到:6个月3周前
加入:2018-12-12 16:09
Hello Dialog,

Hello Dialog,
A similar example with another workflow -
传感器>>i2c>>DA14586。
RTC >> GPIOx / WKUP interrupt >> DA14586

Normal operations of BLE would proceed for advertising as per sample applications provided with SDK.
当从RTC引发中断且BLE仍处于播发模式时-

记录时间戳;记录传感器数据;以flash存储传感器数据;

When BLE is connected to peer -
Disable RTC interrupt; Transfer Flash data over BLE to a Central Device (Ususally smart phone);

你能帮我解决代码插入和处理 -
1.RTC中断处理(活动和休眠状态)
2 . BLE transmission using DSPS from Dialog.

谢谢

PM\U对话框
Offline
最后一次见到:1天3小时前
Staff
加入:2018-02-08 11:03
Hi rajucoolsuraj,

Hi rajucoolsuraj,

If I am able to understand correctly you would like to wake the device up when getting an interrupt correct? So, the device will be in sleep mode and when you get the interrupt from RTC (please clarify what the RTC is) the device will wake up and start advertising. If you would like to follow this implementation, I would suggest you to have a look at the ble_app_sleepmode example of the SDK. The only difference is that in this example the DA14585/6 wakes up from an interrupt which is generated by a button pressing. Are you using the DSPS application code or you have developed a custom application? Please check the user_send_ble_data() from the DSPS application code. Also, I would recommend you to have a look at the DSPS user manual and check figure 6 & 7.

https://support.dialog-semiconductor.com/system/files/resources/UM-B-038%20DA14580%20Serial%20Port%20Service%20reference%20application_v2.0.pdf

谢谢,下午好

Rajucoolsuraj.
Offline
最后一次见到:6个月3周前
加入:2018-12-12 16:09
谢谢对话,

谢谢对话,

我想评估和张贴在这里。

我还在带有传感器的I2C控制器接口上提出了另一个帖子。

It seems that the controller does not send the salve device's register address after transmitting slave device address on SDA wire.

我可以得到帮助吗?

谢谢

raju.

霍尼韦尔

PM\U对话框
Offline
最后一次见到:1天3小时前
Staff
加入:2018-02-08 11:03
Hi rajucoolsuraj,
Rajucoolsuraj.
Offline
最后一次见到:6个月3周前
加入:2018-12-12 16:09
谢谢对话,

谢谢对话,
但是,当我想在没有睡眠模式的情况下启用gpioirq时。

我应该在什么时候处理与peer连接之前的中断;外设什么时候做广告?

谢谢

raju.

PM\U对话框
Offline
最后一次见到:1天3小时前
Staff
加入:2018-02-08 11:03
Hi rajucoolsuraj,

Hi rajucoolsuraj,

您可以在初始化时启用IRQ(.app\u on \u init)或在用户\u app\u adv\u start中启用IRQ。但是请注意,您不必使用任何睡眠模式来检测中断。如果您想要任何睡眠模式配置,您应该使用唤醒控制器。

谢谢,下午好

Rajucoolsuraj.
Offline
最后一次见到:6个月3周前
加入:2018-12-12 16:09
谢谢对话,

谢谢对话,

I shall make use of WakeUp IRQ for both active and sleep modes. It seems better over GPIO.

如果有任何错误的遭遇,可能会导致使用唤醒IRQ通过GPIO,我想知道它

谢谢

PM\U对话框
Offline
最后一次见到:1天3小时前
Staff
加入:2018-02-08 11:03
Hi rajucoolsuraj,

Hi rajucoolsuraj,

I would strongly recommend to have a look at the ble_app_sleepmode example of the SDK in order to understand how to use the wake-up controller.

谢谢,下午好

Rajucoolsuraj.
Offline
最后一次见到:6个月3周前
加入:2018-12-12 16:09
Hello Dialog,

Hello Dialog,
按钮回调的自定义消息处理程序中连接时的唤醒控制器用法是最好的用例示例。

I shall revert back incase of any logical breakdown during implementation.

谢谢

PM\U对话框
Offline
最后一次见到:1天3小时前
Staff
加入:2018-02-08 11:03
Hi rajucoolsuraj,

Hi rajucoolsuraj,

如果你想要任何的睡眠国防部es, the solution is to use the wake-up controller in order to detect the interrupt and wake up. Please check the app_button_enable() function which enables the wake-up controller before the device enters the sleep mode. You can select the GPIO that you could detect the wake-up interrupt with the wkupct_enable_irq() function. You can also configure the polarity and the debouncing time as well. Since the device goes into sleep and you send an interrupt to the wake-up controller, the callback function which is registered into wkupct_register_callback() will be triggered.

谢谢,下午好

Rajucoolsuraj.
Offline
最后一次见到:6个月3周前
加入:2018-12-12 16:09
Hello Dialog,

Hello Dialog,

我已经注册了多个回调使用唤醒控制器回调注册,如何从几个GPIO的中断服务?

它是注册的GPIO中最后一个触发的吗?

谢谢

Regards

raju.

PM\U对话框
Offline
最后一次见到:1天3小时前
Staff
加入:2018-02-08 11:03
Hi rajucoolsuraj,

Hi rajucoolsuraj,

你能澄清一下你做了什么吗?如果我能正确理解,你配置固件从不同的GPIO唤醒?如果是,第一个打开会唤醒你的芯片。

谢谢,下午好

Rajucoolsuraj.
Offline
最后一次见到:6个月3周前
加入:2018-12-12 16:09
Hello Dialog,

Hello Dialog,
谢谢。

Also, How to check for the GPIO pin source that triggered the interrupt via the WakeUp controller ?

SDK中是否有任何寄存器或机制允许我验证中断源?

谢谢

raju.

PM\U对话框
Offline
最后一次见到:1天3小时前
Staff
加入:2018-02-08 11:03
Hi rajucoolsuraj,

Hi rajucoolsuraj,

没有寄存器指示中断发生的端口/管脚,要检查脉冲源,您可以在设备被唤醒后立即读取管脚的状态。因此,根据pin状态,您必须决定将触发哪个回调函数。请尽量不要在论坛上重复你的问题,你已经创建了一个类似的论坛线程,我已经回答你那里:

https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/multiple-code-space-wkupenableirq

谢谢, PM_DIalog

Rajucoolsuraj.
Offline
最后一次见到:6个月3周前
加入:2018-12-12 16:09
Hello Dialog,

Hello Dialog,

Sorry for the duplicates. Yes, thanks for the support.

此外,我对该线程提出了另一个问题。

Regards

raju.

PM\U对话框
Offline
最后一次见到:1天3小时前
Staff
加入:2018-02-08 11:03
Hi rajucoolsuraj,

Hi rajucoolsuraj,

没问题!让我们在您的另一个论坛帖子中继续对话。

谢谢,下午好