Part Number: TMS320F28035
Other Parts Discussed in Thread: C2000WARE
Hello,
I have been using the internal oscillator in my application. I am now trying to switch to the external crystal oscillator. I implemented the code shown below.
When I flash the program for the first time, the system works as expected — the LED blinks and the timer interrupt executes every 1 ms. However, sometimes after flashing, the LED does not blink and the timer interrupt does not execute.
In some cases:
- The first flash works correctly.
- After a power cycle, the LED does not blink.
- Re-flashing the program again does not always resolve the issue.
It appears that the system is not always switching to or running correctly from the external oscillator.
Could you suggest what might be causing this behavior?
I also tried setting INTOSC1OFF = 1, but the behavior remained the same.
Below is the code used to select the external oscillator, also I have attced the schematic
static void cpu_ExtOsclSel (void)
{
/* TI - Recommended sequence
* XTAL - ON - main clock
* INTOSC1 - ON - backup / debugger safety
* INTOSC2 - OFF - unused */
EALLOW;
SysCtrlRegs.CLKCTL.bit.XTALOSCOFF = 0; // External crystal ON (XTALOSC on X1/X2)
EDIS;
DELAY_US(10000); // Allow crystal to stabilize (~10 ms)
EALLOW;
SysCtrlRegs.CLKCTL.bit.XCLKINOFF = 1; // Turn off XCLKIN (not used)
SysCtrlRegs.CLKCTL.bit.OSCCLKSRC2SEL = 0; // 0 = External crystal on X1/X2
SysCtrlRegs.CLKCTL.bit.OSCCLKSRC2SEL = 0; // External oscillator selected
SysCtrlRegs.CLKCTL.bit.OSCCLKSRCSEL = 1; // 1 = Use source 2 (XTAL or INTOSC2)
SysCtrlRegs.CLKCTL.bit.WDCLKSRCSEL = 0; // WDT clock source = INTOSC1
SysCtrlRegs.CLKCTL.bit.INTOSC2OFF = 1; // Turn off INTOSC2
SysCtrlRegs.CLKCTL.bit.INTOSC1OFF = 0; // Keep INTOSC1 ON as backup
EDIS;
}

Any guidance on what might be causing the intermittent behavior would be appreciated.
Thank you.