I was thinking here of the penultimate paragraph of 12.4.0 in the datasheet, under the diagram. RP2040 has very similar text and presumably similar behaviour.I thought though that for the ADC to work, the pin had to be enabled - this may be my misunderstanding, to be honest, but then if the ADC does work without pin configuration from a power cycle, given I have to dynamically configure the pin from being a digital input with pulldown (for the initial touch detect) how do I get the pin back to its original power on state which is high impedance. Do I have to directly interact with the.GPIO control register?
If you are using the SDK functions, there's adc_gpio_init() which does the following:
Code:
// Select NULL function to make output driver hi-Z gpio_set_function(gpio, GPIO_FUNC_NULL); // Also disable digital pulls and digital receiver gpio_disable_pulls(gpio); gpio_set_input_enabled(gpio, false);
For your case where you are flipping between digital input (SIO) and ADC, I think you can leave the function select at GPIO_FUNC_NULL and just flip the gpio_set_input_enabled() (and the pull-up if you are using it).
If you are already doing that then there's a new problem case.
Yes, as noted much earlier in the thread, even if the erratum note is 100% complete/accurate, there is no direct workaround for cases where GPIO falling edge interrupts are used and the falling edge is intended to be generated by the on-chip pulldown. Solutions include either fitting an external pull-down or changing the method of operation to timer polled instead of interrupt driven.Also even if this works, what about the digital input scenarios involving irqs etc where the 'enable the pin then read then disable' scenario won't work.
If the erratum note is 100% accurate, then this is just a backwards-compatibility issue: if they'd announced an unrelated new chip with a spec that simply didn't have pull-downs available then it would have been barely worthy of comment; since it's supposed to be backward-compatible with RP2040 (and Pico2 backwards compatible with Pico1) then there are some issues.
If the new problem reports of behaviour with the pull-downs disabled turn out to be accurate, then it's a bigger problem.
The assumption in the erratum note and its suggested workaround is that the input with pull-down enabled is acts as a bus hold. So if you enable the input and it's already at logic zero then nothing happens. If you enable the input and it's already at logic 1, presumably because some external circuit is holding it that way, then again nothing immediately happens, just that in this condition if the external voltage is removed then the pin won't transition back to zero until the input is disabled again.Also isn't the pin transiently a non linear input impedance even when briefly enabled?
IF you aren't treating it as a purely digital input and are applying various voltages to it, again if the erratum note is accurate and you disable the pull-down then it's a high-impedance input with schmitt trigger and all is well. If as we now suspect some of this behaviour applies even if the input pull is turned off, then yes it is a non-linear input impedance, but it's a fairly high impedance even at its lowest and if you are only enabling it for a few clock cycles then in the presence of at least some stray capacitance you wouldn't expect it to have much effect. On the other hand, if you need to poll it at a high duty cycle then you are just reducing rather than eliminating the effect.
Statistics: Posted by arg001 — Tue Aug 27, 2024 7:58 pm