Hello I am using the Pico W to display meters and miniscopes and all is working fine. I also read the onboard temperature sensor using ADC4 as below:
from machine import ADC
adc4 = machine.ADC(4) # Pico temp sensor
def ReadTemperature(): # does not work after using ADC-DMA sampling
volt = (adc4.read_u16() * 3.3)/65535
temperature = 27 - (volt - 0.706)/0.001721
return round(temperature, 1)
print (‘\nPico Temperature =’, ReadTemperature())
This works perfectly and gives the correct value, eg 30 deg.
I can use ADC0, 1, 2 for sampling sensors and the above always returns the correct results.
However, when I sample using DMA techniques on ADC1 (could be when using any ADC?) to get fast sampling into a buffer to display on an LCD to produce a scope display, after I have exited the scope routine and read the temperature again it gives a false reading of 95 or thereabouts.
If I restart, it produces the correct results until after the scope display. It is repeatedable.
I do not know what causes the fault after DMA and wondered if any of you had come across this problem. From this forum I am aware of having to use a different technique when reading ADC3 (= VSys/3) using a Pico W as the W version uses the same GPIO as ADC3 so the pad has to be saved and restored and so wondered if ADC4 has some similar issue when using DMA.
Thanks for looking, Steve