Puck NRF sleep

Posted on
  • I have an application where the Puck sends data through BLE write on another device.
    To reduce power consumption even more, I tried turning off NRF by NRF.sleep() (The example here works https://github.com/espruino/EspruinoDocs­/blob/master/puck/Puck.js%20Security.md#­disable-bluetooth)

    However, when I modify the code to enable sleep after performing some action, the Puck lights up all 3 LEDs and my function does not work again. Here is a sample pseudo code -

    var locked = 0;
    digitalPulse(LED2, 1, 50);
    do something here
    setTimeout(() => NRF.sleep(), 1000); // turns on all 3 LEDs briefly and resets.
    }, BTN, {repeat:true, edge:"rising", debounce:50});

    Any suggestions why is this happening ?

  • Do you have an up to date firmware like 1v92?

    All 3 LEDs turning on at once is a sign of an unreported error from the Nordic Bluetooth stack, so it's not specifically anything you're doing.

    If it is 1v92 with the problem and it can be reproduced with just the above code I'll definitely take a look at fixing it - however I'm on holiday next week so it won't get done for a while.

    In the mean time, it's not using that much power by advertising - and you can always reduce the advertising interval with setAdvertising which will have much the same effect, without the need for explicitly waking and sleeping.

  • Ah ok. Cool. Yes I do have the latest firmware as you mention.
    I think the error is reproducible. But as you mention, I will change the setAdvertising.

    Happy holidays !

    PS - Great work :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Puck NRF sleep

Posted by Avatar for user76916 @user76916