⚠️
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.
10 posts / 0 new
Last post
BLEBOT.
Offline
Last seen:1个月6天前
Joined:2017-11-27 16:01
buzzer profile enabling

Hi Dialog,

we are using a custom board with DA14585 and the SDK 6.0.10 . we want to add a buzzer and control it through a service. We have added the service but we want continuous beeps and not a musical note. We saw the timer0_pwm example and implemented by taking it as a reference. we are using the extended sleep mode. Can you please tell me how can i configure it so that i can hear continuous beep sounds ?

设备:
PM_Dialog
Offline
Last seen:1 day 3 hours ago
Staff
Joined:2018-02-08 11:03
Hi blebot,

Hi blebot,

Let me ask you some questions in under to understand deeper which your requirements are and what would you like to accomplish.

  1. You mentioned that you want to control the buzzer through your custom service. Can you please clarify it? Do you want to write a “START” command, start generating a PWM and when writing a “STOP” command, the buzzer should be stopped? So, you would like to generate a continuous beep as soon as you stop it over the air. Is my understanding correct? Unless, please provide me more details on that.
  2. 请在SDK的Timer0_PWM示例中检查Timer0_pwm_test_expiration_counter变量。变量具有值timer0_pwm_test_expiration_counter_reload_value(默认情况下)。当您获取SWTIM_IRQN中断时,将触发PWM0_USER_CALLBACK_FUNCTION,如果检查源代码,则每次回调命中时,TIMER0_PWM_TEST_EXPION_COUDETER会在每次回调时都会减少。当Timer0_pwm_test_expiration_counter转到零时,Timer0将被停止。
  3. 此外,您提到使用扩展睡眠模式,请注意,当设备进入睡眠模式时,所有外围设备块(包括计时器块)断电。

谢谢,PM_Dialog

BLEBOT.
Offline
Last seen:1个月6天前
Joined:2017-11-27 16:01
Hi,

Hi,

谢谢回复。

1. Yes, exactly.

2. In the timer0_pwm example, as you said the timer0_pwm_test_expiration_counter decrements everytime and when it goes to zero the timer_0 will be stopped but i don't want it to stop unless i give the command to stop.i want the buzzer to make continuous beep sounds until i stop. Is there a way to do that ? and also there is a musical note in the example but i don't want to play notes just a simple beep sounds .

3.Can i make the timer block not powered down when the device enters sleep mode? if yes, How ?

谢谢,

Blebot.

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

Hi blebot,

Please check the ble_app_peripheral example of the SDK and focus on user_catch_rest_hndl() callback function which handles the messages that are not handled by the SDK internal mechanisms. Suppose that you have a writable characteristic in order to send the START/STOP command. In the ble_app_peripheral example, when writing to the “Control Point” characteristic, you will get a SVC1_IDX_CONTROL_POINT_VAL and the user_svc1_ctrl_wr_ind_handler() will be fired up which is the control point write indication handler. The “Control Point” characteristic has 1-byte length. The same you should implement for your case: START: 0x01 – STOP: 0x00 for example. The value that is written to the characteristic is stored into ¶m->value[0], so you should copy it to the “val”.

  • If the “val” is equal to START, then you should enable-set-start the timer0 as in timer0_pwm example
  • If the “val” is equal to STOP, then you should stop the timer0 (timer0_stop()).

关于Timer0_PWM示例,正如我之前提到的那样,每次生成中断时,触发PWM0_USER_CALLBACH_FUNCTION()。Notes存储在Notes []数组中。在您案例中,您应该发现哪个是蜂鸣声的适当波形,并相应地修改回调。关于你的最后一个问题,这是不可能的。如果您发现任何答案有用,请将其标记为“已接受”。

谢谢,PM_Dialog

BLEBOT.
Offline
Last seen:1个月6天前
Joined:2017-11-27 16:01
Hi Dialog,

Hi Dialog,

Thanks for the reply . we know how to write and handle a 'control point' characteristic.

Is there a way we can workout the functionality in sleep mode ?

谢谢,

Blebot

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

Hi blebot,

As it is already mentioned, as soon as the device goes into sleep, all the peripheral blocks are powered down.

谢谢,PM_Dialog

BLEBOT.
Offline
Last seen:1个月6天前
Joined:2017-11-27 16:01
Hi,

Hi,

Thanks . Can i make the buzzer sound whenever the device gets out of sleep and and shut it off when the device enters sleep mode ?

问候,

BLEBOT..

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

Hi blebot,

通常,该设备在广告和连接间隔之间进入睡眠。在睡眠前的销的状态,保留但不是PIN的配置或功能。当设备唤醒即将调用PeripH_Init()函数时,以便在每个唤醒中重新配置引脚,引脚返回其默认应用程序状态。因此,如果任何GPIO在睡眠前高,它会在睡眠期间保持高,并且将通过PERIPH_INIT()函数唤醒重新配置。您是否希望在SDK的BLE_APP_SLEEPMODE示例中实现永久睡眠?

谢谢,PM_Dialog

BLEBOT.
Offline
Last seen:1个月6天前
Joined:2017-11-27 16:01
Hi,

Hi,

Yes , we are using permanent sleep as implemented in the ble_app_sleepmode example but not copying from OTP. We just want to make the buzzer sound everytime the device wakes up .

谢谢,Blebot。

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

Hi blebot,

好吧,让我描述你可能的实现。请检查SDK的BLE_APP_SLEEPMODE示例。

  • 该设备进入扩展睡眠模式,在广告和连接间隔之间使用OTP复制。请注意是opt副本的模拟,因为cfg_development_debug在da1458x_config_basic.h中定义。请在主人文件中查看此宏并阅读注释以获取更多信息。
  • The chip starts advertising until the timer times out after a predefined amount of time which is APP_ADV_DATA_UPDATE_TO seconds and the adv_data_update_timer_cb() callback is triggered.
  • In this callback the app_easy_gap_advertise_stop() is called, which sends a GAPM_CANCEL_CMD towards the Stack
  • When the messages is sent, the user_app_adv_undirect_complete() is triggered. So, in this callback you could STOP the PWM – the device goes into sleep.
  • Only an external can wake up the device.
  • As soon as the a button is pressed, the app_wakeup_cb() will be triggered and the advertising will restart. So, you could START the PWM inside the app_wakeup_cb()

这是一个可能的实现。如果您发现它有用,请将答案标记为“已接受”

谢谢,PM_Dialog