Hi,
Sorry for the delay,
I just tried the below simple code and debugging with IAR I notice that both ADC_R0 and ARC_R1 are working with the PDB:
Please refer to it and let me know if that helps.
int main()
{
printf("Hello World!\n");
/*Enable ADC and PDB clocks*/
/*PDB setup Clocks*/
CCM->CCGR1 |= CCM_CCGR1_CG6(3);
/*ADC0 Clock*/
CCM->CCGR1 |= CCM_CCGR1_CG11(3);
/*Select one External Hardware Trigger*/
SRC->MISC1 &= ~(SRC_MISC1_MISC1_29_MASK);
SRC->MISC1 &= ~(SRC_MISC1_MISC1_28_MASK);//|= (SRC_MISC1_MISC1_28_MASK);
PDB->SC = PDB_SC_CONT_MASK // Contintuous, rather than one-shot, mode
| PDB_SC_PDBEN_MASK // PDB enabled
| PDB_SC_PRESCALER(0x5) // Slow down the period of the PDB for testing
| PDB_SC_TRGSEL(0xf) // Trigger source is Software Trigger to be invoked in this file
| PDB_SC_MULT(2); // Multiplication factor 20 for the prescale divider for the counter clock
PDB->IDLY = 0x0000;
PDB->MOD = 0XFFFF;
// channel 0 pretrigger 0 and 1 enabled and delayed
PDB->CH[0].C1 = PDB_C1_EN(0x01)
| PDB_C1_TOS(0x01)
| PDB_C1_EN(0x02)
| PDB_C1_TOS(0x02) ;
PDB->CH[0].DLY[0] = ADC0_DLYA ;
PDB->CH[0].DLY[1] = ADC0_DLYB ;
PDB->SC = PDB_SC_CONT_MASK // Contintuous, rather than one-shot, mode
| PDB_SC_PDBEN_MASK // PDB enabled
| PDB_SC_PDBIE_MASK // PDB Interrupt Enable
| PDB_SC_PRESCALER(0x5) // Slow down the period of the PDB for testing
| PDB_SC_TRGSEL(0xf) // Trigger source is Software Trigger to be invoked in this file
| PDB_SC_MULT(2) // Multiplication factor 20 for the prescale divider for the counter clock
| PDB_SC_LDOK_MASK; // Need to ok the loading or it will not load certain regsiters!
// the software trigger, PDB_SC_SWTRIG_MASK is not triggered at this time.
/*Enable Hardware Trigger*/
ADC0->CFG |= ADC_CFG_ADTRG_MASK;
/**/
ADC0->HC[0] = ADC0_CHANA;
ADC0->HC[1] = ADC0_CHANB;
PDB->SC |= PDB_SC_SWTRIG_MASK ;
for(;;)
{
while(!(ADC0->HS & (ADC_HS_COCO0_MASK)));
asm("nop");
while(!(ADC0->HS & (ADC_HS_COCO1_MASK)));
asm("nop");
}
return 0;
}