Using Beacon reference design with ADV_SCAN_IND

4 posts / 0 new
Last post
quangng
Offline
Last seen: 2 years 4 months ago
Joined: 2015-10-29 22:03
Using Beacon reference design with ADV_SCAN_IND

Hello,

I'm making a small beacon application based on the DA14580_BEACON_3.40.6 reference design. In particular, I would like to the broadcaster to send the scan response data in addition to the advertising data when it receives the scan response request from the observer. So I understand that I have to set app_advertise_mode in the app_init_func() to scannable undirected advertising event (ADV_SCAN_IND), but I could find any macro of this PDU type in the SDK. How can I set the broadcaster (beacon device) to achieve this?

Plus, I would like to use my own beacon data instead of using the beacon data defined in the const struct nvds_data_struct (nvds.c file). How can I do this?

Device: 
MT_dialog
Offline
Last seen: 1 year 9 months ago
Staff
Joined: 2015-06-08 11:34
Hi quangng,

Hi quangng,

Try to insert scan response data to the advertising string, this should trigger the ADV_SCAN_IND PDU that you want. To try it into the beacon reference design you can go to the app_dialog_beacon_proj.h and change the APP_SCNRSP_DATA_LENGTH to 3 (the allready placed data in the APP_SCNRSP_DATA) after doing that in order to see your device to advertise go to the app_sleep.h file and comment out the below snippet in the app_asynch_trm() function:

            if (app_advertise_counter == 1)
            {
                if (app_advertise_mode == GAPM_ADV_NON_CONN)
                    ble_advtim_set(500);
            }

The beacon reference can populate the advertising data from different sources either the NVDS or the flash depending the configuration of the fw, in the end the data array of the advertising information populates the adv_data member of the gapm_start_advertise_cmd so this is where you should focus.

Thanks MT_dialog

quangng
Offline
Last seen: 2 years 4 months ago
Joined: 2015-10-29 22:03
Hi Dialog team!

Hi Dialog team!
About the beacon example project
1. What does the following code snippet in app_asynch_trm (in app_sleep.h file) does? Why do we have to comment out that code snippet for scan response data to work?

if (app_advertise_counter == 1)
{
if (app_advertise_mode == GAPM_ADV_NON_CONN)
ble_advtim_set(500);
}

2. What does this ble_advtim_set function do? Is this used to set the advertising interval between each advertising channel (37, 38, 39). I modified the beacon example project by setting the advertising interval to 1000ms. From my sniffer logging data, I saw that 3 advertisement packets are sent out almost "at the same time" (first on channel 37, then 38, and then 39) then 1000ms later the same pattern repeats again.

3. What defines the interval between each advertising packet on each channel (37, 38, 39). Is this interval defined by the function ble_advtim_set(500)?

4. Is this possible that the software is modified to send only 1 advertisement packet on each channel which advertising interval defined in APP_BEACON_INT_MIN and APP_BEACON_INT_MAX? (for example, adv packet payload "A" on channel 37-> 1second -> adv packet payload "A" on channel 38 -> 1second -> adv packet payload "A" on channel 39 -> 1second -> adv packet payload "B" on channel 37 -> 1second -> adv packet payload "B" on channel 38 -> 1second -> adv packet payload "B" on channel 39 -> .... etc

5. With the uart2 driver, can we wake up the beacon device from extended sleep mode when a character is received from UART Rx pin (P0_5)?

I have attached here a pdf file to elaborate my questions about the advertising interval

MT_dialog
Offline
Last seen: 1 year 9 months ago
Staff
Joined: 2015-06-08 11:34
Hi quangng,

Hi quangng,

1. The beacon advertising mode is unconnectable so we can reduce the advertising interval time between two advertising packets in order to save some power, if you try to transmit and receive as well (since you will have to listen the scan request packet in your case) the time between each interval is insufficient for opening the receiver so the system wont do anything.

2&3. Thats what the ble_advtim_set does it reduces the advertising interval between each advertising channel.

4. Yes you can advertise in one or two channels, this can be done in the configuration of your gapm_start_advertise_cmd and in the channel_map member you can have either 01->37 02->38 04->39 channel

5. You can set the P05 in your wakeup controller and wake up from this when someone presses a key on the keyboard but you will miss the character from the uart.

Thanks MT_dialog

Topic locked