Other Parts Discussed in Thread: C2000WARE, MOTORWARE
Hi,
Using a modified Lab06a, I'm struggling to setup the use of an external clock source on GPIO 19. All my efforts so far have left with an unstable application: i.e. random Illegal ISRs or lockups. Can anyone suggest whats going wrong?...
Code has been modified in two areas:
HAL_SetupClks()
{
//configure clkin pin as GP
GPIO_setMode(obj->gpioHandle, PIN_XCLK_IN, GPIO_MODE_GENERAL_PURPOSE);
GPIO_setDirection(obj->gpioHandle, PIN_XCLK_IN, GPIO_Direction_Input);
//enable the clk-in pin
CLK_setXClkInSrc(obj->clkHandle, CLK_XClkInSrc_Gpio19);
CLK_enableClkIn(obj->clkHandle);
// set the oscillator source
CLK_setOscSrc(obj->clkHandle, CLK_OscSrc_External);
// disable the crystal oscillator
CLK_disableCrystalOsc(obj->clkHandle);
// disable oscillator 2
CLK_disableOsc2(obj->clkHandle);
// set the low speed clock prescaler
CLK_setLowSpdPreScaler(obj->clkHandle, CLK_LowSpdPreScaler_SysClkOut_by_1);
// set the clock out prescaler
CLK_setClkOutPreScaler(obj->clkHandle, CLK_ClkOutPreScaler_SysClkOut_by_1);
}
Then the HAL_setupPLL() function keeps the PLL at div/4
PLL_setDivideSelect(obj->pllHandle, PLL_DivideSelect_ClkIn_by_4);
The clock source I'm using is a 20MHz silicon oscillator, connected to GPIO19. Scoping the clock source shows its 'ok' - no major noise or deviations.
Any ideas?
Mat