Arm Mbed and Pelion Device Management support forum

DeepSleepLock underflow error when doing pow(2, ((m - 69.0f) / 12.0f))

Hi there,

When I use GreenTea to unit test this function:

   float Piano::midiNumToFrequency(uint8_t m)
{
    float exp = (m - 69.0f) / 12.0f;

    return pow(2, exp);
}

I get a DeepSleepLock underflow error:

[1589410046.26][CONN][RXD] ++ MbedOS Error Info ++
[1589410046.30][CONN][RXD] Error Status: 0x80040124 Code: 292 Module: 4
[1589410046.35][CONN][RXD] Error Message: DeepSleepLock underflow (< 0)
[1589410046.37][CONN][RXD] Location: 0x8003B09
[1589410046.40][CONN][RXD] File: mbed_power_mgmt.c+197
[1589410046.43][CONN][RXD] Error Value: 0xFFFF
[1589410046.53][CONN][RXD] Current Thread: main Id: 0x20001200 Entry: 0x80044A7 StackSize: 0x1000 StackMem: 0x20001C18 SP: 0x2000FF04
[1589410046.62][CONN][RXD] For more info, visit: https://mbed.com/s/error?error=0x80040124&tgt=NUCLEO_L432KC
[1589410046.64][CONN][RXD] – MbedOS Error Info –

Yet when I change the function to this:

float Piano::midiNumToFrequency(uint8_t m)

{

    float exp = (m - 69.0f);

    return pow(2, exp);

}

it works and tests fine.

I’m testing on a NUCLEO L432KC using MBed CLI.

Any ideas why this is happening?

Let me know what other info I need to provide.