Hello Guys,
i have run into some problems with the NUCLEO-F303K8.
My goal is to use an analog output (later all three of them PA_4, PA_5 or PA_6) while reading this output with several Analog input.
I have removed SB 16 and SB 18 as stated in the handbook to 'float' PA_5 and PA_6.
When I use this code without reading the input everything works just fine.
Working Code
#include "mbed.h"
AnalogIn ain(PA_0);
AnalogOut aout(PA_6);
int main()
{
float meas;
float out_value;
float diff;
printf("Start \n");
while(1)
{
for (out_value = 0.0f; out_value <= 1.0f; out_value += 0.01f) {
aout.write(out_value);
wait(0.3);
diff =(out_value - meas);
printf("(out:%.4f) - (in:%.4f) = (%.4f) \n", out_value, meas, diff);
}
}
}
If i add the reading function of A0 the output stucks and doesn't output the correct voltage
Not working Code
#include "mbed.h"
AnalogIn ain(PA_0);
AnalogOut aout(PA_6);
int main()
{
float meas;
float out_value;
float diff;
printf("Start \n");
while(1)
{
for (out_value = 0.0f; out_value <= 1.0f; out_value += 0.01f) {
aout.write(out_value);
wait(0.3);
meas = ain.read(); // THIS IS THE NEW LINE
diff =(out_value - meas);
printf("(out:%.4f) - (in:%.4f) = (%.4f) \n", out_value, meas, diff);
}
}
}
The biggest surprise is that if I'm using PA_4 instead of PA_6 or PA_5 to output the voltage - it works.
How can i fix this problem? Is the code wrong or is it a hardware issue? What could it be?
P.S. I tried it with 3 different Boards.
Hello Guys,
i have run into some problems with the NUCLEO-F303K8. My goal is to use an analog output (later all three of them PA_4, PA_5 or PA_6) while reading this output with several Analog input. I have removed SB 16 and SB 18 as stated in the handbook to 'float' PA_5 and PA_6.
When I use this code without reading the input everything works just fine.
Working Code
If i add the reading function of A0 the output stucks and doesn't output the correct voltage
Not working Code
The biggest surprise is that if I'm using PA_4 instead of PA_6 or PA_5 to output the voltage - it works. How can i fix this problem? Is the code wrong or is it a hardware issue? What could it be?
P.S. I tried it with 3 different Boards.