Report
4 years, 1 month ago.  This question has been closed. Reason: Unclear question

[RESOLVED] AnalogIn on Pins D0/D1 not working?

Hi,

on my Nucleo STM32F334R8T6 I can read in analog values on pins A0...A5, but reading in on D0 and D1 (which is supposed to support AnalogIn according to the pinout diagram) does not work:

https://developer.mbed.org/users/bunjes/code/Nucleo_AIn_Test/

reading analog values on different nucleo pins

#include "mbed.h"
 
AnalogIn analog_value_1(A0);
AnalogIn analog_value_2(D0);
 
int main() {
    float meas1;
    float meas2;
    
    printf("\nAnalogIn example\r\n");
    
    while(1) {
        meas1 = analog_value_1.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
        meas1 = meas1 * 3300; // Change the value to be in the 0 to 3300 range
        meas2 = analog_value_2.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
        meas2 = meas2 * 3300; // Change the value to be in the 0 to 3300 range
        printf("A0 = %.0f mV\tD0 = %.0f mV\r\n", meas1, meas2);
        wait(0.2); // 200 ms
    }
}

Using PA_2 and PA_3 instead of D0 and D1 did not help. Am I missing something?

Sincerely,

Friedemann

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32F334R8T6 microcontroller.

Hi Friedman, Check the User Manual (UM1724) PA_2 andPA_3 are used for the USB-USART see section 5.8 USART and section 5.9 Solder Bridges SB13,14; Can be re-assigned. Hope this explains

posted by Martin Simpson 03 Jul 2015