8 years, 6 months ago.

AnalogOut on nucleo F446RE

I have a DAC to ADC program that works on LPC1768 and K64F, but i can't get it to work on Nucleo F446RE. I have tried A2 and D13 (AnalogOut1 and AnalogOut2), but the output voltage stays at 3.264 for A2, no matter what I write to the DAC ???

3 Answers

8 years, 6 months ago.

I don't have the 446 board but I would do something like this"

<code>

  1. include "mbed.h"

DigitalOut myled(LED1); AnalogOut test(A2); int main() { static int analog = 0; while(1) { myled = 1; LED is ON wait(0.2); 200 ms printf("Step 1\n\r"); myled = 0; LED is OFF wait(1.0); 1 sec printf("Step 2\n\r"); test=analog++; } } </code>

It's useless code but it should prove a point. Does this work?

That's basically what my code was doing, stepping through DAC values.

I'm pretty sure there is a bug in analogout_write_u16() in targets/hal/TARGET_STM/TARGET_STM32F4/analogout_api.c

The dac write API says value is 16-bit, but library truncates it to 12 bits instead of shifting as implemented in the other platform libraries. Hence my code worked on LPC1768 and K64F.

i'll post an issue to their github ...

posted by tom dunigan 16 Oct 2015
6 years, 4 months ago.

Hello, I have the same problem AnalogOut is not working on Nucleo F446 but works on Nucleo F334. If anyone can solve the problem, I am really interested in using this function. Thanks.

6 years, 4 months ago.

Hi

I just ran AnalogOut ci-tests on the NUCLEO_F446RE and all is PASS. Can you share your code ?

Hello,

I have updated the mbed.h librairiy and now it works fine. Thanks for telling me it could work. This is my code for testing analogOut on the F446. Best regards ___________________

  1. include "mbed.h"

AnalogIn analog_In(A0); AnalogOut analog_Out(A2); DigitalOut led(LED1);

int main() { float meas;

printf("\nAnalogIn example\n");

while(1) { meas = analog_In; Converts and read the analog input value (value from 0.0 to 1.0) analog_Out = meas; meas = meas * 3300; Change the value to be in the 0 to 3300 range printf("measure = %.0f mV\n", meas); wait(0.2); 200 ms }

}

_____________________

posted by Fabrice DELAMARE 04 Dec 2017