I am using an ADC interrupt under MQX.The adc is triggered by TPM(FTM).
I have one single task.The interrupt is running correctly but the task's main loop blocks.
The task does not execute any thing except the interrupt.
It looks that task (while loop)remain always blocked when the task contains an interrupt.
What can I do so that the task(while loop) and the interrupt both run.
adc0_isr_ptr = _mem_alloc(sizeof(ADC0_ISR_STRUCT));
adc0_isr_ptr->OLD_ISR_DATA = _int_get_isr_data(INT_ADC1);
adc0_isr_ptr->OLD_ISR = _int_get_isr(INT_ADC1);
_int_install_isr(INT_ADC1, adc_ISR, adc0_isr_ptr);
_nvic_int_init(INT_ADC1, 3, TRUE);
void adc_ISR(pointer user_isr_ptr)
{
ADC1_SC1A = AIEN_ON | DIFF_SINGLE | ADC_SC1_ADCH(0);
result = ADC1_RA;
printf("ADC ch 00: %4d\n ", (uint16_t) ADC1_RA);
}
Solved! Go to Solution.
Hi Andy:
MQX only enables PDB trigger, the solution is to create your own ADC handling and not using MQX adc driver. I guess your task blocks when you try to read the ADC result register inside the ADC interrupt when the result flag is set, you can clear the result flag and then read the ADC result register.
Have a great day,
Daniel
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi
What MQX version you are using? Can this be recreated in Twr-board?
Regards
Daniel
I am using MQX 4.0 on my custom board, but not with MQX ADC driver, because i need to trigger with tpm, do you know how to do it with mqx?
Hi Andy:
MQX only enables PDB trigger, the solution is to create your own ADC handling and not using MQX adc driver. I guess your task blocks when you try to read the ADC result register inside the ADC interrupt when the result flag is set, you can clear the result flag and then read the ADC result register.
Have a great day,
Daniel
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------