AnsweredAssumed Answered

Trigger more than 8 ADC channels with PDB

Question asked by Marius Müller on Nov 20, 2018
Latest reply on Dec 5, 2018 by Martin Hoffmann

Hi,

 

I want to trigger more than 8 ADC conversions of ADC module 1 with the PDB1 module with only one software trigger (PDB_DRV_SoftTriggerCmd). I can only get to work either the first 8 ADC channels (with PDB1 CH0) or the remaining "x" ADC channels with (PDB1 CH1).

Is it possible to trigger all 13 ADC conversions of both PDB1 channels with only one trigger.

 

Here is the current configuration.

   

   // PDB 1 init and setup
    PDB_DRV_Init(INST_PDB2, &pdb1_InitConfig0);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB2, 0UL, &pdb2_AdcTrigInitConfig0);  // for ADC1 channel 0
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB2, 0UL, &pdb2_AdcTrigInitConfig1);  // for ADC1 channel 1
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB2, 0UL, &pdb2_AdcTrigInitConfig2);  // for ADC1 channel 2
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB2, 0UL, &pdb2_AdcTrigInitConfig3);  // for ADC1 channel 3
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB2, 0UL, &pdb2_AdcTrigInitConfig4);  // for ADC1 channel 4
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB2, 0UL, &pdb2_AdcTrigInitConfig5);  // for ADC1 channel 5
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB2, 0UL, &pdb2_AdcTrigInitConfig6);  // for ADC1 channel 6
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB2, 0UL, &pdb2_AdcTrigInitConfig7);  // for ADC1 channel 7

 

    PDB_DRV_ConfigAdcPreTrigger(INST_PDB2, 1UL, &pdb2_AdcTrigInitConfig8);  // for ADC1 channel 8
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB2, 1UL, &pdb2_AdcTrigInitConfig9);  // for ADC1 channel 9
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB2, 1UL, &pdb2_AdcTrigInitConfig10); // for ADC1 channel 10
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB2, 1UL, &pdb2_AdcTrigInitConfig11); // for ADC1 channel 11
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB2, 1UL, &pdb2_AdcTrigInitConfig12); // for ADC1 channel 12
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB2, 1UL, &pdb2_AdcTrigInitConfig13); // for ADC1 channel 13

 

    PDB_DRV_SetTimerModulusValue(INST_PDB2, (uint32_t)delayValue);
    PDB_DRV_SetAdcPreTriggerDelayValue(INST_PDB2, 0UL, 0UL, (uint32_t)delayValue);
    PDB_DRV_SetAdcPreTriggerDelayValue(INST_PDB2, 1UL, 0UL, (uint32_t)delayValue);
    PDB_DRV_LoadValuesCmd(INST_PDB2);
    PDB_DRV_SoftTriggerCmd(INST_PDB2);

 

 

// PDB config

const pdb_timer_config_t pdb1_InitConfig = {
  .loadValueMode = PDB_LOAD_VAL_IMMEDIATELY,
  .seqErrIntEnable = false,
  .clkPreDiv = PDB_CLK_PREDIV_BY_2,
  .clkPreMultFactor = PDB_CLK_PREMULT_FACT_AS_10,
  .triggerInput = PDB_SOFTWARE_TRIGGER,
  .continuousModeEnable = false,
  .dmaEnable = false,
  .intEnable = false,
};

 

const pdb_adc_pretrigger_config_t pdb2_AdcTrigInitConfig0 = {
  .adcPreTriggerIdx = 0U,
  .preTriggerEnable = true,
  .preTriggerOutputEnable = true,
  .preTriggerBackToBackEnable = false,
};

 

const pdb_adc_pretrigger_config_t pdb2_AdcTrigInitConfig1 = {
  .adcPreTriggerIdx = 1U,
  .preTriggerEnable = true,
  .preTriggerOutputEnable = true,
  .preTriggerBackToBackEnable = true,
};

 

const pdb_adc_pretrigger_config_t pdb2_AdcTrigInitConfig2 = {
  .adcPreTriggerIdx = 2U,
  .preTriggerEnable = true,
  .preTriggerOutputEnable = true,
  .preTriggerBackToBackEnable = true,
};

 

const pdb_adc_pretrigger_config_t pdb2_AdcTrigInitConfig3 = {
  .adcPreTriggerIdx = 3U,
  .preTriggerEnable = true,
  .preTriggerOutputEnable = true,
  .preTriggerBackToBackEnable = true,
};

 

const pdb_adc_pretrigger_config_t pdb2_AdcTrigInitConfig4 = {
  .adcPreTriggerIdx = 4U,
  .preTriggerEnable = true,
  .preTriggerOutputEnable = true,
  .preTriggerBackToBackEnable = true,
};

 

const pdb_adc_pretrigger_config_t pdb2_AdcTrigInitConfig5 = {
  .adcPreTriggerIdx = 5U,
  .preTriggerEnable = true,
  .preTriggerOutputEnable = true,
  .preTriggerBackToBackEnable = true,
};

 

const pdb_adc_pretrigger_config_t pdb2_AdcTrigInitConfig6 = {
  .adcPreTriggerIdx = 6U,
  .preTriggerEnable = true,
  .preTriggerOutputEnable = true,
  .preTriggerBackToBackEnable = true,
};

 

const pdb_adc_pretrigger_config_t pdb2_AdcTrigInitConfig7 = {
  .adcPreTriggerIdx = 7U,
  .preTriggerEnable = true,
  .preTriggerOutputEnable = true,
  .preTriggerBackToBackEnable = true,
};

 

 

 

const pdb_adc_pretrigger_config_t pdb2_AdcTrigInitConfig8 = {
  .adcPreTriggerIdx = 0U,
  .preTriggerEnable = true,
  .preTriggerOutputEnable = true,
  .preTriggerBackToBackEnable = true,
};

 

const pdb_adc_pretrigger_config_t pdb2_AdcTrigInitConfig9 = {
  .adcPreTriggerIdx = 1U,
  .preTriggerEnable = true,
  .preTriggerOutputEnable = true,
  .preTriggerBackToBackEnable = false,
};

 

const pdb_adc_pretrigger_config_t pdb2_AdcTrigInitConfig10 = {
  .adcPreTriggerIdx = 2U,
  .preTriggerEnable = true,
  .preTriggerOutputEnable = true,
  .preTriggerBackToBackEnable = true,
};

 

const pdb_adc_pretrigger_config_t pdb2_AdcTrigInitConfig11 = {
  .adcPreTriggerIdx = 3U,
  .preTriggerEnable = true,
  .preTriggerOutputEnable = true,
  .preTriggerBackToBackEnable = true,
};

 

const pdb_adc_pretrigger_config_t pdb2_AdcTrigInitConfig12 = {
  .adcPreTriggerIdx = 4U,
  .preTriggerEnable = true,
  .preTriggerOutputEnable = true,
  .preTriggerBackToBackEnable = true,
};

 

const pdb_adc_pretrigger_config_t pdb2_AdcTrigInitConfig13 = {
  .adcPreTriggerIdx = 5U,
  .preTriggerEnable = true,
  .preTriggerOutputEnable = true,
  .preTriggerBackToBackEnable = true,
};

 

 

 

Regards

Marius

Outcomes