⚠️
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 month 6 days ago
加入:2017-11-27 16:01
buzzer profile enabling

Hi Dialog,

我们使用一个定制的董事会与DA14585nd 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 ?

Device:
PM_Dialog
Offline
Last seen:1 day 19 hours ago
Staff
加入: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. Please check the timer0_pwm_test_expiration_counter variable in the timer0_pwm example of the SDK. The variable has the value TIMER0_PWM_TEST_EXPIRATION_COUNTER_RELOAD_VALUE (50 by default). When you get a SWTIM_IRQn interrupt, the pwm0_user_callback_function will be triggered, and if you check the source code, the timer0_pwm_test_expiration_counter is getting decreased by on every time the callback hits. When the timer0_pwm_test_expiration_counter goes to zero, the timer0- will be stopped.
  3. Also, you mentioned that you are using extended sleep mode, be aware that when the device enters the sleep mode, all the peripheral blocks, including the timer block, are powered down.

Thanks, PM_Dialog

blebot
Offline
Last seen:1 month 6 days ago
加入:2017-11-27 16:01
Hi,

Hi,

Thanks for the reply.

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 ?

Thanks,

Blebot.

PM_Dialog
Offline
Last seen:1 day 19 hours ago
Staff
加入: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()).

Regarding the timer0_pwm example, as I mentioned before, every time that an interrupt is generated, the pwm0_user_callback_function() is triggered. The notes are stored in the notes[] array. In you case, you should find which is the appropriate waveform for the beep sound and modify the callback accordingly. Regarding your last question, this is not possible. If you found any answer useful, please mark it as “accepted”.

Thanks, PM_Dialog

blebot
Offline
Last seen:1 month 6 days ago
加入: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 ?

Thanks,

Blebot

PM_Dialog
Offline
Last seen:1 day 19 hours ago
Staff
加入: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.

Thanks, PM_Dialog

blebot
Offline
Last seen:1 month 6 days ago
加入: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 ?

Regards,

blebot.

PM_Dialog
Offline
Last seen:1 day 19 hours ago
Staff
加入:2018-02-08 11:03
Hi blebot,

Hi blebot,

Generally, the device goes into sleep between advertising and connection intervals. The state of the pin before going to sleep, is retained but not the configuration or the functionality of the pin. when the device wake's up the periph_init() function is called in order to re-configure the pins in each wakeup and the pins return their default application state. So, if any of the GPIOs is high before going to sleep, it will stay high during sleep, and will be reconfigured in wake up by the periph_init() function. Do you want to go into permanent sleep as implemented in the ble_app_sleepmode example of the SDK?

Thanks, PM_Dialog

blebot
Offline
Last seen:1 month 6 days ago
加入: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 .

Thank you, blebot.

PM_Dialog
Offline
Last seen:1 day 19 hours ago
Staff
加入:2018-02-08 11:03
Hi blebot,

Hi blebot,

Alright, let me describe you a possible implementation about this. Please check the ble_app_sleepmode example of the SDK.

  • The device goes into extended sleep mode with OTP copy between advertising and connection intervals. Be aware the is a simulation of OPT copy, because the CFG_DEVELOPMENT_DEBUG is defined in the da1458x_config_basic.h. Please check this macro in the hearer file and read the comments for more information.
  • 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()

这是一个可能的实现。如果你发现它useful, please mark the answer as “accepted”

Thanks, PM_Dialog