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.

TM4C123GH6PM SysTick stopped working CCS5.5

Other Parts Discussed in Thread: SYSBIOS, TM4C123GH6PGE

Hello, i have the same problem as many other but i have the problem with CCS5.4. Yesterday i did a update to CCS5.5 (at home because the downloads are not working in my office) but i have the same problem.

If i remove the line  SysCtlDelay(SysCtlClockGet() / (1000 * 3)); the controller is working 10 times longer, but it stops also. and if i go to pause in the debugger it stops at address FaultISR 0x00000E2C.

Thank you for your help.

Here is my code.

void SysTickIntHandler(void)
{
    //
    // Update the Systick interrupt counter.
    //
    g_ui32Counter++;
    UARTprintf("systick %d\n\r",g_ui32Counter);
    GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2);

    //
    // Delay for 1 millisecond.  Each SysCtlDelay is about 3 clocks.
    //
    SysCtlDelay(SysCtlClockGet() / (1000 * 3));

    //
    // Turn off the LED
    //
    GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0);
}

int main(void)
{
    uint32_t tmp;
    uint32_t pui32DataRx[3];
    uint32_t pui32DataTx[3];
//    uint8_t string[50];
//    tmp = 0;
    //
    // Enable lazy stacking for interrupt handlers.  This allows floating-point
    // instructions to be used within interrupt handlers, but at the expense of
    // extra stack usage.
    //
    ROM_FPUEnable();
    ROM_FPULazyStackingEnable();

    //
    // Set the clocking to run directly from the crystal.
    //
    ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
                       SYSCTL_XTAL_16MHZ);
    //
    // Enable the GPIO port that is used for the on-board LED.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    //
    // Enable the GPIO pins for the LED (PF2).
    //
    ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2);
    //
    // Enable the peripherals used by this example.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_EEPROM0);
    tmp =  ROM_EEPROMSizeGet();        // ok

    //
    // Set GPIO A0 and A1 as UART pins.
    //
    ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
    ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
    ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    //
    // Configure the UART for 115,200, 8-N-1 operation.
    //
    //
        // Initialize the UART for console I/O.
        //
    UARTStdioConfig(0, 115200, 16000000);

//    ROM_UARTConfigSetExpClk(UART0_BASE, ROM_SysCtlClockGet(), 115200,
//                            (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
//                             UART_CONFIG_PAR_NONE));
    //
    // Enable the UART interrupt.
    //
    ROM_IntEnable(INT_UART0);
    ROM_UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);
    //
    // Prompt for text to be entered.
    //
//    UARTSend((uint8_t *)"\033[2JEnter text: ", 16);
    UARTSend((uint8_t *)"ADC ->\n\r",8);
    UARTSend((uint8_t *)"  Type: Single Ended\n\r",22);
    UARTSend((uint8_t *)"  Samples: One\n\r",16);
    UARTSend((uint8_t *)"  Update Rate: 250ms\n\r",22);
    UARTSend((uint8_t *)"  Input Pin: AIN0/PE7\n\r",23);

 //SPI
/*    SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    GPIOPinConfigure(GPIO_PA2_SSI0CLK);
    GPIOPinConfigure(GPIO_PA3_SSI0FSS);
    GPIOPinConfigure(GPIO_PA4_SSI0RX);
    GPIOPinConfigure(GPIO_PA5_SSI0TX);
    GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 | GPIO_PIN_2);
    SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 16);
    SSIEnable(SSI0_BASE);
*/     // Read any residual data from the SSI port.  This makes sure the receive
     // FIFOs are empty, so we don't read any unwanted junk.  This is done here
     // because the SPI SSI mode is full-duplex, which allows you to send and
     // receive at the same time.  The SSIDataGetNonBlocking function returns
     // "true" when data was returned, and "false" when no data was returned.
     // The "non-blocking" function checks if there is any data in the receive
     // FIFO and does not "hang" if there isn't.
     //
/*     while(SSIDataGetNonBlocking(SSI0_BASE, &pui32DataRx[0]))
     {
     }
     pui32DataTx[0] = 0x5555;    //max 16bit
     pui32DataTx[1] = 0xAAAA;
     pui32DataTx[2] = 0;
*/
    //
    // The ADC0 peripheral must be enabled for use.
    //
//    tmp = SysCtlPeripheralPresent(SYSCTL_PERIPH_ADC0);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);

    //
    // For this example ADC0 is used with AIN0 on port PE3.
    // The actual port and pins used may be different on your part, consult
    // the data sheet for more information.  GPIO port E needs to be enabled
    // so these pins can be used.
    // TODO: change this to whichever GPIO port you are using.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);

    //
    // Select the analog ADC function for these pins.
    // Consult the data sheet to see which functions are allocated per pin.
    // TODO: change this to select the port/pin you are using.
    //
    ROM_GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3);    //AIN0
    ROM_GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_2);    //AIN1

    //
    // Enable sample sequence 3 with a processor signal trigger.  Sequence 3
    // will do a single sample when the processor sends a signal to start the
    // conversion.  Each ADC module has 4 programmable sequences, sequence 0
    // to sequence 3.  This example is arbitrarily using sequence 3.
    //
    ROM_ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);

    //
    // Configure step 0 on sequence 3.  Sample channel 0 (ADC_CTL_CH0) in
    // single-ended mode (default) and configure the interrupt flag
    // (ADC_CTL_IE) to be set when the sample is done.  Tell the ADC logic
    // that this is the last conversion on sequence 3 (ADC_CTL_END).  Sequence
    // 3 has only one programmable step.  Sequence 1 and 2 have 4 steps, and
    // sequence 0 has 8 programmable steps.  Since we are only doing a single
    // conversion using sequence 3 we will only configure step 0.  For more
    // information on the ADC sequences and steps, reference the datasheet.
    //
    ROM_ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_CH0 ); //| ADC_CTL_IE );
    ROM_ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_CH1 | ADC_CTL_IE | ADC_CTL_END);

    //
    // Since sample sequence 3 is now configured, it must be enabled.
    //
    ROM_ADCSequenceEnable(ADC0_BASE, 1);

    //
    // Clear the interrupt status flag.  This is done to make sure the interrupt flag is cleared before we sample.
    //
    ROM_ADCIntClear(ADC0_BASE, 1);

    //
    // Sample AIN0 forever.  Display the value on the console.
    //
    g_ui32Counter = 0;
    //
    // Set up the period for the SysTick timer.  The SysTick timer period will
    // be equal to the system clock, resulting in a period of 1 second.
    //
    tmp = SysCtlClockGet();
    SysTickPeriodSet(SysCtlClockGet()/4); // SysCtlClockGet == 16Mhz
    SysTickIntEnable();        // Enable the SysTick Interrupt.
    SysTickEnable();        // Enable SysTick.


    //
    // Enable processor interrupts.
    //
    ROM_IntMasterEnable();

    //
    // Loop forever echoing data through the UART.
    //
    while(1)
    {
        //
        // Trigger the ADC conversion.
        //
        ROM_ADCProcessorTrigger(ADC0_BASE, 1);

        //
        // Wait for conversion to be completed.
        //
        while(!ADCIntStatus(ADC0_BASE, 1, false))    {}

        //
        // Clear the ADC interrupt flag.
        //
        ROM_ADCIntClear(ADC0_BASE, 1);

        //
        // Read ADC Value.
        //
        ROM_ADCSequenceDataGet(ADC0_BASE, 1, pui32ADC0Value);
//        ADCSequenceDataGet(ADC0_BASE, 1, &pui32ADC0Value[1]);

        //
        // Display the AIN0 (PE7) digital value on the console.
        //
//        UARTprintf("AIN0=%04d   AIN1=%04d\r\n", pui32ADC0Value[0],pui32ADC0Value[1]);
        UARTprintf("%04d, %04d\r\n", pui32ADC0Value[0],pui32ADC0Value[1]);
//        usnprintf("usnprintf/n/r");

 //       SSIDataPut(SSI0_BASE, pui32DataTx[0]);
 //       SSIDataPut(SSI0_BASE, pui32DataTx[1]);

        //
        // Wait until SSI0 is done transferring all the data in the transmit FIFO.
        //
//        while(SSIBusy(SSI0_BASE))
//        {
//        }
//        SSIDataGet(SSI0_BASE, &pui32DataRx[0]);

        // This function provides a means of generating a constant length // delay.  The function delay (in cycles) = 3 * parameter.  Delay
        // 250ms arbitrarily.
        ROM_SysCtlDelay(SysCtlClockGet() / 24);
    }
}

  • What output do you see on the UART before the failure.  There are lots of things that can cause faults, but most likely what's happening is that you haven't enabled a peripheral correctly.  Try stepping through main() line by line to see if the fault occurs there.  If main() is OK, set a breakpoint in your ISR and step through it to see if the fault is occurring there.

    The other thing you can do is look at the exception stack frame after the fault.  It should tell you exactly which instruction caused the fault.

    What you're describing by itself will not cause a problem.  There's something your code is doing to make it happen.

  • Thank you for your answer,

    the adc values are printed out.

    it makes no sense to setp through main because the main runs abbout 500-1000 times bevor the failer ocures.

    the systick ISR runs also 100 - 500 times bevor the failer ocures.

    The cpu alwasys stops with FaultISR

  • Hello again, if i disable the UARTprintf line in the main the code is working. can the UART thouw an faultINT?

  • Hi guys,

    I am getting stuck when using SysTick. Here is my setting:

    uint32_t freq = SysCtlClockGet();
    printf("CPU freq: %d", freq); fflush(stdout);
    
    SysTickPeriodSet(SysCtlClockGet() / 5);
    //SysTickIntRegister(&SysTickIntHandler);
    SysTickIntEnable();
    SysTickEnable();

    I got the error:

    ti.sysbios.family.arm.m3.Hwi: line 1120: E_noIsr: id = 15, pc = 00008c22
    Exception occurred in background thread at PC = 0x00008c22.
    Core 0: Exception occurred in ThreadType_Task.
    Task name: ti.sysbios.knl.Task.IdleTask, handle: 0x200071a8.
    Task stack base: 0x20003860.
    Task stack size: 0x800.
    R0 = 0x00000090 R8 = 0xffffffff
    R1 = 0x00000044 R9 = 0xffffffff
    R2 = 0x00000890 R10 = 0xffffffff
    R3 = 0x00000000 R11 = 0xffffffff
    R4 = 0x00011d00 R12 = 0x00000020
    R5 = 0x00011d00 SP(R13) = 0x20004010
    R6 = 0x00000001 LR(R14) = 0x00008c19
    R7 = 0x00011cf4 PC(R15) = 0x00008c22
    PSR = 0x21000000
    ICSR = 0x0042380f
    MMFSR = 0x00
    BFSR = 0x00
    UFSR = 0x0000
    HFSR = 0x00000000
    DFSR = 0x0000000b
    MMAR = 0xe000ed34
    BFAR = 0xe000ed38
    AFSR = 0x00000000
    Terminating execution...


    It seems that program could not point to ISR handler when systick interrupt occurred. The interrupt vector might not be defined.

    Could you help me how to add the interrupt handler (SysTickIntHandler) into vector table in my application?

    PS: I am using Tiva TM4C123GH6PGE

    Thank you!

    Tin Phan

  • I think i have found the problem, if the main is in the line UARTprintf and is interrupted by the systick and also do a UARTprintf at the same time the failer will ocour.

    thank you for your help

    Franz