wake on HW interrupt - which example?

Learn MoreFAQsTutorials

6 posts / 0 new
Last post
3hl3rt
Offline
Last seen:1 week 5 days ago
加入:2021-01-23 10:57
wake on HW interrupt - which example?

Hello,

I have to make an extremly simple app:

Device will be at sleep 99.99% of the time, but when a HW button is pressed, it should wake up, wait for the phone to connect, and then send a small payload (4Bytes)

it should return to sleep afterwards, and would also need to make a timeout in case the phone never connects.

but I am unsure which example to start with - I am on eclipse, but basically only the prox_reporter projects runs out of the box - but I would just like some hints here to look.

best regards,

Henrik

Device:
PM_Dialog
Offline
Last seen:13 hours 29 min ago
工作人员
加入:2018-02-08 11:03
Hi 3hl3rt,

Hi 3hl3rt,

谢谢你的问题。

The best project that you can get started with the DA1453a and SDK6 is the prox_reporter example of the SDK.

This the only example that contains an Eclipse based project too. Please see below how you can compile, run and debug it with the SmartSnippets Studio:

https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/wake-hw-interrupt-which-example

When the device boots, it will start advertising. The default sleep mode is set to extended sleep ( see app_default_sleep_mode in user_config.h ) , so this meant that the DA14531 sleeps between the adverting or connection intervals and will wake up automatically via the BLE timer.

在一个预定义的时间(见.advertise_period item in user_default_hnd_conf is user_config.h) , it will stop advertising and go to the permanent sleep mope. The app_advertise_complete() will be triggered once the advertisement has been stopped. Then the device can wakeup via an external interrupt in the WKAE-UP controller – see app_button_enable(). Specifically, the GPIO_BUTTON_PORT / _PIN (P0_11) is configured as a wake up pin with low polarity.

If you are using the Pro-DK, this pin is mapped to SW2, so once the device stops advertising, you can wake it up and start again advertising by pressing the SW2 push button.

When device is advertising, it is connectable, so you could use a BLE generic mobile application to get connected.

I would recommend theGetting Started with SDK6 (HTML)andDA14531 Sleep Mode Tutorial (HTML)tutorials too!

Thanks, PM_Dialog

3hl3rt
Offline
Last seen:1 week 5 days ago
加入:2021-01-23 10:57
thank you so much for this -

thank you so much for this - one question:

after "Please see below how you can compile, run and debug it with the SmartSnippets Studio:" you linked to this forum post - was this suppose to point somewhere else?

PM_Dialog
Offline
Last seen:13 hours 29 min ago
工作人员
加入:2018-02-08 11:03
Hi 3hl3rt,

Hi 3hl3rt,

My apologies – it was a wrong copy-paste. You can find the document below :

http://lpccs-docs.dialog-semiconductor.com/Tutorial_SDK6/eclipse_gcc.html

Thanks, PM_Dialog

3hl3rt
Offline
Last seen:1 week 5 days ago
加入:2021-01-23 10:57
thanks for your answer, I am

thanks for your answer, I am making good progress - the codes complies (prox_reporter), I can change the device name etc, change sleep timing, wake it up on button press etc.

following the DA145xx_Advertising_Tutorial, I am trying to figure out how Advertising data work.

What is the diffrence between "USER_ADVERTISE_DATA" and "USER_ADVERTISE_SCAN_RESPONSE_DATA" - what are their uses?

I am experimenting with the code below, but I am unsure where I can expect this data to end up?

I am testing with the LightBlue BLE app, the attached pictures shows the output from the app.

/// Advertising data #define MAN_DATA_1 "\x11" #define MAN_DATA_2 "\x22" #define MAN_DATA_LEN "\x01" #define USER_ADVERTISE_DATA MAN_DATA_LEN\ ADV_TYPE_MANUFACTURER_SPECIFIC_DATA\ MAN_DATA_1 /// Advertising data length - maximum 28 bytes, 3 bytes are reserved to set #define USER_ADVERTISE_DATA_LEN (sizeof(USER_ADVERTISE_DATA)-1) /// Scan response data #define USER_ADVERTISE_SCAN_RESPONSE_DATA MAN_DATA_LEN\ ADV_TYPE_MANUFACTURER_SPECIFIC_DATA\ MAN_DATA_2 /// Scan response data length- maximum 31 bytes #define USER_ADVERTISE_SCAN_RESPONSE_DATA_LEN (sizeof(USER_ADVERTISE_SCAN_RESPONSE_DATA)-1)

Attachment:
PM_Dialog
Offline
Last seen:13 hours 29 min ago
工作人员
加入:2018-02-08 11:03
Hi 3hl3rt,

Hi 3hl3rt,

The advertising string and the scan response data should follow a specific format. The manufacturer specific data is a flag that developer could include his own data and populate them while the device is advertising. In order to add custom data into the advertising string, the format should be like . The central sends a scan request to read the scan response data.

Find below an example :

/// Advertising data #define MAN_DATA_1 "\x11\x11" #define MAN_DATA_2 "\x22\x22" #define MAN_DATA_LEN "\x03" #define USER_ADVERTISE_DATA MAN_DATA_LEN\ ADV_TYPE_MANUFACTURER_SPECIFIC_DATA\ MAN_DATA_1 /// Advertising data length - maximum 28 bytes, 3 bytes are reserved to set #define USER_ADVERTISE_DATA_LEN (sizeof(USER_ADVERTISE_DATA)-1) /// Scan response data #define USER_ADVERTISE_SCAN_RESPONSE_DATA MAN_DATA_LEN\ ADV_TYPE_MANUFACTURER_SPECIFIC_DATA\ MAN_DATA_2 /// Scan response data length- maximum 31 bytes #define USER_ADVERTISE_SCAN_RESPONSE_DATA_LEN (sizeof(USER_ADVERTISE_SCAN_RESPONSE_DATA)-1)

I am using BLE scanner app in my side. In the specific device name, if you click on the raw data you will see the MAN_DATA_1 and MAN_DATA_2.

在the attached screenshot, I assume that you are in the connected stated, so what you see are the profiles, services, etc.

If you have any follow up question, please raise a new forum thread.

Thanks, PM_Dialog