Cannot use AnalogIn on MAX32625PICO

Hello, I am trying to use MAX32625PICO for the first time.
And trying to access analog input through “AnalogIn” API.
The compiler compiles the code without any error, and I can drag-and-drop the binary through usb.
But only thing that happens is the red LED flashes when unplugging and re-plugging the usb to run code, and green LED does not seem to turn on whatever an analog input.
My platform is Mbed Studio. And choose mbed os 5 when creating the project.
Here’s the actual code.


#include "mbed.h"

AnalogIn ain(AIN_0);
DigitalOut gLED(LED2, LED_OFF);

int main()
{
    while (true)
    {
        float value = ain.read();
        gLED = (value > 0.5f);
        wait_us(10000);
    }
}

Hi,

I don’t have an MAX32625PICO board. But according to the schematics here, the AIN_0 can be configured (see table 2 and 3).

Regards,
Toyo

Thank you.
This time I tried “Keil Studio” instead of “mbed studio”.
With Keil studio, the code below runs successfully without any error.
Maybe mbed studio still does not support MAX32625PICO?

#include "mbed.h"
#include "platform/mbed_thread.h"

int main() {

  AnalogIn ain0(AIN_0);
  DigitalOut rLED(LED1);

  while (true) {
    float value = ain0.read();
    rLED = value > 0.5f;
    thread_sleep_for((uint32_t)20);
  }
}

Hi,

I’ve used the MAX32630FTHR board which I believe it is very similar as the MAX32625PICO board. The blinky example for the Mbed OS 5.15.9 works fine with the Mbed Studio v1.45.
Please see the screenshot below.

I touched/released the AIN_0 port by my finger for the AnalogIn test :slight_smile:

1 Like

Thank you for testing it with MAX32630FTHR.
I copy-pasted the code you provided me to my mbed studio, and now it worked!!

I really appreciate your advise!