Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple AnalogIn/AnalogOut needs continuous initialization on Nucleo F334R8 #1083

Closed
bunjes opened this issue Apr 29, 2015 · 7 comments
Closed

Comments

@bunjes
Copy link

bunjes commented Apr 29, 2015

I want to sample multiple AIn channels and simultaneously output the values to two AOut channels.

The following code works with one ain/aout combination, but if I add the definition of the second AnalogIn/AnalogOut objects, the AOut stops working:

 #include "mbed.h"

int main() {

   // Combination 1
    AnalogOut aout1(PA_5);
    AnalogIn ain1(PC_0);

    // Combination 2
    AnalogOut aout2(PA_6);
    AnalogIn ain2(PC_1);

    while(1) {

        aout1.write_u16(ain1.read_u16());

        aout2.write_u16(ain2.read_u16());

        wait_ms(1); 
    }
}

With both combinations active, I get 0V on PA_5, no matter what is on PC_0, but PC_1 -> PA_6 is still working.

Moving the constructions into the loop partially resolves the problem, but there are artefacts in the output, maybe due to the continuous re-initialization of the DAC/ADC:

 #include "mbed.h"

int main() {

    while(1) {

        // Combination 1
        AnalogOut aout1(PA_5);
        AnalogIn ain1(PC_0);

        // Combination 2
        AnalogOut aout2(PA_6);
        AnalogIn ain2(PC_1);

        aout1.write_u16(ain1.read_u16());

        aout2.write_u16(ain2.read_u16());

        wait_ms(1); 
    }
}

Any help is appreciated.

@ciarmcom
Copy link
Member

ciarmcom commented Aug 1, 2016

ARM Internal Ref: IOTMORF-266

@sg- sg- removed the mirrored label Aug 12, 2016
@LMESTM
Copy link
Contributor

LMESTM commented Jun 12, 2017

I'm working on it - a PR should be available this week

@LMESTM
Copy link
Contributor

LMESTM commented Jun 16, 2017

@bunjes - See PR #4529 - should solve your issue - feedback welcome

@LMESTM
Copy link
Contributor

LMESTM commented Jul 3, 2017

@bunjes @0xc0170
#4529 has been merged so issue now solved - please close (and re-open is any problem)

@bunjes
Copy link
Author

bunjes commented Jul 3, 2017

Thanks for solving. Two years and two months are quite a time span...
I hope you didn't work on the solution all this time ;-)

@LMESTM
Copy link
Contributor

LMESTM commented Jul 3, 2017

@bunjes I'm afraid this issue went through the net for all this time ... we're now cleaning up in a more systematic way to avoid this happens again ;-)

@jeromecoutant
Copy link
Collaborator

ST_TO_BE_CLOSED

@0xc0170 0xc0170 closed this as completed Jul 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants