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.

Fault ISR due to SysCtlClockFreqSet

 on debugging the code on the board  , the flow control of the code is going into the fault isr infinte loop when the it entering into the SysCtlClockFreqSet

the code given below

#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>
#include <math.h>

#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/sysctl.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/adc.h"
#include "driverlib/gpio.h"
#include "driverlib/comp.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/debug.h"
#include "driverlib/fpu.h"
#include "driverlib/timer.h"
#include "driverlib/uart.h"
#include "utils/uartstdio.h"
#include "driverlib/rom.h"

void ConfigureUART(void);
uint32_t g_ui32SysClock;

void
ConfigureUART(void)
{
//
// Enable the GPIO Peripheral used by the UART.
//
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
while(!(SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOA)));

//
// Enable UART0.
//
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
while(!(SysCtlPeripheralReady(SYSCTL_PERIPH_UART0)));

//
// Configure GPIO Pins for UART mode.
//
MAP_GPIOPinConfigure(GPIO_PA0_U0RX);
MAP_GPIOPinConfigure(GPIO_PA1_U0TX);
MAP_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);
//
// Initialize the UART for console I/O.
//
UARTStdioConfig(0, 115200, 16000000);
}

int main (void)
{
uint32_t v[8],x[8],vtotal,xtotal;
float vrms;
// SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); //20 MHz clock
g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 200000000);
SysCtlDelay(g_ui32SysClock/12);
// ConfigureUART();
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
while(!(SysCtlPeripheralReady(SYSCTL_PERIPH_ADC0)));
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
while(!(SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOD)));
GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_2);
ADCSequenceConfigure(ADC0_BASE,3,ADC_TRIGGER_PROCESSOR,0);
ADCSequenceStepConfigure(ADC0_BASE,3,0,ADC_CTL_CH13 | ADC_CTL_END |ADC_CTL_IE);
ADCSequenceEnable(ADC0_BASE,3);
ADCIntClear(ADC0_BASE,3);

ConfigureUART();
UARTprintf("\033[2J\033[H");
UARTprintf("adc values\n");
while(1)
{int i;
for(i=0;i<8;i++)
{
ADCIntClear(ADC0_BASE,3);
ADCProcessorTrigger(ADC0_BASE,3 );
while(!ADCIntStatus(ADC0_BASE,3,false)){}
ADCIntClear(ADC0_BASE,3);
uint32_t adc0buffer[512];
ADCSequenceDataGet(ADC0_BASE,0,&adc0buffer[i]);
v[i] = adc0buffer[i];
UARTprintf("%d\n",v[i]);
}
for (i=0;i<8;i++)
{
vtotal = vtotal + v[i];
x[i] = v[i]*v[i];
}
for (i=0;i<8;i++)
{
xtotal = xtotal + x[i];
}
vrms = sqrt(xtotal / 512);
UARTprintf("%d",vrms);
SysCtlDelay(g_ui32SysClock / 12);
}
}

  • santhosh pv said:
    g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
    SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
    SYSCTL_CFG_VCO_480), 200000000);

    You don't explicitly state which device you are using but if TM4C123 the maximum system clock is 80MHz and if TM4C129 the max sys clock is 120MHz. In either case 200MHz will cause the behavior you describe since this is beyond the capability of the device.

  • Thank u, I changed my mistake in the code, after that also  the output  is jumping into the same error as not coming out of the clock initialization line.

  • Santosh,

    If you had previously programmed the device with the out of spec condition, it will be difficult to reprogram and I have found through experimentation, that CCS does not handle this well. However, I used LMFlashProrammer to erase the device then returned to CCS to re-program with the updated/corrected image file and everything works without issue. Can you try this as well?

    Note, you may also try to erase only through CCS, but I did not try this.