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.

ADC with SYS/BIOS

Hi ,

I want to use my ADC with the SYS/BIOS for Tiva C. The program without SYS/BIOS works fine but when i modify it for use with SYS/BIOS it does not run. It shows no error during build.

To be more specific it runs into an infinite loop when executing the statements starting with "ADC"

void main()
{
SysCtlClockSet(SYSCTL_SYSDIV_1 |SYSCTL_USE_OSC | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);

SysCtlPeripheralEnable(ADC0_BASE);
SysCtlPeripheralEnable(GPIO_PORTE_BASE);
GPIOPinTypeADC(GPIO_PORTE_BASE,GPIO_PIN_3);
ADCSequenceDisable(ADC0_BASE,3);
ADCSequenceConfigure(ADC0_BASE,3,ADC_TRIGGER_PROCESSOR,0);

BIOS_start();
}

Kindly help

Thanks

  • Hi Akhilesh,

    Can you check in the IDE what exactly it is looping in. You can single step to see how the CPU is executing the code? This information will be useful to figure out why.

    Regards

    Amit Ashara

  • Hi Amit,

    As soon as i execute the statements starting with "ADC" it goes to the below code placed in exit.c

    static void loader_exit(void)
    {
    #if defined(EMBED_CIO_BP)
    __asm(" .global C$$EXITE");
    #if defined(__32bis__)
    __asm("C$$EXITE:.word 0xDEFED0FE");
    #else
    __asm(" .align 4");
    #if defined(__big_endian__)
    __asm("C$$EXITE:.half 0xDEFE");
    #else
    __asm("C$$EXITE:.half 0xD0FE");
    #endif /* __big_endian__ */
    #endif /* __32bis__ */

    #else /* !EMBED_CIO_BP */
    __asm(" .global C$$EXIT");
    __asm("C$$EXIT: nop");
    #endif
    }

    After this it goes to the below code to loop infinitely


    /****************************************************************************/
    /* ABORT - ABNORMAL PROGRAM TERMINATION. CURRENTLY JUST HALTS EXECUTION. */
    /****************************************************************************/
    void abort(void)
    {
    loader_exit();
    for (;;); /* SPINS FOREVER */
    }

    Thanks

  • Hi Akhilesh,

    When it hits abort can you check the register at 0xE000ED28 and 0xE000ED38. The BIOS does not like something about the way ADC API is being called. Might want to check it on TIRTOS E2E forum as I have seen issues similar to the above.

    Regards

    Amit Ashara