MQX interrupt

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,456件の閲覧回数
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,347件の閲覧回数
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,347件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi

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

Regards

Daniel

0 件の賞賛
返信
1,347件の閲覧回数
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,348件の閲覧回数
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 件の賞賛
返信