Cant print floating values %f in my project

Hi All,

I am trying to print out floating values for my NRF5340 v2.4.1 SDK project. But, I am not able to print out the floating values. I tried the setting the following configuration but still failure:


CONFIG_PWM=y
CONFIG_LED=y
CONFIG_LED_PWM=y
CONFIG_PM=n
CONFIG_LOG=y
CONFIG_COLLABORATIVE=y
CONFIG_NEWLIB_LIBC=y
CONFIG_CBPRINTF_FP_SUPPORT=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
# CONFIG_LOG_PRINTK=y
# CONFIG_PRINTF_FLOAT=y

CONFIG_COLAB_ACTIVE_LOW_LEDS=y

void set_voltage(float voltage)
{

uint32_t pulse_width_ns = (voltage / 10.0f) * PWM_PERIOD_NSEC;

int ret = pwm_set_dt(&pwm_output_analog_out, PWM_PERIOD_NSEC, pulse_width_ns);

if (ret)
{
LOG_ERR("Failed to set PWM voltage: %d", ret);
}
else
{
LOG_INF("Set PWM voltage to: %f V", (float)voltage);
}
}

But I am always getting:
I: Set PWM voltage to: %f V
I: Set PWM voltage to: %f V
I: Set PWM voltage to: %f V

with no floating point value printing out.

Any help or recommendation is appreciated. Thank you.

Parents Reply Children
No Data
Related