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.

AM4379: ADC example problem

Part Number: AM4379
Other Parts Discussed in Thread: SYSBIOS

Hi,

I have used the AM437x TI processor with TI-RTOS  "pdk_am437x_1_0_15" PDK version. Integrated the "ti/pdk_am437x_1_0_15/packages/ti/starterware/examples/adc/volt_measure" ADC example in RTOS  application. 

After the ADC "TSCADCEventInterruptEnable(pCfgAdc->instAddr, TSCADC_INTR_MASK_END_OF_SEQUENCE);" interrupt enabled case, the platform get hang. For testing purpose, Commented that End of sequence interrupts then the RTOS application run successfully. 

Need to resolve the End of sequence enabled case system gets hang issue? 

Kindly help us to resolve this issue.


Regards,
Suresh

  • Hi Suresh,

    I'm looking at this issue, I'll get back with you shortly.

    Regards,
    Frank

  • Hi Frank,

    Thanks for your response.

    For your information, I've used only internal RAM. Because of our custom board doesn't have external DDR.

    Could you help me resolve this issue to conclude ASAP.

    Regards,
    Suresh
     

  • Hi Suresh,

    Yes, I'll help you resolve the issue.

    I have a few questions for you:

    Does the example ADC application execute on its own without any modification, and prior to integration into your RTOS application?

    For your RTOS application, did you modify the ADC settings from those in the example application?

    ADCAppInit() is called once at the start of your RTOS application?

    Case #1: Your application hangs when the "End of Sequence" interrupt is enabled in ADCAppInit(), i.e. when "TSCADCEventInterruptEnable(pCfgAdc->instAddr, TSCADC_INTR_MASK_END_OF_SEQUENCE);" is executed?

    Case #2: Your application doesn't hang when the "End of Sequence" interrupt isn't explicitly enabled in ADCAppInit(), i.e. when "TSCADCEventInterruptEnable(pCfgAdc->instAddr, TSCADC_INTR_MASK_END_OF_SEQUENCE);" is commented out?

    Did you integrate the interrupt service routine AdcAppIsr() into your application?

    Does your application get to the ISR code, and does the code observe the EOS interrupt?

    For Case #1, where does the application code hang? How does it hang? For example, is the code stuck in a polling loop, do you observe some type of abort, etc.?

    Thanks and regards,
    Frank

  • Hi Frank,

    Thanks for your reply.

    Please find below my answers prefixed with "SURESH =>"


    Frank Livingston said:

    Does the example ADC application execute on its own without any modification, and prior to integration into your RTOS application?

    SURESH => I didn't check the ADC application like this way.

    For your RTOS application, did you modify the ADC settings from those in the example application?

    SURESH =>  Yes, I'have modified the ADC mode as "TSCADC_MODE_GP_ADC" 

    ADCAppInit() is called once at the start of your RTOS application?

    SURESH =>  Yes,  The "ADCAppInit()" called only once 

    Case #1: Your application hangs when the "End of Sequence" interrupt is enabled in ADCAppInit(), i.e. when "TSCADCEventInterruptEnable(pCfgAdc->instAddr, TSCADC_INTR_MASK_END_OF_SEQUENCE);" is executed?

    Case #2: Your application doesn't hang when the "End of Sequence" interrupt isn't explicitly enabled in ADCAppInit(), i.e. when "TSCADCEventInterruptEnable(pCfgAdc->instAddr, TSCADC_INTR_MASK_END_OF_SEQUENCE);" is commented out?

    Did you integrate the interrupt service routine AdcAppIsr() into your application?

    SURESH => AdcAppIsr() is added in ADC example by default.

    Does your application get to the ISR code, and does the code observe the EOS interrupt?

    For Case #1, where does the application code hang? How does it hang? For example, is the code stuck in a polling loop, do you observe some type of abort, etc.?

    SURESH => I have added some debug print then find Application get hang after the "INTCInit(FALSE);" function. Here I have attached the source code for your reference. Due to this observation, I have not to check the cases 1 & 2. 

    CCS Project Source Code:

    ADC_Example_CCS_Project.zip
    Modified Source code Files:
    adc.zip
     

    Debug Log:

    StarterWare Boot Loader
    BOARDInit status [0x0]
    Platform : 2
    SoC : [AM43XX]
    Core : [A9]
    Platform : 2
    Board Detected : [IDKEVM]
    Base Board Revision : [UNKNOWN]
    Daughter Card Revision: [UNKNOWN]
    Platform : 2
    MMC/SD Card found
    Copying application image from MMC/SD card to RAM
    Jumping to StarterWare Application...

    <<<<Start BIOS>>>>

    ADC Test Start...

    StarterWare ADC voltage measure application!!
    BOARDInit status [0x0]
    INTCInit <IN>
    I




    Thanks & Regards
    Suresh

  • Hi Suresh,

    Thanks for sharing the .zip files.The source files are missing from ADC_Example_CCS_Project.zip, so I can't comment on these files. I checked the updates you made to adc_app.c & volt_measure_app_main.c and they look OK.

    I see that you've replaced Starterware "BOARDInit()" with "Board_init(boardCfg);" from the board library, which is good.

    The function "INTCInit(FALSE);" initializes the ARM GIC (Generic Interrupt Controller). It shouldn't be necessary to call this function in your RTOS application since GIC initialization should be handled by SYSBIOS. I would remove this function call from your code.

    I would also replace the function AdcAppIntrConfig() with something similar which uses Osal_RegisterInterrupt().

    There's an example that shows Starterware integration with RTOS here: pdk_am437x_1_0_15\packages\ti\starterware\examples\dcan. There is a readMe that explains how the example can be built for RTOS using a CCS project. Check the code for the macro RTOS_BUILD to see what changes need to be made for RTOS.

    Regards,
    Frank

  • Hi Frank,

    Thanks for your detailed reply.

    I'll start to work on the changes you suggested. Once I'll finish the changes then let you know ASAP.

    Regards,
    Suresh

  • Hi Frank,

    Thanks for your great support.

    After changed the "AdcAppIntrConfig" API as like below then then the ADC hang issue not happen & successfully readout the values from ADC. 


    static int32_t AdcAppIntrConfig(adcAppCfgObj_t *pCfgAdc)
    {

    OsalRegisterIntrParams_t interruptRegParams;
    HwiP_Handle hwiPHandlePtr;

    /* Initialize with defaults */
    Osal_RegisterInterrupt_initParams(&interruptRegParams);

    /* Populate the interrupt parameters */
    interruptRegParams.corepacConfig.arg=(uintptr_t) pCfgAdc;
    interruptRegParams.corepacConfig.name=NULL;
    interruptRegParams.corepacConfig.isrRoutine=AdcAppIsr;
    interruptRegParams.corepacConfig.priority = 0x20U;
    interruptRegParams.corepacConfig.triggerSensitivity = OSAL_ARM_GIC_TRIG_TYPE_EDGE;
    interruptRegParams.corepacConfig.intVecNum=pCfgAdc->appIntrCfg.intrLine;
    /* Register interrupts */
    Osal_RegisterInterrupt(&interruptRegParams, &hwiPHandlePtr);

    }

    Here i have attached the modified file for your reference.

    Modified File:
     adc_app.zip

    Regards,
    Suresh

  • Hi Suresh,

    Excellent, I'm glad you were able to resolve the problem. Thanks also for sharing the updated files.

    Could you please indicate whether you consider the problem resolved?

    Thanks and regards,
    Frank