我想测一下28027板子的XCLKOUT信号的波形,可是一直是高电平。
我用的官方例程定时器的例子,其中有初始化:
void InitPeripheralClocks(void)
{
EALLOW;
// LOSPCP prescale register settings, normally it will be set to default values
GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 3; // GPIO18 = XCLKOUT
SysCtrlRegs.LOSPCP.all = 0x0002;
// XCLKOUT to SYSCLKOUT ratio. By default XCLKOUT = 1/4 SYSCLKOUT
SysCtrlRegs.XCLK.bit.XCLKOUTDIV=2; // Set XCLKOUT = SYSCLKOUT/1
// Peripheral clock enables set for the selected peripherals.
// If you are not using a peripheral leave the clock off
// to save on power.
//
// Note: not all peripherals are available on all 2802x derivates.
// Refer to the datasheet for your particular device.
//
// This function is not written to be an example of efficient code.
SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1; // ADC
SysCtrlRegs.PCLKCR3.bit.COMP1ENCLK = 1; // COMP1
SysCtrlRegs.PCLKCR3.bit.COMP2ENCLK = 1; // COMP2
SysCtrlRegs.PCLKCR3.bit.CPUTIMER0ENCLK = 1; // CPU Timer-0
SysCtrlRegs.PCLKCR3.bit.CPUTIMER1ENCLK = 1; // CPU Timer-1
SysCtrlRegs.PCLKCR3.bit.CPUTIMER2ENCLK = 1; // CPU Timer-2
SysCtrlRegs.PCLKCR1.bit.ECAP1ENCLK = 1; // eCAP1
SysCtrlRegs.PCLKCR1.bit.EPWM1ENCLK = 1; // EPWM1
SysCtrlRegs.PCLKCR1.bit.EPWM2ENCLK = 1; // EPWM2
SysCtrlRegs.PCLKCR1.bit.EPWM3ENCLK = 1; // EPWM3
SysCtrlRegs.PCLKCR1.bit.EPWM4ENCLK = 1; // EPWM4
SysCtrlRegs.PCLKCR3.bit.GPIOINENCLK = 1; // GPIO
SysCtrlRegs.PCLKCR0.bit.HRPWMENCLK=1; // HRPWM
SysCtrlRegs.PCLKCR0.bit.I2CAENCLK = 1; // I2C
SysCtrlRegs.PCLKCR0.bit.SCIAENCLK = 1; // SCI-A
SysCtrlRegs.PCLKCR0.bit.SPIAENCLK = 1; // SPI-A
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1; // Enable TBCLK within the EPWM
EDIS;
}
// LOSPCP prescale register settings, normally it will be set to default values
GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 3; // GPIO18 = XCLKOUT
SysCtrlRegs.LOSPCP.all = 0x0002;
// XCLKOUT to SYSCLKOUT ratio. By default XCLKOUT = 1/4 SYSCLKOUT
SysCtrlRegs.XCLK.bit.XCLKOUTDIV=2; // Set XCLKOUT = SYSCLKOUT/1
上面两句就是初始化XCLKOUT的,GPIO18是XCLKOUT功能,它的频率等于SYSCLKOUT。
为什么没有波形呢?请高手指教,谢谢!
|