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);
}
}