MQX interrupt

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MQX interrupt

Jump to solution
751 Views
antonychen2008
Contributor II


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);
     
}

0 Kudos
1 Solution
642 Views
danielchen
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
3 Replies
642 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi

What MQX version you are using? Can this be recreated in Twr-board?

Regards

Daniel

0 Kudos
642 Views
antonychen2008
Contributor II

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?

0 Kudos
643 Views
danielchen
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos