adc1_get_raw() function triggered interrupt on a non ADC pin
Posted: Sat Nov 04, 2023 5:37 am
I am using ESP32-WROOM-32E. I have setup IO32, 33, 34, 35, 36 and 39 as analog input channels. All these 6 inputs mapped to ADC1.
I have also setup IO25 as mcpwm1 CAP1 interrupt input which is setup to be triggered when a rising edge voltage is applied to IO25. IO25 is normally held at logic '1' so to trigger the interrupt IO25 must first be pulled down to 0V and then pulled up to 3.3V again to generate a rising edge.
So far both my firmware for reading the ADC channels and mcpwm1 CAP1 interrupt functions each run perfectly on their own.
However, the problem I encountered is that each time my program calls the library function:
int adc1_get_raw(channel_no);
to obtain the ADC reading, the mcpwm1 CAP1 interrupt will be triggered exactly once. It is repeatable. It is as if calling the "adc1_get_raw()" function has caused the logic state of IO25 to be pulled down to logic '0' and then the externally applied 3.3V voltage then pull up the pin again and resulting in a rising edge interrupt. However, I hooked up a microscope to the input pin but was NOT able to capture any physical transition on the input pin.
What baffles me is that IO25 is not related to ADC channel 1 and I cannot understand why calling adc1_get_raw() function would trigger an interrupt on the IO25 (which has been configured as mcpwm1 CAP1 interrupt pin).
Would appreciate any advise. Thank you.
P/S - The firmware was developed using ESP-IDF version 4.0
I have also setup IO25 as mcpwm1 CAP1 interrupt input which is setup to be triggered when a rising edge voltage is applied to IO25. IO25 is normally held at logic '1' so to trigger the interrupt IO25 must first be pulled down to 0V and then pulled up to 3.3V again to generate a rising edge.
So far both my firmware for reading the ADC channels and mcpwm1 CAP1 interrupt functions each run perfectly on their own.
However, the problem I encountered is that each time my program calls the library function:
int adc1_get_raw(channel_no);
to obtain the ADC reading, the mcpwm1 CAP1 interrupt will be triggered exactly once. It is repeatable. It is as if calling the "adc1_get_raw()" function has caused the logic state of IO25 to be pulled down to logic '0' and then the externally applied 3.3V voltage then pull up the pin again and resulting in a rising edge interrupt. However, I hooked up a microscope to the input pin but was NOT able to capture any physical transition on the input pin.
What baffles me is that IO25 is not related to ADC channel 1 and I cannot understand why calling adc1_get_raw() function would trigger an interrupt on the IO25 (which has been configured as mcpwm1 CAP1 interrupt pin).
Would appreciate any advise. Thank you.
P/S - The firmware was developed using ESP-IDF version 4.0