CYBLE-022001-00 Configured as Beacon how to stop and Restart Advertisements?

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

cross mob
lock attach
Attachments are accessible only for community members.
ALDE_1053476
Level 3
Level 3
10 replies posted 10 questions asked 10 sign-ins

Hello.

I've created a Project based on CYBLE-022001-00 where BLE is configured as iBeacon.

I need to toggle Advertisement on and off by pressing a pushbutton.

Initialization works,

Stop Advertisment works,

Restart Advertisment doesn't.

As a workaround I Force Watchdog to reset System, but I Think there should be a better way (which I couldn't find).

Can anyone help me?

I've attached the project

Thanks,

Alfonso

0 Likes
7 Replies
ALDE_1053476
Level 3
Level 3
10 replies posted 10 questions asked 10 sign-ins

Hello,

Can anybody try to help me?

Thanks,

alfonso

0 Likes

Hi Alfonso,

I got few errors related to routing when I tried to build your project.

I have used pin interrupt and ISR and created a project that will toggle the advertisement state when pin is pressed. Please check it once. If it works you can just develop that project for your requirements.

Please reply for any queries.

Thanks

Ganesh

0 Likes

Hi Ganesh,

Thanks for your Feedback.

I'm really surprised You found Routing Errors.

The Project I sent You builds correctly on my side (I'm working with Creator 4.2)

Anyway, I'll test your code and advise in a couple of Days,

Alfonso

0 Likes

Hi Ganesh,

I've noticed that you used a different Target Device (CY8C4248LQI-BL583) which I don't Have.

So I tried to replicate (as much as possilble) your example in my project.

I Still face the same issue:

- Calling CyBle_GappStopAdvertisement(); stops advertisments

- Calling CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST); doesn't restart Advertising

I Monitor the BLE transmission with my android smartphone using an APP named "Beacon Scanner"

I've attached last release of my project.

If you have a CY8CKIT-145, you can easily test it (Kit features a pushbutton connected to P4.1 of BLE module and a led connected to P1.6)

Thanks,

Alfonso !

0 Likes

Hi

I your application you are just using Broadcaster and you are not connecting to any device correct?

In your code I can see that you are calling CyBLE_StartAdvertisement() only at one place i.e. on STACK_ON or DISCONNECTION events. Since you are not connecting, the disconnection event will never be triggered. The STACK_ON event triggers only once during reset.

I could not see where are you restarting the advertisement again. You can use CYBLE_EVT_GAPP_ADVERTISEMENT_START_STOP event to detect the advertisement stop and Start the advertisement again.

Please correct me if my understanding is wrong.

I also observed that device is not advertising when calling Fast_Estimate_Battery_Level() function in the Init(). Please confirm it once.

Thanks

Ganesh

0 Likes

Hi Ganesh,

Yes You're right, my application is just a Broadcaster.

However, depending on the configuration (Conditional compilation that can be changed by commenting / uncommneting raw 27 in File Common_Declarations.h) I can alternatively call CyBLE_StartAdvertisement() or force the WDT timeout to expire and restart the program.

But Advertising doesn't restart unless I Force WDT reset.

Concerning the function Fast_Estimate_Battery_Level(), it stores the result in a variable which is then associated to major of the i-Beacon and periodically broadcasted (this function works).

Alfonso

0 Likes

Hi Ganesh,

Can you please Help me with my last reply?

Thanks,

Alfonso

0 Likes