Hi,
I'm looking for a way to stop the ADC continuous mode from ISR function. this is what i'm trying to do:
bool bAdcResultReady_flag = false;
void ARDUINO_ISR_ATTR vAdc_continous_complete_isr_fn(){
// stop ADC continous until the next cycle
analogContinuousStop();
bAdcResultReady_flag = true;
}
void setup() {
// Serial port config
Serial.begin(115200);
// ADC configuration
analogContinuousSetWidth(12);
analogContinuousSetAtten(ADC_11db);
uint8_t pu8AdcPins[] = {34};
analogContinuous(pu8AdcPins, xNbrAdcPins, 10, 20000, &vAdc_continous_complete_isr_fn);
delay(2000);
analogContinuousStart();
}
void loop() {
if(bAdcResultReady_flag){
bAdcResultReady_flag = false;
Serial.println("ADC complited");
// start it again for new cycle
analogContinuousStart();
delay(5000);
}
}
when i upload this program, my ESP32 keep restarting every 2 seconds, and i get this error msg:
assert failed: xQueueGiveFromISR queue.c:1311 (!( ( pxQueue->pcHead == ((void *)0) ) && ( pxQueue->u.xSemaphore.xMutexHolder != ((void *)0) ) ))
Backtrace: 0x4008207d:0x3ffbf06c |<-CORRUPTED
i don't know why i can't run "analogContinuousStop();" from ISR function, if someone can explaint it to me, and what is the alternative for that. since analogContinuousStop(); is the only way to stop ADC DMA (or ADC continuous).
Thank you