I'm working on an old problem that happens on my Tivas that are in high volume production - They fail to start up about 1 time in a thousand. For my application, thats a crazy high fail rate. Luckily we can recover. I've been running local regressions, and I've seen the failure to self reset problem -
Amit's patch (which I already got from the FAE) cleared up the failure to restart issue, and now I've uncovered a separate issue - my parts eventually hang when switching from MOSC to PLL. My parts start out in PIOSC, and then I switch to MOSC and do setup and startup work before spinning up the PLL.
This all started because the PIOSC doesn't meet spec. I need a reliable UART so that I can report issues when my boards get tested at manufacturing time prior to shipment to their final customer. I don't want to reject boards because PIOSC is far enough out to screw up the UART self test report.
My part is running off of an external 25Mhz oscillator. Here's how I set it up:
int sysclock = SysCtlClockFreqSet( (SYSCTL_XTAL_25MHZ|SYSCTL_OSC_MAIN), SYSFREQ_XTAL); if ( sysclock == 0 ) { UARTprintf("Clock Fail "); // DumpOSC(); UARTSpinFlush(); } ROM_UARTDisable(UART1_BASE); ROM_UARTClockSourceSet(UART1_BASE,UART_CLOCK_SYSTEM); UARTStdioConfig(1, 115200, sysclock); UARTprintf("MOSC(%d) ", sysclock);
The part that baffles me is that my system somehow doesn't run at 25Mhz. SysctlClockFreqSet() returns 22857142.
If I use that value to config my UART, I get output. If I go with 25M, I get UART garbage. Sadly, the UART is on PQ4, so I can't use clock-out.
So a few questions -
1 - Whats going on here with SysCtlFreqSet? Is it really somehow running my system at 22MHz?
2 - The code (SysCtlClockFreqSet() refers to the OSCRNG bit as being related to drive strength, but the data sheet makes no mention of this. If its truly a drive strength setting should I be using it with a SE clock source?
// // Increase the drive strength for MOSC of 10 MHz and above. // if(i32XtalIdx >= (SysCtlXtalCfgToIndex(SYSCTL_XTAL_10MHZ) - (SysCtlXtalCfgToIndex(SYSCTL_XTAL_5MHZ)))) { ui32MOSCCTL |= SYSCTL_MOSCCTL_OSCRNG; }
3 - SysCtlFreqSet() contains this stanza -
if((ui32Config & SYSCTL_USE_OSC) == SYSCTL_USE_PLL) { <snipped> } else { // // Set the Flash and EEPROM timing values for PIOSC // HWREG(SYSCTL_MEMTIM0) = _SysCtlMemTimingGet(16000000);
Which suggests to me that I'm running my system at 25MHz using memory timing values for 16Mhz. The table in the data sheet indicates that I'll need different MEMTIM0 values. Could that be the source of my part hangs?