I am in need of a simple example of programming a beacon.

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

cross mob
MaSa_4283876
Level 1
Level 1

All I need to do is send an advertisement every few seconds.  Eventually I will add some manufacturer's data that I get from a sensor.  Ultimately this will be moved to a PSOC 4 BLE because the 6 is serious overkill for this simple of an application.

So far my attempts have not resulted in any advertisements.

The BLE module is set up as a Broadcaster with a single core.  GAP Settings  include a fast advertising interval of 1000ms min and max with no timeout.

The following code is the bare bones code of what I thought should be needed on CM0p

int main(void)

{

     __enable_irq(); /* Enable global interrupts. */

   

    /* Unfreeze IO if device is waking up from hibernate */

    if(Cy_SysPm_GetIoFreezeStatus())

    {

        Cy_SysPm_IoUnfreeze();

    }

    /* Place your initialization/startup code here (e.g. MyInst_Start()) */

    Cy_BLE_Start(NULL);

    PWM_Start();  // just blinks an LED to tell me it got this far.

   

    for(;;)

    {

         Cy_SysPm_Sleep(CY_SYSPM_STATUS_CM0_SLEEP);

         /* The BLE Controller automatically wakes up host if required */

         Cy_BLE_ProcessEvents();

    }

}

A good hint on how the program is supposed to set the manufacturer specific data would be nice too.

Thanks for the assistance.

0 Likes
1 Solution
ShipingW_81
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 replies posted

You can refer to ce215555​ for the general flow to set up a broadcaster role.

I don't see any custom BLE stack callback registered in your code. How to start advertising for this role?

View solution in original post

0 Likes
1 Reply
ShipingW_81
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 replies posted

You can refer to ce215555​ for the general flow to set up a broadcaster role.

I don't see any custom BLE stack callback registered in your code. How to start advertising for this role?

0 Likes