MQX interrupt

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MQX interrupt

跳至解决方案
1,451 次查看
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 项奖励
回复
1 解答
1,342 次查看
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 项奖励
回复
3 回复数
1,342 次查看
danielchen
NXP TechSupport
NXP TechSupport

Hi

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

Regards

Daniel

0 项奖励
回复
1,342 次查看
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 项奖励
回复
1,343 次查看
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 项奖励
回复