ESP32-C3 A3 (GPIO5) not usable.
# help
k
jaguar report: ****************************************************************************** Decoding by
jag
, device has version ****************************************************************************** EXCEPTION error. OUT_OF_RANGE 0: adc_init_ \gpio\adc.toit:101:3 1: Adc \gpio\adc.toit:58:17 2: main soilSensor.toit:423:9 ****************************************************************************** C3 has 4 ADCs A0..A3 on ports GPIO2..GPIO5. Why is A3 not usable?
Answered in `lib/gpio/pin.toit`: ==> Pin 5 is an ADC pin of channel 2. ADC channel 2 has restrictions and **should be avoided if possible**.
f
Yeah. This is a bit annoying. Typically, we try to provide better error messages, but here the error message comes from the underlying C code (the primitive). And the errors that can come from there are a bit limited. We can't easily test for the pin numbers in Toit code already, as the pins are different depending on the Target (esp32, esp32c3, ...), and we don't want to change the Toit code for every possible hardware. This means that it's currently just an OUT_OF_RANGE...