AnsweredAssumed Answered

PDB adc trigger issue

Question asked by Gnichi Mohamed on Nov 3, 2016
Latest reply on Nov 9, 2016 by Robin_Shen

Hello

I am trying to trigger two adc channels from pdb on the K02.

Here us my code so far

 

SIM->SCGC6|=SIM_SCGC6_PDB(1);// enable clock for pdb
PDB0->SC|=PDB_SC_TRGSEL(0xF)     |//soft trigger
                      PDB_SC_PRESCALER(1) |
                      PDB_SC_MULT(0) |
                      PDB_SC_CONT_MASK |PDB_SC_PDBIE_MASK|
                      PDB_SC_PDBEN(1);

PDB0->CH[0].C1|=PDB_C1_BB(0x02) |PDB_C1_EN(0x03);
PDB0->MOD=2000;
PDB0->IDLY=2000;
PDB0->SC |= PDB_SC_LDOK_MASK;
SIM->SCGC6 |= SIM_SCGC6_ADC0_MASK; //enable clock for ADC0
ADC0->SC2 |=ADC_SC2_ADTRG_MASK;
ADC0->SC1[0]=ADC_SC1_ADCH(0x11);//ADC0CH11
ADC0->SC1[1]=ADC_SC1_ADCH(0x5);//ADC0CH5
ADC0->SC1[1]|=ADC_SC1_AIEN_MASK;
ADC0->CFG1 |=ADC_CFG1_MODE(0x03);

EnableIRQ(ADC0_IRQn);
NVIC_SetPriority(ADC0_IRQn, 0);
EnableIRQ(PDB0_IRQn);
NVIC_SetPriority(PDB0_IRQn, 1);
PDB0->SC |=PDB_SC_SWTRIG_MASK|PDB_SC_LDOK_MASK;

 

 

The problem is i can get the pdb interrupt to occur but the ADC interrupt seems to happen only ones at the start.
Thanks for the help.

Outcomes