AnalogIn read of ADC_VREF works in Debug profile but not in Release profile

I have a simple program that reads the ADC_VREF using AnalogIn.

The reading is correct when building in Debug profile using Mbed Studio.

But when building in Develop or Release profile it always reads 0.

Could anyone explain this?
Kind regards

I am also experiencing issues between the two different build profiles. ie. code executes correctly in debug build but not in release. Any ideas?
thanks

Hello,

it may be due to compiler optimization maybe, because In debug profile is optimization off.

BR, Jan

It would be helpful if you provide code snippets. It is just guessing game what can go wrong.

Thanks for responding. I’m using Mbed studio with a RAK3172 (MCU_STM32WLE5xC). I am using the STM32customtargets GitHub - ARMmbed/stm32customtargets: Enable the support of your custom boards in mbed-os 6

The following code runs as expected in debug build. However when I build for release (clean build) the code will execute one line of printf and stop.

#include “mbed.h”

// main() runs in its own thread in the OS
int main()
{
while (true) {
printf(“PrintLine\n”);

ThisThread::sleep_for(5s);
}
}

Where are the build profiles located in mbed studio?

Thanks

I am not sure, but default build profiles are probably loaded from - mbed-os/tools/profiles

I found an Issue already reported on github what seems to be related to this - STM32WLE5JC serial stop working when deepsleep · Issue #15331 · ARMmbed/mbed-os (github.com)

Maybe you can try this workaround until it will be solved by ST (@jeromecoutant ) or try to to avoid deep sleep if it is not necessary for your application.

BR, Jan

A big difference between develop and debug profile is that deep sleep is disabled in debug.

1 Like