Hi,
I have initialized both the ADC and the eTimer and they run independently but I haven't managed to make a connection between them. I use ADC1 with CTU disabled and in Injected mode, and eTimer0 CH5. When I was using the ADC without the eTimer I used the EOC interrupt to gather the converted data. Do I use the eTimer interrupt in this case? Or is there another way to gather data?
Cheers,
Vladimir
Hi,
as I wrote eTimer1 ch5 is conencted to ADC0 and ADC1 as external trigger, so if using eTimer0 it will not work.
Same interrupt will be called if ADC_IMR[MSKJEOC] is set.
BR, Petr
Hi,
Thanks for the replies. Yes, eTimer1 was used but when I wrote the answer I put 0 by mistake.
After I set the MSKJEOC bit I get the EOC interrupt but only once. I've noticed that the TCF (and TCF1) flag of the eTimer is set and I assume that's what triggers the conversion. But when I try to clear the TCF flag in the STS register it doesn't work and it is constantly set to 1. Do you know what could be the issue?
Thanks,
Vladimir
Hi,
TCF is set when a successful compare occurs, it is cleared by writing 1 to this bit.
So probably counter is running and bit is set again.
The OFLAG signal is taken as external trigger to ADC.
BR, Petr
Hi,
Thanks for the info. I had the OFLAG set to Software controlled. When I set it to toggle on compare it works!
Cheers!
Hi,
if the ADC is in CTU mode, then you can use eTimer to trigger CTU, you can refer to below code
https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/Example-MPC5744P-eTimer-CTU-ADC-synchronization-...
If the ADC is not in CTU mode, then eTimer can directly trigger conversion. eTimer channel 5 acts as external trigger for ADC module and injection trigger should be enabled in ADC (JTRGEN bit). Using JCMR0 you select which channels will be sampled/converted after this external trigger happens. The eTimer1 ch5 is connected to ADC0 and ADC1, and the eTimer2 ch5 is connected to the ADC2 and ADC3 modules.
BR, Petr