PSoC 6 BLE : info about advertising packet

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ClMe_4503246
Level 1
Level 1
Hello everybody!
I'm using PSoC 6 BLE PROTOTYPING KIT and I configurated it in Broadcaster GAP Role.
I would like to TURN_ON a pin every time an adv packet is sent and do it at the same time!
How can I implement it? Is there a way to know when a adv packet is sent?
0 Likes
1 Solution
NazarP_56
Employee
Employee
25 solutions authored 10 sign-ins 50 replies posted

Hi clme_4503246,


You can use Cy_BLE_SetCustomEventMask(CY_BLE_ADV_TX_EVENT_MASK) to enable advertisement packet sent events. As result you will receive CY_BLE_EVT_GAP_ADV_TX events when an advertisement packet is sent over the air. You can call Cy_BLE_SetCustomEventMask function in CY_BLE_EVT_STACK_ON event from application BLE callback.

void AppCallBack(uint32_t event, void* eventParam)
{
    switch (event)
    {
      
        case CY_BLE_EVT_STACK_ON:
        Cy_BLE_SetCustomEventMask(CY_BLE_ADV_TX_EVENT_MASK);
        break;

        case CY_BLE_EVT_GAP_ADV_TX:
        // Do some processing here...        
        // NOTE:
        // CY_BLE_EVT_GAP_ADV_TX will be generated when adv packet is sent across 1 ADV channel,

        // so in default configuration ADV comes across 3 ADV channels (37, 38, 39),

        // so you should count CY_BLE_EVT_GAP_ADV_TX (e.g 3 times) before TURN_ON/OFF a pin.

        break;
     …
}
}

    }     

}


Regards,
Nazar

View solution in original post

2 Replies
NazarP_56
Employee
Employee
25 solutions authored 10 sign-ins 50 replies posted

Hi clme_4503246,


You can use Cy_BLE_SetCustomEventMask(CY_BLE_ADV_TX_EVENT_MASK) to enable advertisement packet sent events. As result you will receive CY_BLE_EVT_GAP_ADV_TX events when an advertisement packet is sent over the air. You can call Cy_BLE_SetCustomEventMask function in CY_BLE_EVT_STACK_ON event from application BLE callback.

void AppCallBack(uint32_t event, void* eventParam)
{
    switch (event)
    {
      
        case CY_BLE_EVT_STACK_ON:
        Cy_BLE_SetCustomEventMask(CY_BLE_ADV_TX_EVENT_MASK);
        break;

        case CY_BLE_EVT_GAP_ADV_TX:
        // Do some processing here...        
        // NOTE:
        // CY_BLE_EVT_GAP_ADV_TX will be generated when adv packet is sent across 1 ADV channel,

        // so in default configuration ADV comes across 3 ADV channels (37, 38, 39),

        // so you should count CY_BLE_EVT_GAP_ADV_TX (e.g 3 times) before TURN_ON/OFF a pin.

        break;
     …
}
}

    }     

}


Regards,
Nazar

Hi
I tried your code and it works well!
thank you very much!

0 Likes