1 year ago

#385120

test-img

박동진

arm cortex log10 function sometimes returns 0

I'm using stm32f4xx mcu with <math.h> lib

when I convert the mW to dBm, used log10f() function

but, the log10 function return value is not valid occasionally.

here is my code:

volatile float power = 0.0f;
volatile float data  = 0.0f;
volatile int power_conversion = 0;

power = Interpolation();       // this function returns mW value
data = 10 * log10f(power);     // <-- wrong value returns, [dBm Conversion]

also I have recognized some conditions of wrong value:

expected value is -53.xx dBm when the value -4.7x10-6 but returns zero

the power value -4.7x10-5 does not occur in error (-43.xx dBm)

but, the value exceed 10-6 does occur in error (returns 0)

10-5 -> OK

10-6 -> Wrong return 0

does anyone know this?


#resolved
#my stupid brain fault

c

arm

math.h

0 Answers

Your Answer

Accepted video resources