Problem with using more than one ADC channel on nano 33 BLE?

The Nano 33 BLE Python Guide shows this ADC example, which works fine out of the box:

import machine
import time

adc_pin = machine.Pin(29) # A3
adc = machine.ADC(adc_pin)

while True:
    reading = adc.read_u16()     
    print("ADC: ",reading)
    time.sleep_ms(500)

I can recode it for different analog pins and everything still works as expected.

But then I tried to create and monitor two separate analog signals at the same time:

import machine
import time

adc_pin_A0 = machine.Pin(4) # A0
adc_A0 = machine.ADC(adc_pin_A0)

adc_pin_A3 = machine.Pin(29) # A3
adc_A3 = machine.ADC(adc_pin_A3)

while True:
    reading_A0 = adc_A0.read_u16()
    reading_A3 = adc_A3.read_u16()
    print("ADC A0: {:d}   A3: {:d} ".format(reading_A0, reading_A3))
    time.sleep_ms(500)

and now the two seem to interfere with each other: both seem to end up mapped to the same pin, whichever corresponds to the last created ADC object (call to machine.ADC()).

I can work around this by creating new ADC objects on every sample (every time around the loop):

import machine
import time

adc_pin_A0 = machine.Pin(4) # A0
adc_pin_A3 = machine.Pin(29) # A3

while True:
    reading_A0 = machine.ADC(adc_pin_A0).read_u16()
    reading_A3 = machine.ADC(adc_pin_A3).read_u16()
    print("ADC A0: {:d}   A3: {:d} ".format(reading_A0, reading_A3))
    time.sleep_ms(500)

This does “work”, but seems both crazily inefficient and very confusing.

I’m suspecting an issue in the underlying micropython port of ADC for nrf but I’m not familiar enough with reading the underlying C module implementation (or indeed the internal details of ADC on nrf52840) to figure out anything definitive.

So for now, for here, the question is just whether anybody else has encountered this; and especially whether I am doing something silly at the python level in the way I am trying to approach it.

Thanks!

Our support for that system is pretty minimal. Please create a bug ticket on our github for openmv but you should also bother the MicroPython folks about this.