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.

FaultISR and ADC on TM4C123GH6PM

Hello,

i recently discovered a problem with the ADC routines of the tivaware driver library.

My code used to work fine until i imported a project from the examples (usb_dev_bulk) tried to compile it and flash it to the chip. Now every time i debug my previous code, it enters the FaultISR on the ADCReferenceSet(); function call. This didn't happen before. I did not make any changes to my code.

I attached the code i'm using below. Hopefully someone knows an answer to that problem. Thank you very much.

void main(void) {
// Initialization sequence --------------------------------------------------------------
SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);

// activate and set up ADC module
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
SysCtlDelay(10);
//define ADC speed
SysCtlADCSpeedSet(SYSCTL_ADCSPEED_1MSPS);
// disable oversampling
ADCHardwareOversampleConfigure(ADC0_BASE, 0);
// setting the voltage reference to internal
ADCReferenceSet(ADC0_BASE, ADC_REF_INT);
// use sequencer 0 with timer triggering and highest priority
ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_TIMER, 0);
// define the sampling sequence for sequencer 0
ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_TS);
ADCSequenceStepConfigure(ADC0_BASE, 0, 1, ADC_CTL_TS);
ADCSequenceStepConfigure(ADC0_BASE, 0, 2, ADC_CTL_TS);
ADCSequenceStepConfigure(ADC0_BASE, 0, 3, ADC_CTL_TS);
ADCSequenceStepConfigure(ADC0_BASE, 0, 4, ADC_CTL_TS);
ADCSequenceStepConfigure(ADC0_BASE, 0, 5, ADC_CTL_TS);
ADCSequenceStepConfigure(ADC0_BASE, 0, 6, ADC_CTL_TS);
ADCSequenceStepConfigure(ADC0_BASE, 0, 7, ADC_CTL_TS|ADC_CTL_IE|ADC_CTL_END);
// enable adc interrupts for sequencer 0
IntEnable(INT_ADC0SS0);
ADCIntEnableEx(ADC0_BASE, ADC_INT_SS0);
IntMasterEnable();
// enable the sequencer
ADCSequenceEnable(ADC0_BASE, 0);
  • While you speak to, "ADCReferenceSet()" vendor's Sue Cozart details a known issue - 2 lines earlier in your code: "Problem w/ StsCtlADCSpeedSet()."  (her advisory appears atop this forum as "sticky.")

    Suspect your review - and compliance w/her workaround - will prove worthwhile...

    http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/293858.aspx

  • Thank you very much for your fast reply.

    But unfortunately, i couldn't solve the problem yet. The compiler gives an error that the symbol ADC_O_PC is not defined. But also, if i comment the SysCtlADCSpeedSet() call, the programm still runs to the FaultISR. In debug mode if i use step over, it works (without the SpeedSet call).

    The fact that there was no error before i compiled the usb_dev_bulk is also something that gives me to think but i have no clue what could have happened there...

  • Hi,

    Thomas Emig said:
    ADCIntEnableEx(ADC0_BASE, ADC_INT_SS0);

    Did you put the "Ex" by mistake or you modify the ADCIntEnable to your preference? Also, if you are using ADCIntEnable, the second parameter should be "0". You can check at the Tivaware Peripheral Library Users Guide.

    -kel

  • Hi kel,

    Thanks for your answer.

    the ADCIntEnableEx is also defined in the TivaWare library adc.h. But if i change it to ADCIntEnable it doesn't solve the problem. The program still runs to the FaultISR on the ADCReferenceSet call... 

  • Hi Thomas,

          I must have an old copy of Tivaware for Tiva Launchpad. I don't have any C API named "ADCIntEnableEx". I just saw it mentioned at one of the commented out description at adc.h. 

          I can't tell much about what is causing that FaultISR at ADCReferenceSet. See, if the doc below can help identify the cause of that FaultISR.

         http://www.ti.com/lit/an/spma043/spma043.pdf

         Do consider the post link shared by cb1. There are also some post before, with problems pertaining to "SysCtlADCSpeedSet". See post links below.

         SysCtlADCSpeedSet no longer works in TivaWare

         ADC Speed Set

    -kel

  • Hi kel,

    Thanks again for your reply.

    I will give it a try. But I think there is also some other issue. If I comment the speedset call, it still doesn't work properly. So it can't be this call alone?

    The problem also appeared only after I flashed another program to the chip(before it worked fine). Could there be some kind of unerasable flag that was set during this process?

  • Hi Thomas,

        I don't have your set-up to duplicate your problem. However based from the post links in this post, the changes that, I see that are needed are as of below.

    1. Declaring these code lines below in that order

    SysCtlADCSpeedSet(SYSCTL_ADCSPEED_1MSPS);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);

    2. ADCIntEnableEx - I can't comment on this, as I don't have this at my Tivaware. I can't find this C API either at Tivaware Peripheral Driver Library Users Guide 1.0.

    3. ADCIntEnable(ADC0_BASE, ADC_INT_SS0);

    If you intend to use ADCIntEnable instead, with parameters as above, the second parameter ADC_INT_SS0 is wrong. ADC_INT_SS0 is defined as 0x00000001 at adc.h. Second parameter should be set as "the sample sequence number". Based from your code that is sample sequence number "0".

    -kel

  • Hi kel,

    i've tried everything you suggested. However it did not work at first. But after i reinstalled ccs, now your tips work perfectly. Thanks again for helping me.

    Perhaps you have an idea what could have caused the problem? It appeared after i downloaded the usb_dev_bulk demo to the chip. So there must have been something wrong with ccs and not with the chip because now it works?

  • credits also to cb1.