Trigger more than 8 ADC channels with PDB

cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger more than 8 ADC channels with PDB

Jump to solution
569 Views
Contributor I

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

0 Kudos
1 Solution
122 Views
Contributor II

Yes!

But the first entry of PDB Channel 1 has to have an explicit trigger time (no back-to-back possible for the first entry, the remaining 7 entries of the channel 1 list can be set to back-to-back again).

Take care: The first trigger time of channel 1 has to be after the last measurement of PDB channel 0.

BR

Martin

View solution in original post

0 Kudos
4 Replies
122 Views
NXP TechSupport
NXP TechSupport

Hi Marius,

This is not possible, but you can chain PDB0 CH0 and PDB1 CH0 when SIM_CHIPCTL[PDB_BB_SEL] = 1.
Please see Figure 44-3 and Figure 44-4 in the RM rev.9.

Regards,
Daniel

0 Kudos
122 Views
Contributor I

Hi Daniel,

thank you for your reply. In this case, I would like to re-phrase my question.

How is it possible to trigger more than 8 ADC channels of one ADC module using one PDB module (with channel 0 and 1) using software trigger and back-to-back mode.

Regards,

Marius

0 Kudos
123 Views
Contributor II

Yes!

But the first entry of PDB Channel 1 has to have an explicit trigger time (no back-to-back possible for the first entry, the remaining 7 entries of the channel 1 list can be set to back-to-back again).

Take care: The first trigger time of channel 1 has to be after the last measurement of PDB channel 0.

BR

Martin

View solution in original post

0 Kudos
122 Views
Contributor I

I have the same needs.
I tried to change the trigger time as you said. When the trigger time is changed to 4000, only ADC1->RA to ADC1->RH have data. When the trigger time is changed to 3500, there is no data in ADC1->RA to ADC1->RH, and ADC1->RI has data.
I don't know where the problem is, can you help me see it?

0 Kudos