⚠️
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
最后一次露面:3天8小时前
加入:2018-11-30 15:58
I2C在BLE广告期间

Hi,

We would like to read a sensor over i2c periodically, preferably when the da14585 wakes up to do the BLE advertising.
要读取传感器,我们必须首先通过驱动引脚唤醒传感器,等待〜1ms,然后通过I2C读取8字节的数据。
此序列本身工作,但是当我尝试在回调user_app_main_loop_callbacks.app_on_system_powered或user_app_main_loop_callbacks.app_before_sleep中时,我会以某种方式卡住。

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

void init_acc_i2c(void)
{
SetBits16(CLK_PER_REG, I2C_ENABLE, 1); // enable clock for I2C
SetWord16(I2C_ENABLE_REG, 0x0); // Disable the I2C controller
setword16(i2c_con_reg,0x0063);// 12c主站,7bit从地址,100kbit
SetWord16(I2C_TAR_REG,ACCELEROMETER_I2C_ADDR);

setword16(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)
{
INT I;
UINT8_T数据[8];
gpio_setactive(Accelerometer_Enable_port,Accelerometer_Enable_pin);
systick_wait(1000);
global_int_disable();
setword16(i2c_data_cmd_reg,0x00);
for(i=0;i<7;i++)
{
等待_while_i2c_fifo_is_full();
setword16(i2c_data_cmd_reg,0x0100);
}
global_int_restore();

for(i=0;i<7;i++)
{
WAIT_FOR_RECEIVED_BYTE(); // Wait for received data
数据[i] =(0xff&getword16(i2c_data_cmd_reg));//获取收到的字节
}

gpio_setinactive(Accelerometer_Enable_port,Accelerometer_Enable_pin);
wait_until_i2c_fifo_is_empty();//等到TX FIFO是空的
wait_until_no_master_actity();//等到没有主活动

}

有可能使用任何回调的疼痛吗ive this?

Best regards
马丁

设备:
PM_DIALOG.
Offline
最后一次露面:3 days 43 min ago
Staff
加入:2018-02-08 11:03
Hi mapart,

Hi mapart,

如果定期读取传感器,您可以使用app_easy_timer()API。每次计时器到期时,都会触发注册的回调,因此您需要注册读取传感器的回调。在每次DA1458每次读取传感器的情况下,您可以分享更多细节吗?该设备在Adverting或连接间隔之间进入睡眠模式。您是否配置了进入深度睡眠模式,因为它在SDK的BLE_APP_SLEEPMODE示例中展示了它?

谢谢,PM_DIALOG.

mapart
Offline
最后一次露面:3天8小时前
加入:2018-11-30 15:58
Hi,

Hi,

提供一些上下文:
SDK version, 6.0.10.511.
我们已经将BLE_APP_SECURITY作为此项目中的基础,但配置为使用扩展睡眠模式。这使得设备在广告之间进入睡眠。
理想情况下,我们希望每次DA14585醒来做广告时都阅读这个传感器。
If we would use the app_easy_timer(), the device would wake up from sleep just to do the sensor reading, correct?
The best for us would be to do the sensor reading when the device is already awake.

Best regards
马丁

PM_DIALOG.
Offline
最后一次露面:3 days 43 min ago
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.

谢谢,PM_DIALOG.

mapart
Offline
最后一次露面:3天8小时前
加入: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_DIALOG.
Offline
最后一次露面:3 days 43 min ago
Staff
加入:2018-02-08 11:03
Hi mapart,

Hi mapart,

很高兴你想到了你发出问题,谢谢你接受答案。

谢谢,PM_DIALOG.

rajucoolsuraj
Offline
最后一次露面:7个月1周前
加入: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仍处于广告模式 -

记录时间戳;记录传感器数据;在闪存中存储传感器数据;

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

Can you help me out with code insertion and handling for -
1. RTC中断处理(主动和睡眠状态)
2 . BLE transmission using DSPS from Dialog.

Thanks

PM_DIALOG.
Offline
最后一次露面:3 days 43 min ago
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-seminile.com/system/files/resources/um-b-038%20da14580%20serial%20port%20service%20reference%20application_v2.0.pdf.

谢谢,PM_DIALOG.

rajucoolsuraj
Offline
最后一次露面:7个月1周前
加入:2018-12-12 16:09
谢谢对话框,

谢谢对话框,

我想评估并张贴在这里。

I have also raised another post on I2C controller interface with sensor.

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

Can I get an assistance on that?

Thanks

Raju

霍尼韦尔

PM_DIALOG.
Offline
最后一次露面:3 days 43 min ago
Staff
加入:2018-02-08 11:03
Hi rajucoolsuraj,
rajucoolsuraj
Offline
最后一次露面:7个月1周前
加入:2018-12-12 16:09
谢谢对话框,

谢谢对话框,
但是,当我想要GPIO IRQ时,没有睡眠模式。

我应该在与对等方连接之前处理中断;当Periph是广告?

谢谢

Raju

PM_DIALOG.
Offline
最后一次露面:3 days 43 min ago
Staff
加入:2018-02-08 11:03
Hi rajucoolsuraj,

Hi rajucoolsuraj,

您可以在初始化(.app_on_init)或user_app_adv_start中启用IRQ。但请注意,您必须不使用任何睡眠模式以检测中断。如果您想拥有任何睡眠模式配置,则应使用唤醒控制器。

谢谢,PM_DIALOG.

rajucoolsuraj
Offline
最后一次露面:7个月1周前
加入:2018-12-12 16:09
谢谢对话框,

谢谢对话框,

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

如果有任何错误的遭遇可能会通过GPIO使用Wakeup Irq,我想知道它

谢谢

PM_DIALOG.
Offline
最后一次露面:3 days 43 min ago
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.

谢谢,PM_DIALOG.

rajucoolsuraj
Offline
最后一次露面:7个月1周前
加入:2018-12-12 16:09
Hello Dialog,

Hello Dialog,
唤醒控制器使用时在Custom Message处理程序中使用按钮回调是最佳的useCase示例。

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

Thanks

PM_DIALOG.
Offline
最后一次露面:3 days 43 min ago
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.

谢谢,PM_DIALOG.

rajucoolsuraj
Offline
最后一次露面:7个月1周前
加入:2018-12-12 16:09
Hello Dialog,

Hello Dialog,

我使用Wakeup Controller回调注册注册了多个回调,如何从几个GPIO服务中的中断?

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

Thanks

Regards

Raju

PM_DIALOG.
Offline
最后一次露面:3 days 43 min ago
Staff
加入:2018-02-08 11:03
Hi rajucoolsuraj,

Hi rajucoolsuraj,

你能澄清你所做的一切吗?如果我能够正确理解,您将固件配置为从不同的GPIO唤醒?如果是,则首先将唤醒您的芯片。

谢谢,PM_DIALOG.

rajucoolsuraj
Offline
最后一次露面:7个月1周前
加入:2018-12-12 16:09
Hello Dialog,

Hello Dialog,
Thanks.

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

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

Thanks

Raju

PM_DIALOG.
Offline
最后一次露面:3 days 43 min ago
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

Thanks, PM_DIalog

rajucoolsuraj
Offline
最后一次露面:7个月1周前
加入:2018-12-12 16:09
Hello Dialog,

Hello Dialog,

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

Also, I have raised another concern on that thread.

Regards

Raju

PM_DIALOG.
Offline
最后一次露面:3 days 43 min ago
Staff
加入:2018-02-08 11:03
Hi rajucoolsuraj,

Hi rajucoolsuraj,

没问题!让我们继续在您的其他论坛线程中进行对话。

谢谢,PM_DIALOG.