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.

TM4C123G:FaultISR was caused when using botn ADC and GPIO

I  have just learned  few days in TM4C123G. Then there is a hard problem for me. I started with TI's code example timers(for there are some problems when creating my own projects....) and tried to add some new functions.But when I use both ADC and GPIO modules the program always runs into the FaultISR and does an infinite loop.

I checked the Program Status Register (xPSR) register, it was 0x0100000 and seemed it was caused by a hard fault.

The ADC samples the temperature and the GPIOs are used for a small oled.

When I remove the whole ADC  part of the program, it runs normally.

If I save the Initialization part of the ADC, the program can run under debug state but it can't run again by a Power-on reset.

Sorry for my poor English and I really need your help!

 

  • Program see Annex.

     Initialization part of the ADC:

    void ConfigureADCs(void){

    SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
    ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);
    ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_TS);
    ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_TS);
    ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_TS);
    ADCSequenceStepConfigure(ADC0_BASE, 1, 3, ADC_CTL_TS|ADC_CTL_IE|ADC_CTL_END);
    ADCSequenceEnable(ADC0_BASE, 1);

    }5327.timers.zip

  • The part of ADC program in while(1) :

    while(1)
    {
    //show power-on time
    show_time(79,0,Power_On_time);

    //show internal temperature of the core
    /*ADCIntClear(ADC0_BASE, 1);
    ADCProcessorTrigger(ADC0_BASE, 1);
    while(!ADCIntStatus(ADC0_BASE, 1, false)){}
    ADCSequenceDataGet(ADC0_BASE, 1, ui32ADC0Value);
    ui32TempAvg = (ui32ADC0Value[0] + ui32ADC0Value[1] + ui32ADC0Value[2] + ui32ADC0Value[3] + 2)/4;
    ui32TempValueC = (1475 - ((2475 * ui32TempAvg)) / 4096)/10;*/
    //LCD_P6x8Int(85,2,Main_Loop_Count);

    //show main loops
    Main_Loop_Count++;
    if (Main_Loop_Count > 9999999) Main_Loop_Count = 0;
    LCD_P6x8Int(85,7,Main_Loop_Count);
    }

  • was this ever solved
  • Since this thread lies dormant for more than a half year now, we will probably never know. Albeit it would be good style, newbies rarely come back to such a forum, unless they face another obstacle.

    If you have have a similiar problem, decribe it here, or better, open a new thread. The code sections of your project relevant for your issue will surely be helpful ...

  • Hello Robert,

    Dormant thread as f.m. said. One reason for the bus fault would be that it takes 3 clocks to get the peripheral ready

    SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
    ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);

    Should be

    SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
    while(!(SysCtlPeripheralReady(SYSCTL_PERIPH_ADC0)));
    ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);

    Regards
    Amit
  • Hi Amit,

    May I - ever so slightly - provide a different take? Note poster's un-hedging, "Self Diagnosis" - the "combination of (both) ADC & GPIO!" (i.e. Help me - I'm LOST ... ... ... but I KNOW where I'm going!)    {Really?}
     
    As he's missed that peripheral delay for the ADC - is it not likely he's missed it (also) for the GPIO? And yet that (appears) to have escaped the dreaded fault ISR... Surely blasphemy - but we've read hundreds of clients' code - and not always do they include that delay - and many (perhaps most) of those programs indeed do run!

  • Hello cb1

    Yes, that could likely be the case. But then is not the forum flooded with half left post that do require closure

    Regards
    Amit
  • Hi Amit,

    Are you noting that (sometimes) the forum, "Does not Work!?"
  • Hello cb1

    I am noting that threads do not get closed. We can change the state of a thread to closed but then the question always lingers that if it is closed then was it verified and closed by the forum user or the moderator

    Regards
    Amit