Why can't I use pdb to trigger 8 adc0 channels? Is there a problem with my configuration? I can trigger adc normally when I use only 6 channels through pdb, but I can't trigger access interrupt once more than 6 channels are used, and 6 can only be triggered when the sampling time is set to 1? Using other samples will not work (I have tried 0-20,24,36, 72,255, etc.) I set the sample time to 12 and can only trigger 4 normally, here is my configuration code:
adc0
pdb0
adc1
pdb1
code
void ADC0_IRQHandler(void)
{
if(ADC_DRV_GetConvCompleteFlag(INST_ADCONV0,ADC_POC2) == true)
{
/* Get channel result from ADC channel */
ADC_DRV_GetChanResult(INST_ADCONV0, ADC_POC2, (uint16_t *)&g_ADC_Val[ADC_POC2].adcRawValue);
}
if(ADC_DRV_GetConvCompleteFlag(INST_ADCONV0,ADC_POC1) == true)
{
/* Get channel result from ADC channel */
ADC_DRV_GetChanResult(INST_ADCONV0, ADC_POC1, (uint16_t *)&g_ADC_Val[ADC_POC1].adcRawValue);
}
if(ADC_DRV_GetConvCompleteFlag(INST_ADCONV0,ADC_CAM) == true)
{
/* Get channel result from ADC channel */
ADC_DRV_GetChanResult(INST_ADCONV0,ADC_CAM, (uint16_t *)&g_ADC_Val[ADC_CAM].adcRawValue);
}
if(ADC_DRV_GetConvCompleteFlag(INST_ADCONV0,ADC_VCSEL) == true)
{
/* Get channel result from ADC channel */
ADC_DRV_GetChanResult(INST_ADCONV0, ADC_VCSEL, (uint16_t *)&g_ADC_Val[ADC_VCSEL].adcRawValue);
}
if(ADC_DRV_GetConvCompleteFlag(INST_ADCONV0,ADC_POC3) == true)
{
/* Get channel result from ADC channel */
ADC_DRV_GetChanResult(INST_ADCONV0, ADC_POC3, (uint16_t *)&g_ADC_Val[ADC_POC3].adcRawValue);
}
if(ADC_DRV_GetConvCompleteFlag(INST_ADCONV0,ADC_SCREEN) == true)
{
/* Get channel result from ADC channel */
ADC_DRV_GetChanResult(INST_ADCONV0,ADC_SCREEN, (uint16_t *)&g_ADC_Val[ADC_SCREEN].adcRawValue);
}
if(ADC_DRV_GetConvCompleteFlag(INST_ADCONV0,ADC_LIGHT) == true)
{
/* Get channel result from ADC channel */
ADC_DRV_GetChanResult(INST_ADCONV0, ADC_LIGHT, (uint16_t *)&g_ADC_Val[ADC_LIGHT].adcRawValue);
}
if(ADC_DRV_GetConvCompleteFlag(INST_ADCONV0,ADC_RADAR) == true)
{
/* Get channel result from ADC channel */
ADC_DRV_GetChanResult(INST_ADCONV0, ADC_RADAR, (uint16_t *)&g_ADC_Val[ADC_RADAR].adcRawValue);
}
}
void ADC1_IRQHandler(void)
{
if(ADC_DRV_GetConvCompleteFlag(INST_ADCONV1, 0) == true)
{
/* Get channel result from ADC channel */
ADC_DRV_GetChanResult(INST_ADCONV1, 0, (uint16_t *)&g_ADC_Val[ADC_PWR_IN].adcRawValue);
}
if(ADC_DRV_GetConvCompleteFlag(INST_ADCONV1, 1) == true)
{
/* Get channel result from ADC channel */
ADC_DRV_GetChanResult(INST_ADCONV1, 1, (uint16_t *)&g_ADC_Val[ADC_MCU_SENSOR].adcRawValue);
}
}
static void ADC0_Init(void)
{
g_ADC_Val[ADC_POC2].conf = (adc_chan_config_t*)&adConv0_ChnConfig0;
g_ADC_Val[ADC_POC1].conf = (adc_chan_config_t*)&adConv0_ChnConfig1;
g_ADC_Val[ADC_CAM].conf = (adc_chan_config_t*)&adConv0_ChnConfig2;
g_ADC_Val[ADC_VCSEL].conf = (adc_chan_config_t*)&adConv0_ChnConfig3;
g_ADC_Val[ADC_POC3].conf = (adc_chan_config_t*)&adConv0_ChnConfig4;
g_ADC_Val[ADC_SCREEN].conf = (adc_chan_config_t*)&adConv0_ChnConfig5;
g_ADC_Val[ADC_LIGHT].conf = (adc_chan_config_t*)&adConv0_ChnConfig6;
g_ADC_Val[ADC_RADAR].conf = (adc_chan_config_t*)&adConv0_ChnConfig7;
/* Initialize the module and self-calibrate it */
ADC_DRV_ConfigConverter(INST_ADCONV0, &adConv0_ConvConfig0);
ADC_DRV_AutoCalibration(INST_ADCONV0);
/* Setting the ADC channel */
ADC_DRV_ConfigChan(INST_ADCONV0,ADC_POC2,g_ADC_Val[ADC_POC2].conf);
ADC_DRV_ConfigChan(INST_ADCONV0,ADC_POC1,g_ADC_Val[ADC_POC1].conf);
ADC_DRV_ConfigChan(INST_ADCONV0,ADC_CAM,g_ADC_Val[ADC_CAM].conf);
ADC_DRV_ConfigChan(INST_ADCONV0,ADC_VCSEL,g_ADC_Val[ADC_VCSEL].conf);
ADC_DRV_ConfigChan(INST_ADCONV0,ADC_POC3,g_ADC_Val[ADC_POC3].conf);
ADC_DRV_ConfigChan(INST_ADCONV0,ADC_SCREEN,g_ADC_Val[ADC_SCREEN].conf);
ADC_DRV_ConfigChan(INST_ADCONV0,ADC_LIGHT,g_ADC_Val[ADC_LIGHT].conf);
ADC_DRV_ConfigChan(INST_ADCONV0,ADC_RADAR,g_ADC_Val[ADC_RADAR].conf);
INT_SYS_InstallHandler(ADC0_IRQn, &ADC0_IRQHandler, (isr_t*) 0);
INT_SYS_EnableIRQ(ADC0_IRQn);
}
static void ADC1_Init(void)
{
g_ADC_Val[ADC_PWR_IN].conf = (adc_chan_config_t*)&adConv1_ChnConfig0;
g_ADC_Val[ADC_MCU_SENSOR].conf = (adc_chan_config_t*)&adConv1_ChnConfig1;
ADC_DRV_ConfigConverter(INST_ADCONV1, &adConv1_ConvConfig0);
ADC_DRV_AutoCalibration(INST_ADCONV1);
ADC_DRV_ConfigChan(INST_ADCONV1, 0, g_ADC_Val[ADC_PWR_IN].conf);
ADC_DRV_ConfigChan(INST_ADCONV1, 1, g_ADC_Val[ADC_MCU_SENSOR].conf);
INT_SYS_InstallHandler(ADC1_IRQn, &ADC1_IRQHandler, (isr_t*) 0);
INT_SYS_EnableIRQ(ADC1_IRQn);
}
static void PDB0_init(void)
{
PDB_DRV_Init(INST_PDB0, &pdb0_InitConfig0);
PDB_DRV_Enable(INST_PDB0);
PDB_DRV_ConfigAdcPreTrigger(INST_PDB0, 0, &pdb0_AdcTrigInitConfig0);
PDB_DRV_ConfigAdcPreTrigger(INST_PDB0, 0, &pdb0_AdcTrigInitConfig1);
PDB_DRV_ConfigAdcPreTrigger(INST_PDB0, 0, &pdb0_AdcTrigInitConfig2);
PDB_DRV_ConfigAdcPreTrigger(INST_PDB0, 0, &pdb0_AdcTrigInitConfig3);
PDB_DRV_ConfigAdcPreTrigger(INST_PDB0, 0, &pdb0_AdcTrigInitConfig4);
PDB_DRV_ConfigAdcPreTrigger(INST_PDB0, 0, &pdb0_AdcTrigInitConfig5);
PDB_DRV_ConfigAdcPreTrigger(INST_PDB0, 0, &pdb0_AdcTrigInitConfig6);
PDB_DRV_ConfigAdcPreTrigger(INST_PDB0, 0, &pdb0_AdcTrigInitConfig7);
PDB_DRV_SetTimerModulusValue(INST_PDB0,(uint32_t) sg_PDBcounter);
PDB_DRV_SetAdcPreTriggerDelayValue(INST_PDB0, INST_ADCONV0, 0UL,(uint32_t) 1);
PDB_DRV_LoadValuesCmd(INST_PDB0);
PDB_DRV_SoftTriggerCmd(INST_PDB0);
}
static void PDB1_init(void)
{
PDB_DRV_Init(INST_PDB1, &pdb1_InitConfig0);
PDB_DRV_Enable(INST_PDB1);
PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 0, &pdb1_AdcTrigInitConfig0);
PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 0, &pdb1_AdcTrigInitConfig1);
PDB_DRV_SetTimerModulusValue(INST_PDB1,(uint32_t) sg_PDBcounter);
PDB_DRV_SetAdcPreTriggerDelayValue(INST_PDB1, 0, 0UL,(uint32_t) 20 );
PDB_DRV_LoadValuesCmd(INST_PDB1);
PDB_DRV_SoftTriggerCmd(INST_PDB1);
}
The above code adc1 can be polling normally triggered, but adc0 can never trigger 8.