How to setup eTimer to trigger ADC conversion on MPC5744P

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

How to setup eTimer to trigger ADC conversion on MPC5744P

960 次查看
VladiKn
Contributor III
Hello, Is there any example on how to do this? I have gone through all the documents that I have for the MPC5744P but couldn't find any example. It's only mentioned in the reference manual that it can be done. Cheers, Vladimir
0 项奖励
6 回复数

942 次查看
VladiKn
Contributor III

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

0 项奖励

933 次查看
PetrS
NXP TechSupport
NXP TechSupport

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

0 项奖励

916 次查看
VladiKn
Contributor III

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

0 项奖励

900 次查看
PetrS
NXP TechSupport
NXP TechSupport

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 

0 项奖励

897 次查看
VladiKn
Contributor III

Hi,

Thanks for the info. I had the OFLAG set to Software controlled. When I set it to toggle on compare it works!

Cheers!

0 项奖励

955 次查看
PetrS
NXP TechSupport
NXP TechSupport

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

0 项奖励