ADC in CTU mode: Which interrupt signals "end of all conversions"?

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

ADC in CTU mode: Which interrupt signals "end of all conversions"?

1,793 Views
peter_vranken
Contributor IV

Dear Ladies and Sirs,


Using the ADCs of the MPC5643L under control of the CTU I have the following question.


In my scenario the CTU demands several AD conversions from both the ADCs. An interrupt is raised after completion of the last conversion. The service routine fetches all conversion results from the data registers of the ADCs and provides them to the application code.


My question: Which interrupt should I configure for fetching the data? I tried to enable the interrupt in the last ADC command submitted by the CTU to the ADC (bit CIR in last used CLRx), but this interrupt came too early (while the CTU initiated conversion was still busy) and fetching the data failed. Prior to enabling CTU control I had applied the ADC conversion chain complete interrupt but under CTU control the ADC has no "chain" configured any more. As a kind of workaround, I programmed a second trigger in the CTU, which comes with constant delay after the start of the ADC command list and which is not connected to the ADC or another device. I use the interrupt on this trigger to do the data fetching. This works fine and it is stable due to the predetermined, SW independent and documented timing of the ADCs. However, I think there should be a more to the point solution, an interrupt, which is really made for saying: "All ADC done"

Regards,

Peter

Tags (2)
2 Replies

1,338 Views
peter_vranken
Contributor IV

Thanks a lot!

Peter

0 Kudos
Reply

1,338 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

I think there could be 3 possibilities

1) read results using the DMA. The concept is outlined here: https://community.nxp.com/docs/DOC-102559 

2) enable End of CTU conversion on ADC side. That is set the IMR[MSKEOCTU], enable channel interrupt of the last converted channel of the CTU list using CIMR register. Use ADC EOC interrupt vector and clear ISR[EOCTU] flag and corresponding CEOCFR0 flags.

3) add dummy command into end of CTU list with interrupt enabled. Once interrupt for this last dummy command is called, previous conversions should be completed.

BR, Petr