Example S32K144 PDB ADC DMA S32DS.ARM.2018.R1

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Example S32K144 PDB ADC DMA S32DS.ARM.2018.R1

Example S32K144 PDB ADC DMA S32DS.ARM.2018.R1

/********************************************************************************
Detailed Description:

Example shows possible implementation of multiple ADC conversions using SDK.
Here 25 channels are sampled periodically. 

2 ADC modules and 2 PDBs are used.
ADC0 is configured to sample 16 channels, ADC1 9 channels.
PDBs are set to back-to-back mode to perform chain conversion.
Within ADC component you need to select ADC input to be measured for each item
in configuration list. For ADC0 channels ADC ch12 is selected, as it is connected
to trimmer on the EVB.
DMA is used to read result into single buffer, and DMA callbacks are issued
to indicate end of transfer for each ADC module.
Within those callbacks PTE14 and PTE15 is toggled.
PDB0 output pulse is generated on the PTE16 to indicate start of ADC measurement.
This is done periodically at LPIT ch0 rate, which is set to 30us.

The ADC0 ch0 result is used to dim LEDs.


* ------------------------------------------------------------------------------
* Test HW:       S32K144EVB-Q100
* MCU:           FS32K144UAVLL 0N57U
* Target:        Debug_FLASH
* EVB connection:
* Compiler:      S32DS.ARM.2018.R1
* SDK release:   S32SDK_S32K1xx_RTM_3.0.0
* Debugger:      Lauterbach Trace32
********************************************************************************
Revision History:
Ver Date          Author          Description of Changes
0.1 May-04-2019   Petr Stancik    Initial version
*******************************************************************************/
Labels (1)
Attachments
Comments

Many thanks, I am debugging multiple adc channels and dma transfer!

This example is just what i need! This speeds up my application development a lot!
I am using 3 channels on ADC0 and 30 channels from ADC1 on S32K148. This example is using ADC R register array, which has size of 16. What would be correct way to set this up?  Using aR registers?


edit:

Nevermind, i got it working using aR registers.

I am using PDLY_TIMEOUT with value 50UL on app_init.h and LPIT timer period of 400, so buffer gets update at rate of 20KHz.

Only using ch0 on PDB0, and using channels 0,1,2 and 3 on PDB1, each channel triggered 10µs after another.

app_init.c looks like this:

#include "app_init.h"
void PDB0_init(void);
void PDB1_init(void);


uint16_t delayValue;
extern uint16_t buffer[33];
extern uint16_t value;

/* configuration structures for simple loop transfers */
edma_loop_transfer_config_t loopConfig = {
    .majorLoopIterationCount = 0,
    .srcOffsetEnable = false,
    .dstOffsetEnable = false,
    .minorLoopOffset = 0,
    .minorLoopChnLinkEnable = false,
    .minorLoopChnLinkNumber = 0,
    .majorLoopChnLinkEnable = false,
    .majorLoopChnLinkNumber = 0
};

edma_transfer_config_t transferConfig = {
    .srcAddr = 0,
    .destAddr = 0,
    .srcTransferSize = EDMA_TRANSFER_SIZE_2B,
    .destTransferSize = EDMA_TRANSFER_SIZE_2B,
    .srcOffset= 4,
    .destOffset = 2,
    .srcLastAddrAdjust = 0,
    .destLastAddrAdjust = 0,
    .srcModulo = EDMA_MODULO_OFF,
    .destModulo = EDMA_MODULO_OFF,
    .minorByteTransferCount = 2,
    .scatterGatherEnable = false,
    .scatterGatherNextDescAddr = 0,
    .interruptEnable = true,
    .loopTransferConfig = &loopConfig
};


void ADC0_Init(void)
{
    ADC_DRV_AutoCalibration(INST_ADCONV0);

    ADC_DRV_ConfigConverter(INST_ADCONV0, &adConv0_ConvConfig0);

    ADC_DRV_ConfigChan(INST_ADCONV0, 0UL, &adConv0_ChnConfig0);
    ADC_DRV_ConfigChan(INST_ADCONV0, 1UL, &adConv0_ChnConfig1);
    ADC_DRV_ConfigChan(INST_ADCONV0, 2UL, &adConv0_ChnConfig2);
}

void ADC1_Init(void)
{
    ADC_DRV_AutoCalibration(INST_ADCONV1);

    ADC_DRV_ConfigConverter(INST_ADCONV1, &adConv1_ConvConfig0);

    ADC_DRV_ConfigChan(INST_ADCONV1, 0UL, &adConv1_ChnConfig0);
    ADC_DRV_ConfigChan(INST_ADCONV1, 1UL, &adConv1_ChnConfig1);
    ADC_DRV_ConfigChan(INST_ADCONV1, 2UL, &adConv1_ChnConfig2);
    ADC_DRV_ConfigChan(INST_ADCONV1, 3UL, &adConv1_ChnConfig3);
    ADC_DRV_ConfigChan(INST_ADCONV1, 4UL, &adConv1_ChnConfig4);
    ADC_DRV_ConfigChan(INST_ADCONV1, 5UL, &adConv1_ChnConfig5);
    ADC_DRV_ConfigChan(INST_ADCONV1, 6UL, &adConv1_ChnConfig6);
    ADC_DRV_ConfigChan(INST_ADCONV1, 7UL, &adConv1_ChnConfig7);
    ADC_DRV_ConfigChan(INST_ADCONV1, 8UL, &adConv1_ChnConfig8);
    ADC_DRV_ConfigChan(INST_ADCONV1, 9UL, &adConv1_ChnConfig9);
    ADC_DRV_ConfigChan(INST_ADCONV1, 10UL, &adConv1_ChnConfig10);
    ADC_DRV_ConfigChan(INST_ADCONV1, 11UL, &adConv1_ChnConfig11);
    ADC_DRV_ConfigChan(INST_ADCONV1, 11UL, &adConv1_ChnConfig11);
    ADC_DRV_ConfigChan(INST_ADCONV1, 12UL, &adConv1_ChnConfig12);
    ADC_DRV_ConfigChan(INST_ADCONV1, 13UL, &adConv1_ChnConfig13);
    ADC_DRV_ConfigChan(INST_ADCONV1, 14UL, &adConv1_ChnConfig14);
    ADC_DRV_ConfigChan(INST_ADCONV1, 15UL, &adConv1_ChnConfig15);
    ADC_DRV_ConfigChan(INST_ADCONV1, 16UL, &adConv1_ChnConfig16);
    ADC_DRV_ConfigChan(INST_ADCONV1, 17UL, &adConv1_ChnConfig17);
    ADC_DRV_ConfigChan(INST_ADCONV1, 18UL, &adConv1_ChnConfig18);
    ADC_DRV_ConfigChan(INST_ADCONV1, 19UL, &adConv1_ChnConfig19);
    ADC_DRV_ConfigChan(INST_ADCONV1, 20UL, &adConv1_ChnConfig20);
    ADC_DRV_ConfigChan(INST_ADCONV1, 21UL, &adConv1_ChnConfig21);
    ADC_DRV_ConfigChan(INST_ADCONV1, 22UL, &adConv1_ChnConfig22);
    ADC_DRV_ConfigChan(INST_ADCONV1, 23UL, &adConv1_ChnConfig23);
    ADC_DRV_ConfigChan(INST_ADCONV1, 24UL, &adConv1_ChnConfig24);
    ADC_DRV_ConfigChan(INST_ADCONV1, 25UL, &adConv1_ChnConfig25);
    ADC_DRV_ConfigChan(INST_ADCONV1, 26UL, &adConv1_ChnConfig26);
    ADC_DRV_ConfigChan(INST_ADCONV1, 27UL, &adConv1_ChnConfig27);
    ADC_DRV_ConfigChan(INST_ADCONV1, 28UL, &adConv1_ChnConfig28);
    ADC_DRV_ConfigChan(INST_ADCONV1, 29UL, &adConv1_ChnConfig29);
}

void PDB0_init()
{
    PDB_DRV_Init(INST_PDB0, &pdb0_InitConfig0);
    PDB_DRV_Enable(INST_PDB0);

    // config 8 pretriggers on ch0 based on component setting
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB0, 0UL, &pdb0_AdcTrigInitConfig0);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB0, 0UL, &pdb0_AdcTrigInitConfig1);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB0, 0UL, &pdb0_AdcTrigInitConfig2);


    // set PDB0 counter period to delayValue
    PDB_DRV_SetTimerModulusValue(INST_PDB0, (uint32_t) delayValue);
    // set ch0 trigger0 delay to happen immediate upon Trigger_In 0 (PIT0 ch0)
    PDB_DRV_SetAdcPreTriggerDelayValue(INST_PDB0, 0UL, 0UL,(uint32_t) (1));
    PDB_DRV_SetCmpPulseOutDelayForHigh(INST_PDB0, 0L , 0);
    PDB_DRV_SetCmpPulseOutDelayForLow(INST_PDB0, 0L, delayValue/PDLY_TIMEOUT);
    PDB_DRV_SetCmpPulseOutEnable(INST_PDB0, 1<<0, true);
    PDB_DRV_LoadValuesCmd(INST_PDB0);

}

void PDB1_init()
{
    PDB_DRV_Init(INST_PDB1, &pdb1_InitConfig0);
    PDB_DRV_Enable(INST_PDB1);

    // config 8 pretriggers on ch0 based on component setting
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 0UL , &pdb1_AdcTrigInitConfig0);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 0UL , &pdb1_AdcTrigInitConfig1);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 0UL , &pdb1_AdcTrigInitConfig2);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 0UL , &pdb1_AdcTrigInitConfig3);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 0UL , &pdb1_AdcTrigInitConfig4);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 0UL , &pdb1_AdcTrigInitConfig5);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 0UL , &pdb1_AdcTrigInitConfig6);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 0UL , &pdb1_AdcTrigInitConfig7);
    // config 8 pretrigger on ch1 based on component setting
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 1UL , &pdb1_AdcTrigInitConfig0);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 1UL , &pdb1_AdcTrigInitConfig1);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 1UL , &pdb1_AdcTrigInitConfig2);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 1UL , &pdb1_AdcTrigInitConfig3);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 1UL , &pdb1_AdcTrigInitConfig4);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 1UL , &pdb1_AdcTrigInitConfig5);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 1UL , &pdb1_AdcTrigInitConfig6);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 1UL , &pdb1_AdcTrigInitConfig7);
    // config 8 pretrigger on ch2 based on component setting
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 2UL , &pdb1_AdcTrigInitConfig0);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 2UL , &pdb1_AdcTrigInitConfig1);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 2UL , &pdb1_AdcTrigInitConfig2);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 2UL , &pdb1_AdcTrigInitConfig3);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 2UL , &pdb1_AdcTrigInitConfig4);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 2UL , &pdb1_AdcTrigInitConfig5);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 2UL , &pdb1_AdcTrigInitConfig6);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 2UL , &pdb1_AdcTrigInitConfig7);
    // config 6 pretrigger on ch3 based on component setting
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 3UL , &pdb1_AdcTrigInitConfig0);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 3UL , &pdb1_AdcTrigInitConfig1);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 3UL , &pdb1_AdcTrigInitConfig2);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 3UL , &pdb1_AdcTrigInitConfig3);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 3UL , &pdb1_AdcTrigInitConfig4);
    PDB_DRV_ConfigAdcPreTrigger(INST_PDB1, 3UL , &pdb1_AdcTrigInitConfig5);


    // set PDB1 counter period to delayValue (~30us)
    PDB_DRV_SetTimerModulusValue(INST_PDB1,(uint32_t) delayValue);
    // set ch0 trigger delay to happen immediate upon Trigger_In 0 (PIT0 ch0)
    PDB_DRV_SetAdcPreTriggerDelayValue(INST_PDB1, 0UL , 0UL , (uint32_t) (1));
    // set ch1 trigger0 delay to happen 10us upon Trigger_In 0 (PIT0 ch0)
    PDB_DRV_SetAdcPreTriggerDelayValue(INST_PDB1, 1UL , 0UL , (uint32_t) (10*delayValue/PDLY_TIMEOUT));
    // set ch2 trigger0 delay to happen 20us upon Trigger_In 0 (PIT0 ch0)
    PDB_DRV_SetAdcPreTriggerDelayValue(INST_PDB1, 2UL , 0UL , (uint32_t) (20*delayValue/PDLY_TIMEOUT));
    // set ch3 trigger0 delay to happen 30us upon Trigger_In 0 (PIT0 ch0)
    PDB_DRV_SetAdcPreTriggerDelayValue(INST_PDB1, 3UL , 0UL , (uint32_t) (30*delayValue/PDLY_TIMEOUT));

    PDB_DRV_LoadValuesCmd(INST_PDB1);


}

/* This function triggers a loop memory-to-memory transfer. */
void triggerLoopTransfer(uint8_t channel, uint8_t * srcBuff, uint16_t * dstBuff, uint32_t size)
{
    //transferComplete = false;

    dma_request_source_t DmaReq;

    /* configure transfer source and destination addresses */
    transferConfig.srcAddr                 = (uint32_t)srcBuff;
    transferConfig.destAddr             = (uint32_t)dstBuff;
    transferConfig.srcLastAddrAdjust     = -(4*size);
    transferConfig.destLastAddrAdjust    = -(2*size);
    loopConfig.majorLoopIterationCount    = size;

    if(channel == 0)
    {
        DmaReq = EDMA_REQ_ADC0;
    }
    else
    {
        DmaReq = EDMA_REQ_ADC1;
    }

    /* configure the eDMA channel for a loop transfer (via transfer configuration structure */
    EDMA_DRV_ConfigLoopTransfer(channel, &transferConfig);

    /* select hw request */
    EDMA_DRV_SetChannelRequestAndTrigger(channel, DmaReq, false);

    /* start the channel */
    EDMA_DRV_StartChannel(channel);
}

// DMA channel0 callback
void DMA_ADC0_CHANNEL0(void *parameter, edma_chn_status_t status)
{
    (void)status;
    (void)parameter;

    value = buffer[0];

    PINS_DRV_SetPins(PTE,1<<14);
    PINS_DRV_ClearPins(PTE,1<<14);

}

// DMA channel1 callback
void DMA_ADC1_CHANNEL1(void *parameter, edma_chn_status_t status)
{
    (void)status;
    (void)parameter;

    PINS_DRV_SetPins(PTE,1<<15);
    PINS_DRV_ClearPins(PTE,1<<15);

}

void DMA_Init(void)
{
    EDMA_DRV_Init(&dmaController1_State, &dmaController1_InitConfig0, edmaChnStateArray, edmaChnConfigArray, EDMA_CONFIGURED_CHANNELS_COUNT);

    // set DMA ch0 to read first 3 ADC0 Results registers and move it to buffer array starting from 1st element
    triggerLoopTransfer(DMA_CHANNEL0, (uint8_t *)&(ADC0->aR[0]),buffer, 3);
    // set DMA ch1 to read first 30 ADC1 Results registers and move it to buffer array starting from 4th element
    triggerLoopTransfer(DMA_CHANNEL1, (uint8_t *)&(ADC1->aR[0]),&buffer[3],30);
}


void app_init(void)
{

    ADC0_Init();
    ADC1_Init();

    if(!calculateIntValue(&pdb0_InitConfig0, PDLY_TIMEOUT, &delayValue))
    {
        /* Stop the application flow */
        while(1);
    }

    PDB0_init();
    PDB1_init();

    DMA_Init();

    // Initialize TRGMUX to route LPIT0 ch0 trigger to both PDBs and PDB's OUT pulse to TRGMUX out7
    TRGMUX_DRV_Init(INST_TRGMUX1, &trgmux1_InitConfig0);

    // Initialize LPIT instance 0. Reset and enable peripheral
    LPIT_DRV_Init(INST_LPIT1, &lpit1_InitConfig);
    // Initialize LPIT channel 0 to generate trigger for PDB via TRGMUX
    LPIT_DRV_InitChannel(INST_LPIT1, 0, &lpit1_ChnConfig0);
    // Start LPIT0 channel 0 counter
    LPIT_DRV_StartTimerChannels(INST_LPIT1, 1);


}


Thanks,
Jani

%3CLINGO-SUB%20id%3D%22lingo-sub-1101686%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EExample%20S32K144%20PDB%20ADC%20DMA%20S32DS.ARM.2018.R1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1101686%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CPRE%3E%2F********************************************************************************%0ADetailed%20Description%3A%0A%0AExample%20shows%20possible%20implementation%20of%20multiple%20ADC%20conversions%20using%20SDK.%0AHere%2025%20channels%20are%20sampled%20periodically.%20%0A%0A2%20ADC%20modules%20and%202%20PDBs%20are%20used.%0AADC0%20is%20configured%20to%20sample%2016%20channels%2C%20ADC1%209%20channels.%0APDBs%20are%20set%20to%20back-to-back%20mode%20to%20perform%20chain%20conversion.%0AWithin%20ADC%20component%20you%20need%20to%20select%20ADC%20input%20to%20be%20measured%20for%20each%20item%0Ain%20configuration%20list.%20For%20ADC0%20channels%20ADC%20ch12%20is%20selected%2C%20as%20it%20is%20connected%0Ato%20trimmer%20on%20the%20EVB.%0ADMA%20is%20used%20to%20read%20result%20into%20single%20buffer%2C%20and%20DMA%20callbacks%20are%20issued%0Ato%20indicate%20end%20of%20transfer%20for%20each%20ADC%20module.%0AWithin%20those%20callbacks%20PTE14%20and%20PTE15%20is%20toggled.%0APDB0%20output%20pulse%20is%20generated%20on%20the%20PTE16%20to%20indicate%20start%20of%20ADC%20measurement.%0AThis%20is%20done%20periodically%20at%20LPIT%20ch0%20rate%2C%20which%20is%20set%20to%2030us.%0A%0AThe%20ADC0%20ch0%20result%20is%20used%20to%20dim%20LEDs.%0A%0A%0A*%20------------------------------------------------------------------------------%0A*%20Test%20HW%3A%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BS32K144EVB-Q100%0A*%20MCU%3A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BFS32K144UAVLL%200N57U%0A*%20Target%3A%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Debug_FLASH%0A*%20EVB%20connection%3A%0A*%20Compiler%3A%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BS32DS.ARM.2018.R1%0A*%20SDK%20release%3A%20%26nbsp%3B%26nbsp%3BS32SDK_S32K1xx_RTM_3.0.0%0A*%20Debugger%3A%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%20Lauterbach%20Trace32%0A********************************************************************************%0ARevision%20History%3A%0AVer%20Date%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BAuthor%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BDescription%20of%20Changes%0A0.1%20May-04-2019%20%26nbsp%3B%26nbsp%3BPetr%20Stancik%20%26nbsp%3B%26nbsp%3B%26nbsp%3BInitial%20version%0A*******************************************************************************%2F%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1101686%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EGeneral%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1101688%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Example%20S32K144%20PDB%20ADC%20DMA%20S32DS.ARM.2018.R1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1101688%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThis%20example%20is%20just%20what%20i%20need!%20This%20speeds%20up%20my%20application%20development%20a%20lot!%3CBR%20%2F%3EI%20am%20using%26nbsp%3B3%20channels%20on%20ADC0%20and%2030%20channels%20from%20ADC1%20on%20S32K148.%20This%20example%20is%20using%20ADC%20R%20register%20array%2C%20which%20has%20size%20of%2016.%20What%20would%20be%20correct%20way%20to%20set%20this%20up%3F%26nbsp%3B%20Using%20aR%20registers%3F%3C%2FP%3E%3CP%3E%3CBR%20%2F%3Eedit%3A%3C%2FP%3E%3CP%3ENevermind%2C%20i%20got%20it%20working%20using%20aR%20registers.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EI%20am%20using%20PDLY_TIMEOUT%20with%20value%2050UL%20on%20app_init.h%20and%20LPIT%20timer%20period%20of%20400%2C%20so%20buffer%20gets%20update%20at%20rate%20of%2020KHz.%3CBR%20%2F%3E%3CBR%20%2F%3EOnly%20using%20ch0%20on%20PDB0%2C%20and%20using%20channels%200%2C1%2C2%20and%203%20on%20PDB1%2C%20each%20channel%20triggered%2010%C2%B5s%20after%20another.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3Eapp_init.c%20looks%20like%20this%3A%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%23include%20%22app_init.h%22%3CBR%20%2F%3Evoid%20PDB0_init(void)%3B%3CBR%20%2F%3Evoid%20PDB1_init(void)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3Euint16_t%20delayValue%3B%3CBR%20%2F%3Eextern%20uint16_t%20buffer%5B33%5D%3B%3CBR%20%2F%3Eextern%20uint16_t%20value%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%2F*%20configuration%20structures%20for%20simple%20loop%20transfers%20*%2F%3CBR%20%2F%3Eedma_loop_transfer_config_t%20loopConfig%20%3D%20%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.majorLoopIterationCount%20%3D%200%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.srcOffsetEnable%20%3D%20false%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.dstOffsetEnable%20%3D%20false%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.minorLoopOffset%20%3D%200%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.minorLoopChnLinkEnable%20%3D%20false%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.minorLoopChnLinkNumber%20%3D%200%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.majorLoopChnLinkEnable%20%3D%20false%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.majorLoopChnLinkNumber%20%3D%200%3CBR%20%2F%3E%7D%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3Eedma_transfer_config_t%20transferConfig%20%3D%20%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.srcAddr%20%3D%200%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.destAddr%20%3D%200%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.srcTransferSize%20%3D%20EDMA_TRANSFER_SIZE_2B%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.destTransferSize%20%3D%20EDMA_TRANSFER_SIZE_2B%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.srcOffset%3D%204%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.destOffset%20%3D%202%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.srcLastAddrAdjust%20%3D%200%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.destLastAddrAdjust%20%3D%200%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.srcModulo%20%3D%20EDMA_MODULO_OFF%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.destModulo%20%3D%20EDMA_MODULO_OFF%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.minorByteTransferCount%20%3D%202%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.scatterGatherEnable%20%3D%20false%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.scatterGatherNextDescAddr%20%3D%200%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.interruptEnable%20%3D%20true%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20.loopTransferConfig%20%3D%20%26amp%3BloopConfig%3CBR%20%2F%3E%7D%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3Evoid%20ADC0_Init(void)%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_AutoCalibration(INST_ADCONV0)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigConverter(INST_ADCONV0%2C%20%26amp%3BadConv0_ConvConfig0)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV0%2C%200UL%2C%20%26amp%3BadConv0_ChnConfig0)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV0%2C%201UL%2C%20%26amp%3BadConv0_ChnConfig1)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV0%2C%202UL%2C%20%26amp%3BadConv0_ChnConfig2)%3B%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3Evoid%20ADC1_Init(void)%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_AutoCalibration(INST_ADCONV1)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigConverter(INST_ADCONV1%2C%20%26amp%3BadConv1_ConvConfig0)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%200UL%2C%20%26amp%3BadConv1_ChnConfig0)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%201UL%2C%20%26amp%3BadConv1_ChnConfig1)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%202UL%2C%20%26amp%3BadConv1_ChnConfig2)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%203UL%2C%20%26amp%3BadConv1_ChnConfig3)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%204UL%2C%20%26amp%3BadConv1_ChnConfig4)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%205UL%2C%20%26amp%3BadConv1_ChnConfig5)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%206UL%2C%20%26amp%3BadConv1_ChnConfig6)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%207UL%2C%20%26amp%3BadConv1_ChnConfig7)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%208UL%2C%20%26amp%3BadConv1_ChnConfig8)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%209UL%2C%20%26amp%3BadConv1_ChnConfig9)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2010UL%2C%20%26amp%3BadConv1_ChnConfig10)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2011UL%2C%20%26amp%3BadConv1_ChnConfig11)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2011UL%2C%20%26amp%3BadConv1_ChnConfig11)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2012UL%2C%20%26amp%3BadConv1_ChnConfig12)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2013UL%2C%20%26amp%3BadConv1_ChnConfig13)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2014UL%2C%20%26amp%3BadConv1_ChnConfig14)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2015UL%2C%20%26amp%3BadConv1_ChnConfig15)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2016UL%2C%20%26amp%3BadConv1_ChnConfig16)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2017UL%2C%20%26amp%3BadConv1_ChnConfig17)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2018UL%2C%20%26amp%3BadConv1_ChnConfig18)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2019UL%2C%20%26amp%3BadConv1_ChnConfig19)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2020UL%2C%20%26amp%3BadConv1_ChnConfig20)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2021UL%2C%20%26amp%3BadConv1_ChnConfig21)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2022UL%2C%20%26amp%3BadConv1_ChnConfig22)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2023UL%2C%20%26amp%3BadConv1_ChnConfig23)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2024UL%2C%20%26amp%3BadConv1_ChnConfig24)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2025UL%2C%20%26amp%3BadConv1_ChnConfig25)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2026UL%2C%20%26amp%3BadConv1_ChnConfig26)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2027UL%2C%20%26amp%3BadConv1_ChnConfig27)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2028UL%2C%20%26amp%3BadConv1_ChnConfig28)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC_DRV_ConfigChan(INST_ADCONV1%2C%2029UL%2C%20%26amp%3BadConv1_ChnConfig29)%3B%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3Evoid%20PDB0_init()%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_Init(INST_PDB0%2C%20%26amp%3Bpdb0_InitConfig0)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_Enable(INST_PDB0)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2F%20config%208%20pretriggers%20on%20ch0%20based%20on%20component%20setting%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB0%2C%200UL%2C%20%26amp%3Bpdb0_AdcTrigInitConfig0)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB0%2C%200UL%2C%20%26amp%3Bpdb0_AdcTrigInitConfig1)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB0%2C%200UL%2C%20%26amp%3Bpdb0_AdcTrigInitConfig2)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2F%20set%20PDB0%20counter%20period%20to%20delayValue%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_SetTimerModulusValue(INST_PDB0%2C%20(uint32_t)%20delayValue)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2F%20set%20ch0%20trigger0%20delay%20to%20happen%20immediate%20upon%20Trigger_In%200%20(PIT0%20ch0)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_SetAdcPreTriggerDelayValue(INST_PDB0%2C%200UL%2C%200UL%2C(uint32_t)%20(1))%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_SetCmpPulseOutDelayForHigh(INST_PDB0%2C%200L%20%2C%200)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_SetCmpPulseOutDelayForLow(INST_PDB0%2C%200L%2C%20delayValue%2FPDLY_TIMEOUT)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_SetCmpPulseOutEnable(INST_PDB0%2C%201%26lt%3B%26lt%3B0%2C%20true)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_LoadValuesCmd(INST_PDB0)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3Evoid%20PDB1_init()%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_Init(INST_PDB1%2C%20%26amp%3Bpdb1_InitConfig0)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_Enable(INST_PDB1)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2F%20config%208%20pretriggers%20on%20ch0%20based%20on%20component%20setting%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%200UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig0)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%200UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig1)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%200UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig2)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%200UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig3)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%200UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig4)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%200UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig5)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%200UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig6)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%200UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig7)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2F%20config%208%20pretrigger%20on%20ch1%20based%20on%20component%20setting%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%201UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig0)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%201UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig1)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%201UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig2)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%201UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig3)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%201UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig4)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%201UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig5)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%201UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig6)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%201UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig7)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2F%20config%208%20pretrigger%20on%20ch2%20based%20on%20component%20setting%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%202UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig0)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%202UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig1)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%202UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig2)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%202UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig3)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%202UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig4)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%202UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig5)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%202UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig6)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%202UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig7)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2F%20config%206%20pretrigger%20on%20ch3%20based%20on%20component%20setting%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%203UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig0)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%203UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig1)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%203UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig2)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%203UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig3)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%203UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig4)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_ConfigAdcPreTrigger(INST_PDB1%2C%203UL%20%2C%20%26amp%3Bpdb1_AdcTrigInitConfig5)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2F%20set%20PDB1%20counter%20period%20to%20delayValue%20(~30us)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_SetTimerModulusValue(INST_PDB1%2C(uint32_t)%20delayValue)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2F%20set%20ch0%20trigger%20delay%20to%20happen%20immediate%20upon%20Trigger_In%200%20(PIT0%20ch0)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_SetAdcPreTriggerDelayValue(INST_PDB1%2C%200UL%20%2C%200UL%20%2C%20(uint32_t)%20(1))%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2F%20set%20ch1%20trigger0%20delay%20to%20happen%2010us%20upon%20Trigger_In%200%20(PIT0%20ch0)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_SetAdcPreTriggerDelayValue(INST_PDB1%2C%201UL%20%2C%200UL%20%2C%20(uint32_t)%20(10*delayValue%2FPDLY_TIMEOUT))%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2F%20set%20ch2%20trigger0%20delay%20to%20happen%2020us%20upon%20Trigger_In%200%20(PIT0%20ch0)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_SetAdcPreTriggerDelayValue(INST_PDB1%2C%202UL%20%2C%200UL%20%2C%20(uint32_t)%20(20*delayValue%2FPDLY_TIMEOUT))%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2F%20set%20ch3%20trigger0%20delay%20to%20happen%2030us%20upon%20Trigger_In%200%20(PIT0%20ch0)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_SetAdcPreTriggerDelayValue(INST_PDB1%2C%203UL%20%2C%200UL%20%2C%20(uint32_t)%20(30*delayValue%2FPDLY_TIMEOUT))%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB_DRV_LoadValuesCmd(INST_PDB1)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%2F*%20This%20function%20triggers%20a%20loop%20memory-to-memory%20transfer.%20*%2F%3CBR%20%2F%3Evoid%20triggerLoopTransfer(uint8_t%20channel%2C%20uint8_t%20*%20srcBuff%2C%20uint16_t%20*%20dstBuff%2C%20uint32_t%20size)%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2FtransferComplete%20%3D%20false%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bdma_request_source_t%20DmaReq%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F*%20configure%20transfer%20source%20and%20destination%20addresses%20*%2F%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20transferConfig.srcAddr%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%3D%20(uint32_t)srcBuff%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20transferConfig.destAddr%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%3D%20(uint32_t)dstBuff%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20transferConfig.srcLastAddrAdjust%20%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%3D%20-(4*size)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20transferConfig.destLastAddrAdjust%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%3D%20-(2*size)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20loopConfig.majorLoopIterationCount%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%3D%20size%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20if(channel%20%3D%3D%200)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3BDmaReq%20%3D%20EDMA_REQ_ADC0%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20else%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3BDmaReq%20%3D%20EDMA_REQ_ADC1%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F*%20configure%20the%20eDMA%20channel%20for%20a%20loop%20transfer%20(via%20transfer%20configuration%20structure%20*%2F%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20EDMA_DRV_ConfigLoopTransfer(channel%2C%20%26amp%3BtransferConfig)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F*%20select%20hw%20request%20*%2F%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20EDMA_DRV_SetChannelRequestAndTrigger(channel%2C%20DmaReq%2C%20false)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2F*%20start%20the%20channel%20*%2F%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20EDMA_DRV_StartChannel(channel)%3B%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%2F%2F%20DMA%20channel0%20callback%3CBR%20%2F%3Evoid%20DMA_ADC0_CHANNEL0(void%20*parameter%2C%20edma_chn_status_t%20status)%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B(void)status%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B(void)parameter%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bvalue%20%3D%20buffer%5B0%5D%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20PINS_DRV_SetPins(PTE%2C1%26lt%3B%26lt%3B14)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20PINS_DRV_ClearPins(PTE%2C1%26lt%3B%26lt%3B14)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%2F%2F%20DMA%20channel1%20callback%3CBR%20%2F%3Evoid%20DMA_ADC1_CHANNEL1(void%20*parameter%2C%20edma_chn_status_t%20status)%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B(void)status%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B(void)parameter%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPINS_DRV_SetPins(PTE%2C1%26lt%3B%26lt%3B15)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPINS_DRV_ClearPins(PTE%2C1%26lt%3B%26lt%3B15)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%7D%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3Evoid%20DMA_Init(void)%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BEDMA_DRV_Init(%26amp%3BdmaController1_State%2C%20%26amp%3BdmaController1_InitConfig0%2C%20edmaChnStateArray%2C%20edmaChnConfigArray%2C%20EDMA_CONFIGURED_CHANNELS_COUNT)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2F%20set%20DMA%20ch0%20to%20read%20first%203%20ADC0%20Results%20registers%20and%20move%20it%20to%20buffer%20array%20starting%20from%201st%20element%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BtriggerLoopTransfer(DMA_CHANNEL0%2C%20(uint8_t%20*)%26amp%3B(ADC0-%26gt%3BaR%5B0%5D)%2Cbuffer%2C%203)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2F%20set%20DMA%20ch1%20to%20read%20first%2030%20ADC1%20Results%20registers%20and%20move%20it%20to%20buffer%20array%20starting%20from%204th%20element%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BtriggerLoopTransfer(DMA_CHANNEL1%2C%20(uint8_t%20*)%26amp%3B(ADC1-%26gt%3BaR%5B0%5D)%2C%26amp%3Bbuffer%5B3%5D%2C30)%3B%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3Evoid%20app_init(void)%3CBR%20%2F%3E%7B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC0_Init()%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BADC1_Init()%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bif(!calculateIntValue(%26amp%3Bpdb0_InitConfig0%2C%20PDLY_TIMEOUT%2C%20%26amp%3BdelayValue))%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F*%20Stop%20the%20application%20flow%20*%2F%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3Bwhile(1)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%7D%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB0_init()%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BPDB1_init()%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BDMA_Init()%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2F%20Initialize%20TRGMUX%20to%20route%20LPIT0%20ch0%20trigger%20to%20both%20PDBs%20and%20PDB's%20OUT%20pulse%20to%20TRGMUX%20out7%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BTRGMUX_DRV_Init(INST_TRGMUX1%2C%20%26amp%3Btrgmux1_InitConfig0)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2F%20Initialize%20LPIT%20instance%200.%20Reset%20and%20enable%20peripheral%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BLPIT_DRV_Init(INST_LPIT1%2C%20%26amp%3Blpit1_InitConfig)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2F%20Initialize%20LPIT%20channel%200%20to%20generate%20trigger%20for%20PDB%20via%20TRGMUX%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BLPIT_DRV_InitChannel(INST_LPIT1%2C%200%2C%20%26amp%3Blpit1_ChnConfig0)%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%2F%2F%20Start%20LPIT0%20channel%200%20counter%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3BLPIT_DRV_StartTimerChannels(INST_LPIT1%2C%201)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EThanks%2C%3CBR%20%2F%3EJani%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1101687%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Example%20S32K144%20PDB%20ADC%20DMA%20S32DS.ARM.2018.R1%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1101687%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EMany%20thanks%2C%20I%20am%20debugging%20multiple%20adc%20channels%20and%20dma%20transfer!%3C%2FP%3E%3C%2FLINGO-BODY%3E
100% helpful (1/1)
Version history
Last update:
‎09-10-2020 01:43 AM
Updated by: