Hi Peter,
I had the same problem as Max Lee ,but by studying the two routines you provided, but no configuration errors were found.Here is my code.I just need to get three ADC.
void CTU_Init(void)
{
/* Enable input */
CTU_0.TGSISR.R = 0x00000001; /*I1_RE*/
/* Compare registers */
CTU_0.TCR[0].R = 160;
/* Counter */
CTU_0.TGSCCR.R = 4000;
CTU_0.TGSCRR.R = 0;
CTU_0.TGSCR.R = 0x0100; /* Prescaler Value is 1 and Triggered Mode */
/* Enable triggers */
CTU_0.THCR1.R = 0x00000061; /* Enable Triger 0 and set to ADC */
/* Set ADC messages */
CTU_0.CLR[0].A.R = 0x4000;/* Command 0 - last command in command sequence,sample ADC0-CH0, result to FIFO0 */
CTU_0.CLR[1].A.R = 0x0002;/* Command 1 - first command in command sequence, sample ADC0-CH2, result to FIFO0 */
CTU_0.CLR[2].A.R = 0x0007;/* Command 2 - next command in command sequence,sample ADC0-CH7, result to FIFO0 */
CTU_0.CLR[3].A.R = 0x4000; /* stop the sequence, first command of second sequence which is not started */
CTU_0.FTH.R = 0x00000002; /* set FIFO 0 threshold to 2, overflow is set when 3 results comes */
CTU_0.FCR.R = 0x00000004; /* FIFO 0 threshold overflow interrupt enable */
CTU_0.CR.R = 0x0003; /* General reload and TGS input selection reload */
}
void FUN_HW_CTU_FIFO0_INTC(void)
{
uint32_t fifo_status;
fifo_status = CTU_0.FST.R & 0xf;
if (fifo_status == 4) // if overflow
{
HW_AD_CRTA_u16 = (u16) (CTU_0.FR[0].R & 0xfff);//ADC_0.CDR[0].B.CDATA;
HW_AD_CRTC_u16 = (u16) (CTU_0.FR[0].R & 0xfff);//ADC_0.CDR[2].B.CDATA
HW_AD_CRTB_u16 = (u16) (CTU_0.FR[0].R & 0xfff);//ADC_0.CDR[7].B.CDATA;
CTU_0.CR.B.GRE = 1; // CTU General Reload Enable
}
if (fifo_status == 8) // if overrun
{
CTU_0.FST.R = 8; // clear overrun flag
}
CTU_EFR = CTU_0.EFR.R;
}