Nano RP2040 Analog pins not working at all (DigitalWrite/AnalogWrite)

Hi All,

I am unable to use the analog pins (most interested in A0 but holds true for all analog pins).

A simple toggle code for A0 leaves the pin at 0.1v forever. Analog write does the exact same.

Is this a hardware failure? Is there a way to check that? i have the tools to look at the circuit if neccesary.

#include "WiFiNINA.h"

void setup() {
  pinMode(A0, OUTPUT);
}

void loop() {
  digitalWrite(A0, HIGH);
  delay(1000); 
  digitalWrite(A0, LOW);
  delay(1000);
}

Do you using them before?

Nope, they have never worked.

Can you damage it? Did you connect leds to it?

A0 is connected to the SPI chip select of a MAX3100 IC. There shouldn't be any way for damage to occur this way. I have the exact same set up for digital pins 2-11 without any issue. A1-A3 are not connected to anything, but also show the same behavior as A0.

The only way i could think to have damage is handling/static.

Have you read the data sheet on this processor?

I don't think the Analogue pins work like you think they should. An analog write is known as a PWM on this processor. And analog write never worked on analogue pins on any Arduino I know of.

Thanks for your response.

AnalogWrite() is one of the functions mentioned in the arduino documentation for RP2040 and for most arduinos, however I am actually more interested in using a digital write (which also should work with analog pins provided you set them up correctly). I simply want to use A0 as a CS pin for SPI comms. I have not seen anyone mention this as an issue before, so i begin to assume it is a hardware issue on my end.

Looking at it with a scope does not show any sort of PWM signal.

insight: Nano RP2040 Connect Cheat Sheet | Arduino Documentation | Arduino Documentation

Thanks,

I will be using A0 however, and would like to perform a digitalWrite(); as shown in the code posted.

according to this from the document you provided, this should be okay to do.

When I said look at the data sheet I meant the data sheet for the RP2040 chip itself, you can down load it from this link
RP2040 data sheet.pdf

On page 560 you will notice this diagram:-

It quite clearly shows that there are only four external pins and one internal pin into the ADC's multiplexer.

However the "extra" analogue input pins do go into the NINA-W102-00B Wi-Fi chip as it has a some pins that can be used as an A/D. So the claims in the data sheet are strictly correct.

If you want to use the analogue pins as an output, it is probably worth trying to use the alternate GPIO pins instead of referring to the analogue pin. This is taken from the Connect schematic.

Thanks everyone for the input.

To close out the issue, it was in fact a hardware issue.

Writing digitalWrite(A0, High) and low will work on the rp2040 no issue, provided you set up everything correctly (need to include wifinina.h)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.