Uncaught InternalError: Timeout (Magnetometer)

Posted on
  • I'm using the magOn event to report magnetometer readings. As shown in the example for the Door Controlled Light, I defined a global variable zero and calibrate the sensor with the readings of an initial Puck.mag() call. However, when I try and use Puck.mag() out of the convenience of a setWatch function upon a button press, I get the above error message.

    Can anyone tell me what's wrong here?

    setWatch(function() {
      zero = Puck.mag()
    }, BTN, {edge:"rising", debounce:50, repeat:true});

    and I receive something like

    Uncaught InternalError: Timeout (Magnetometer)
     at line 9 col 12
    in function called from system
  • Are you using up to date (1v92) firmware?

    Also, the only time I've come across this before has been when the battery is almost flat - the main processor works fine but the magnetometer stops working slightly before the ARM has trouble.

    Please could you check Puck.getBatteryPercentage() just to make sure?

  • Says 1v88. Battery level is shown as 100, but I know that can't be true.

    Is there a video for firmware updates using iOS? Watched the Android one, but the iOS app looks quite different.

  • Upgraded to 1v92. That fixed it.

  • Great! I'm afraid there isn't a video for iOS - I'll make a note to create one.

  • I reproduced this behavior with a flat battery showing 0 or 10 with E.getBattery(), not sure why the oscillation, but the magnetometer failed to record even though other components were still functional. Changing to a new battery brought the magnetometer back to life. firmware 1.99

  • Wed 2019.08.07

    'not sure why the oscillation'

    Basic physics, based on lack of sufficient voltage supplied.

    See p.17 nominal voltage is 3v - device unpredictable below that level, especially the AD as it's readings are ratio-metric based on voltage reference


    See 'Continuous Discharge Characteristics' graph in datasheet:


    For this battery type, once voltage starts to fall off, functionality goes quickly.

    "Note: this is an estimation only, based on battery voltage."

    The calculation


    Other discussions but for different board:


  • Thanks for the info! Ill read up, i suck at basic physics

  • Thanks for letting us know! I'll add a note to the docs.

    By the time the magnetometer fails the battery is almost completely dead - it just happens that the microcontroller is a little better at eeking out the final few percent than the magnetometer is!

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

Uncaught InternalError: Timeout (Magnetometer)

Posted by Avatar for badryan @badryan