This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Problem Using External Oscillator for InstaSpin FOC

Other Parts Discussed in Thread: TMS320F28027F

I am trying to setup a 20MHz crystal on the X1 and X2 pins of a TMS320F28027F processor. When I ran the Instaspin with the below clock nothing ran correctly and when I tried to reprogram back the original code the JTAG gave me a Flash programming Error. It seems the chip is corrupted now and I may have to replace the processor to get past the flash error. The Error in the console is

C28xx: Flash Programmer: Error encountered when writing to flash memory

I can write to other boards with the original code and all is OK. So, I believe my Flash got corrupted somehow.

 

The below clock setup code is what done me in I believe. I am afraid to try on another board.

If someone could help me to correctly setup the external crystal to provide the proper clocks for the InstaSpin FOC to work correctly, it would be helpful. Also, do I need to make any changes to the PLL setup or any other setups.

 

void HAL_setupClks(HAL_Handle handle)

{

HAL_Obj *obj = (HAL_Obj *)handle;

CLK_disableOsc1(obj->clkHandle);

CLK_disableClkIn(obj->clkHandle);

CLK_enableCrystalOsc(obj->clkHandle);

CLK_disableOsc2(obj->clkHandle);

CLK_setOsc2Src(obj->clkHandle,CLK_Osc2Src_Internal);

CLK_setOscSrc(obj->clkHandle,CLK_OscSrc_External);

CLK_setLowSpdPreScaler(obj->clkHandle,CLK_LowSpdPreScaler_SysClkOut_by_4);

CLK_setClkOutPreScaler(obj->clkHandle,CLK_ClkOutPreScaler_SysClkOut_by_1);

PLL_setDivideSelect(obj->pllHandle,PLL_DivideSelect_ClkIn_by_2);

return;

} // end of HAL_setupClks() function

  • I did have to replace the 28027. It appears the clock was running too fast and this must have corrupted the FLASH. I am still afraid to atempt this again until I get some more boards up and running, so if anyone has some reccomendations, I would be much obliged.
  • hi: Gary

    in your code there "CLK_setOsc2Src(obj->clkHandle,CLK_Osc2Src_Internal);

    CLK_setOscSrc(obj->clkHandle,CLK_OscSrc_External);"

    I think  should be  :  

    CLK_set0sc2Src(obj->clkHandle,CLK_Osc2Src_Internal);

    CLK_set0scSrc(obj->clkHandle,CLK_OscSrc_External);

    but " PLL_setDivideSelect(obj->pllHandle,PLL_DivideSelect_ClkIn_by_2);" should in HAL_setupPll() eidit.  by the way , I have changed the internal to external in F28069m. and I burn the IPM module . because , system clock rise twice ...so you be care for it.

     

    best regard!