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.
#include "driverlib.h" #include "device.h" uint32_t clock1=0,lowclock1=0; void main(void) { // // Disable the watchdog // SysCtl_disableWatchdog(); #ifdef CMDTOOL CMD_init(); #endif #ifdef _FLASH #ifndef CMDTOOL // // Copy time critical code and flash setup code to RAM. This includes the // following functions: InitFlash(); // // The RamfuncsLoadStart, RamfuncsLoadSize, and RamfuncsRunStart symbols // are created by the linker. Refer to the device .cmd file. // memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize); #endif // // Call Flash Initialization to setup flash waitstates. This function must // reside in RAM. // Flash_initModule(FLASH0CTRL_BASE, FLASH0ECC_BASE, DEVICE_FLASH_WAITSTATES); #endif #ifdef CPU1 // // Configure Analog Trim in case of untrimmed or TMX sample // // if((SysCtl_getDeviceParametric(SYSCTL_DEVICE_QUAL) == 0x0U) && // (HWREGH(ANALOGSUBSYS_BASE + ASYSCTL_O_ANAREFTRIMA) == 0x0U)) // { // Device_configureTMXAnalogTrim(); // } // // Set up PLL control and clock dividers // SysCtl_setClock(DEVICE_SETCLOCK_CFG); // // Make sure the LSPCLK divider is set to the default (divide by 4) // SysCtl_setLowSpeedClock(SYSCTL_LSPCLK_PRESCALE_4); // // These asserts will check that the #defines for the clock rates in // device.h match the actual rates that have been configured. If they do // not match, check that the calculations of DEVICE_SYSCLK_FREQ and // DEVICE_LSPCLK_FREQ are accurate. Some examples will not perform as // expected if these are not correct. // clock1=SysCtl_getClock(DEVICE_OSCSRC_FREQ); lowclock1=SysCtl_getLowSpeedClock(DEVICE_OSCSRC_FREQ); ASSERT(SysCtl_getClock(DEVICE_OSCSRC_FREQ) == DEVICE_SYSCLK_FREQ); ASSERT(SysCtl_getLowSpeedClock(DEVICE_OSCSRC_FREQ) == DEVICE_LSPCLK_FREQ); #ifndef _FLASH // // Call Device_cal function when run using debugger // This function is called as part of the Boot code. The function is called // in the Device_init function since during debug time resets, the boot code // will not be executed and the gel script will reinitialize all the // registers and the calibrated values will be lost. // Sysctl_deviceCal is a wrapper function for Device_Cal // // SysCtl_deviceCal(); #endif #endif // // Turn on all peripherals // // Device_enableAllPeripherals(); }
移植universalmotor_lab 到 F28379D平台上,系统时钟出现了问题,目标是配置系统时钟为200M ,低速时钟为50M,
clock1=SysCtl_getClock(DEVICE_OSCSRC_FREQ);
lowclock1=SysCtl_getLowSpeedClock(DEVICE_OSCSRC_FREQ);
但是现在用读到的时钟全部是400M 。同样的代码在其他工程上是正确的。请问这个是为什么?
查看下TRM中 Figure 3-5. Clocking System,检查下逻辑图相应位置的值是否正确:
TMS320F2837xD Dual-Core Microcontrollers Technical Reference Manual (Rev. J) (ti.com.cn)