Thank you for your reply.
I tried to modify these values in the example that you suggested me for my purpose:
ADC.c:
PCC->PCCn[PCC_ADC0_INDEX] |= PCC_PCCn_PCS(6);
ADC0->CFG2 = ADC_CFG2_SMPLTS(12);
ADC_CFG1_ADIV(4);
PDB.c:
PDB0->MOD = 400;
PDB0->IDLY = 395;
PDB_SC_PRESCALER(0)
PDB_SC_MULT(0)
PDB0->CH[0].DLY[0] = 1;
clock_and_modes.c
void SPLL_init_200MHz(void)
{
SCG->SPLLDIV |= SCG_SPLLDIV_SPLLDIV1(2)|
SCG_SPLLDIV_SPLLDIV2(3);
SCG->SPLLCFG = SCG_SPLLCFG_MULT(34);
SCG->SPLLCFG = SCG_SPLLCFG_PREDIV(1)
}
In that way I think to have set SPLL 200MHz, divided by 4 for ADC input clock for 50MHz (max ADC speed), and set the PDB parameters for 500kHz.
With leds example, it works but I can't read the voltage data. I need to start saving the voltage values when the first dominant bit is detected. I modified the example code like below:
void ADC0_IRQHandler(void)
{
while(((ADC0->SC1[0] & ADC_SC1_COCO_MASK)>>ADC_SC1_COCO_SHIFT) == 0){};
if (ADC0->R[0] < 1638){
for (int i=0; i<110; i++)
{
vectors.Buffer_Low[i] = ADC0->R[0];
while(((ADC0->SC1[0] & ADC_SC1_COCO_MASK)>>ADC_SC1_COCO_SHIFT) == 0){};
}
I supposed that the for cycle dosen't work.
Is there that I'm mistaking?
Thank you for your help.