Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For ESP32 Pico, not all ADC channels can be opened #822

Closed
devbotas opened this issue Sep 10, 2021 · 0 comments · Fixed by nanoframework/nf-interpreter#2043
Closed

For ESP32 Pico, not all ADC channels can be opened #822

devbotas opened this issue Sep 10, 2021 · 0 comments · Fixed by nanoframework/nf-interpreter#2043

Comments

@devbotas
Copy link

Details about Problem

Target: ESP32 Pico

**Firmware image version:1.7.0.2

Worked before? Probably not

Device capabilities output:

Description

AdcController.GetDefault().ChannelCount returns 20, but only first 10 can actually be opened. Opening other fails with CLR_E_PIN_UNAVAILABLE exception.

Detailed repro steps so we can see the same problem

  1. Take ESP32 Pico.
  2. Flash this program:
        public static void Main() {
            var adcController = AdcController.GetDefault();

            Debug.WriteLine($"AdcController says there are {adcController.ChannelCount} channels. But can we use them all?..");

            for (int i = 0; i < adcController.ChannelCount; i++) {
                try {
                    var channel = adcController.OpenChannel(i);
                    Debug.WriteLine($"Yay, channel {i} can be opened.");
                }
                catch (System.Exception) {
                    Debug.WriteLine($"Nay, channel {i} cannot be opened.");
                }
            }

            Thread.Sleep(-1);
        }

Other suggested things

If this is a firmware limitation, then AdcController.GetDefault().ChannelCount should return actually usable number of channels. I assume, 10.

Expected behaviour

Should be able to open all channels that are reported by the Windows.Devices.Adc library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants