This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM263P4-Q1: AM263P4-Q1: Autosar : ADC ISR not triggered on period match event of PWM

  • Hi Wenhao,

    Did you check if the PWM is generated correctly? I did a test with ePWM + ADC example, and test is passed. I haven't checked the sampled ADC values.

    How do you know the ADC is not triggered?

  • When all the ADC peripherals was configurated in ePWM+ADC in DMA mode , the DMA interrupt functions was excuted only once(the first time), so I thought the ADC is not trigged。

    But when I change the mcal configuration, ADC0 was ePWM+ADC in interrupt  mode,  and  ADC1~ADC4 was ePWM+ADC in DMA  mode,

    ADC0 interupt function can be excuted periodically and work normally,but ADC1~ADC4 does not work normally。

    Could you have a try in ePWM+ADC in DMA mode and tell me the result?

  • HI Wenhao,

    Have you tried the method I gave to Fan last week (after our webex meeting)?

    Cdd_Dma_Init(NULL_PTR);
    Mcal_CacheP_init();

    /* Perform a cache write back to the result buffers */
    Mcal_CacheP_wb((void *)AdcTest_Buffer, 1024, Mcal_CacheP_TYPE_ALL);

    /* Memset result buffer and give to driver */
    memset( &AdcTest_Buffer[grpIdx][0], 0xFFU, (sizeof (Adc_ValueGroupType) * ADC_TEST_BUF_SIZE_WORD));

    retVal = Adc_SetupResultBuffer(groupIdx, &AdcTest_Buffer[groupIdx][0]);

    uint32 j = 0;

    /* PWM triggering. */
    Epwm_Enable(0x50000000ul);
    //Epwm_Enable(0x50001000ul);

    /* Check the Group Triggering one by One. */
    j = AdcConf_AdcHwUnit_AdcHwUnit_0_AdcGroup_AdcGroup0_HwOneShot;

    Adc_EnableGroupNotification(j);

    Adc_EnableHardwareTrigger(j);

    EPWM_setTimeBaseCounterMode(0x50000000ul, EPWM_COUNTER_MODE_UP);

    /* Wait for Group Status to complete. */
    while(ADC_BUSY == Adc_GetGroupStatus(j))
    {
    ;
    }

  • Hello Wenhao,

    We have a unit test application (AdcTest Config 39) which tests the DMA mode in ADC MCAL with ADC triggered by EPWM. We were able to execute this test case successfully.

    Below are the ADC and DMA config used in this test application.

    Please share the ADC and DMA config used in your application. We would like to compare and closely match the configs and replicate the issue.

    ADC
    S.No Configuration parameter Value Container
    1 AdcGroupTriggSrc   ADC_TRIGG_SRC_HW AdcHwUnit
    2 AdcNotification   AdcApp_Group0EndNotification
    3 AdcGroupConversionMode   ADC_CONV_MODE_ONESHOT
    4 AdcGroupAccessMode   ADC_ACCESS_MODE_SINGLE
    5 AdcStreamingBufferMode   ADC_STREAM_BUFFER_LINEAR
    6 AdcStreamingNumSamples  1
    7 AdcHwTrigSignal ADC_HW_TRIG_BOTH_EDGES
    8 AdcExtHwTrigTimer   ADC_TRIGGER_EPWM0_SOCA
    9 AdcGroupReplacement ADC_GROUP_REPL_SUSPEND_RESUME
    10 AdcGroupDataAccessMethod   ADC_GROUP_DMA_ACCESS
    11 AdcDmaReference   /Cdd_Dma/Cdd_Dma/CddDmaDriverHandler_0_Adc
    12 AdcGroupDefinition /Adc/Adc/AdcConfigSet/AdcHwUnit_0/AdcChannel_0
    13 AdcChannelSampleWindow  16
    14 AdcChannelLimitCheck   FALSE
    15 AdcHwUnitId   ADC_HWUNIT_3
    16 AdcHwUnitResolution   ADC_RESOLUTION_12BIT
    17 AdcHwPrescale   ADC_CLK_DIV_1_0
    18 AdcMaxDmaChannelId   63 General
    19 AdcTypeofInterruptFunction   ADC_ISR_CAT1
    20 AdcDMAEnable   TRUE
    CDD DMA
    S.No Configuration parameter Value Container
    1 CddDmaTransferType   CDD_DMA_TRANSFER_TYPE_ADC CddDmaDriverHandler_0_Adc
    2 CddDmaInstance   CDD_DMA_MSS_A
    3 CddDmaRegionID  0
    4 CddDmaTccNumber  10
    5 CddDmaQueueNumber  0
    6 CddDmaEnableInterrupt   TRUE
    7 CddDmaTransferModeSelect   CDD_DMA_TRANSFER_MODE_NORMAL
    8 CddDmaChannel  10 CddDmaChannelGroup
    9 CddDmaPramNumber  15
    10 CddDmaDmaChannelModule   CDD_DMA_TRIG_XBAR_EDMA_MODULE_10 CddDmaChannelTriggerConfiguration_0
    11 CddDmaChannelTriggerSource   CDD_DMA_TRIG_XBAR_DMA_XBAR_OUT_0
    12 CddDmaDmaChannelXbar   CDD_DMA_XBAR_DMA_TRIG_XBAR_0
    13 CddDmaDmaChannelXbarMap  

    CDD_DMA_XBAR_ADC3_INT1

    Thanks

    K.Sanjeev

  • HI Wenhao,

    The MCAL SW team is working on an example.