Part Number:TM4C1233H6PZ
Tool/software: Code Composer Studio
Hi all,
I encounter a strange problem.
the system "sometimes" jump into fault ISR when the system still processing initial work. we have used this MCU for a very long time, and that's the first time to notice this problem.
the chance of this problem to show up is very low, I have to reset the system, again and again(without any modification to code), to make this bug happen.
after some debugging, I add a bunch of flags between function calls. finally, I found it's ROM_ function call that didn't jump back the right address and trigger a bus fault.
the code shown below, it's really simple. I can't figure out what will cause this to happen.
int main(void){
ROM_FPULazyStackingEnable();
ROM_FPUEnable();
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_3);
ROM_GPIOPadConfigSet(GPIO_PORTB_BASE, GPIO_PIN_3, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); //the problem occurs at these two functions, not sure which one.
ROM_ADCReferenceSet(ADC0_BASE, ADC_REF_EXT_3V); //the problem occurs at these two functions, not sure which one.
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);
ROM_GPIOPinTypeADC(SYSCTL_PERIPH_GPIOH, GPIO_PIN_3);
.....
.....
.....
.....
}
it happens more easily with the cold reboot, so I'm thinking this might be related to some HW reboot process.
for now, I add 200ms delay before starting the initial process, and this problem is gone. (but not sure it's gone forever, it's already hard to reproduce before adding delay)
Does dose anyone have an idea about this?