Beacon Nrf51822 low power

I am programming a nrf51822 using the examples. I also tweaked a few looking for a particular result. But I am unable to get the beacon to advertise and not run the battery out in 3 days. Does anyone have any suggestions? I have tried to add longer duration between advertising . But I specifically am wondering what i can do the the supplied beacon mbed examples to make it last 1 yr as advertised. i have other beacons that do it, but not on the mbed with nrf51822.

any help or suggestions is appreciated.

thank you

I think you need to build for a release profile (mbed compile --profile=release) otherwise sleeping is disabled.

Ok, I will try that. We are advertising every (1) second. Does it sleep between the broadcasts? I was thinking that the broadcast (when power level was set low also) simply used a very small amount of power and the sleep function does not come into play. Is that incorrect? Thank you, i appreciate the help.

Yes, if you pause all threads the device will automatically go into deepsleep mode.

I know runs for >1 year on a battery (nrf51 as well).

o thanks I will try that.

Does anyone know what would need to be changed or added to the make the mbed beacon example work? To have the battery last the intended length? i have used other platforms and the api allowed for this but cannot seem to find how to achieve low battery consumption on the beacon in mbed. thanks

Could it be that a peripheral is still open in the background and drawing power? Perhaps UART? Try removing printf code from your build and see if power consumption improves (or behind a build flag).

Thank you for responding. In the example program there is not much going on, so i dont believe there is any things running in the background that I am aware of… I did a few things that helped some. One is the TXpower level was unspecified in the program, not sure what the default is, But i lowered it . And that helped some. And strangely I decreased the interval from 1000 ms to 50 ms and that helped. Seems like it should have made it worse. Because it is sending advertisements more often. I used some examples and have developed on ARMKEIL u vision 5 in the past and the battery has only lower about 8% over two months. But thought I would explore this MBED platform and that battery lasts about 4 days and it completely dead. And I dont see any real recognizable difference in the two. I also used the other older beacon (that was programmed on KEIL) and loaded it with the MBED program in case there was some hardware issue draining the battery and it was not the program…but ended up with the same results.