AnsweredAssumed Answered

MPC5744P CTU-ADC issue

Question asked by zhiming zhang on Jun 29, 2020
Latest reply on Jul 6, 2020 by zhiming zhang

My application is using FLEXPWM_MRS as reload signal for CTU_0 to trigger 8 channels of ADC1 in trigger mode. 

below are the configuration of CTU and ADC module:

 

CTU_0.TGSISR.R = 1; /* Input 0 Rising edge Enable -- FlexPWM_0_MRS */
CTU_0.TGSCR.R = 0; /* Prescaler is 1, trigger mode */

CTU_0.TGSCRR.R = 0;
CTU_0.TGSCCR.R = 8000; /* 20KHz by default */

CTU_0.TCR[0].R = 4000; /* center point trigger sample */

CTU_0.CLCR1.B.T0_INDEX = 0; /* Trigger 0 command list 1st command address */

CTU_0.THCR1.R = 0x41; /* Trigger 0 enable, ADC command output enable */

CTU_0.CLR[0].A.R = 0x0020; /* single conversion, result to FIFO0, ADC1-CH0 */
CTU_0.CLR[1].A.R = 0x0021; /* single conversion, result to FIFO0, ADC1-CH1 */
CTU_0.CLR[2].A.R = 0x0022; /* single conversion, result to FIFO0, ADC1-CH2 */
CTU_0.CLR[3].A.R = 0x0024; /* single conversion, result to FIFO0, ADC1-CH4 */
CTU_0.CLR[4].A.R = 0x0025; /* single conversion, result to FIFO0, ADC1-CH5 */
CTU_0.CLR[5].A.R = 0x0026; /* single conversion, result to FIFO0, ADC1-CH6 */
CTU_0.CLR[6].A.R = 0x0027; /* single conversion, result to FIFO0, ADC1-CH7 */
CTU_0.CLR[7].A.R = 0x0028; /* single conversion, result to FIFO0, ADC1-CH8 */
CTU_0.CLR[8].A.R = 0x4000; /* last command */

CTU_0.FTH.R = 7; /* FIFO 0 threshold is 7 to accept 8 ADC results */
CTU_0.FCR.R = 4; /* FIFO 0 threshold overflow interrupt enable */

INTC_0.PSR[709].R = 0x800E;

// CTU_0.EFR.R = 0xFFFF;

CTU_0.CR.R = 0x3; /* General reload and TGS input selection reload enable */

 

ADC_1.MCR.R = 0x80020000; /* Enable overwriting older conversion results, ADC clock = half of bus clock (80MHz) */

 

But I observe that ADC_OE bit and ERRCMP bit in EFR register is set,  EOCCH0 of ADC1 is set, conversion result is stored in ADC_1_CDR0, but consecutive channels not triggered. 

 

I parse the CTU chapter and demo for several times and still cannot find the root cause.

please help check what is wrong in my code. what cause the ADC_OE ERROR?

 

thanks in advance.

 

 

 

Outcomes