DEVKIT-MPC5744P PWM -CTU-ADC synchronize problem

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

DEVKIT-MPC5744P PWM -CTU-ADC synchronize problem

1,789 Views
yiling
Contributor I

Hi,

I am trying to read the potentiometer voltage ( ADC1 Channel 6 on PE12  ) on the development board for MPC5744P by PWM -CTU-ADC synchronization. 

The problem is that ADC seems only read once.That is,  it doesn't continuously read the ADC.

I am using the S32 studio IDE.

and the code I configured is based on the example 

Example MPC5744P FlexPWM CTU ADC synchronization and motor control example of MPC5744P.

The initialization code is attached. 

I can't find what's wrong with the setting, so please help. Thanks in advance!

Tags (1)
3 Replies

1,407 Views
maxlee
Contributor II

我也在做和你一样的事 T^T

对应的ISR只进入了一次,而且唯一一次采到的电压值存在FIFO里却读不出来,莫名其妙。。。

怀疑的几个点:

1.PWM发出的MRS信号没有周期性的发送到CTU;

2.CTU中的Trigger没有周期性的触发;

3.Command List中的ADC指令没有周期性触发;

因为上述三个点都有对应的中断,我就想着看看各自能不能正常触发中断,我都进行了测试,结果对应的中断都无法正常进入。

不知您那边可有进展,请多指教。

0 Kudos
Reply

1,407 Views
yiling
Contributor I

Somehow, I solved the problem by setting a faster ADC clock as 80MHz. 

Register settings is listed below.

MC_CGM.AC0_DC2.R = 0x80010000; // ADC_CLK : Enable aux clk 0 div by 2 … (80 MHz)

You can also check Error Flag Register (CTU_EFR) to see if there are any error occurs.

Best regards,

0 Kudos
Reply

1,407 Views
maxlee
Contributor II

I solved this problem too.

I think the key point of this problem is the setting of the registers which could be automatically cleared by the hardware itself, such like CTU_0.CR.B.GRE, FlexPWM_0.MCTRL.B.LDOK and so on.

That means user have to set these bits appropriately every time the ISR is entered.

Thanks for your reply.

0 Kudos
Reply