目前我设置完SSI的模块后,使用SSIDataPut(SSI2_BASE,0x0f);发送数据,发现GPIO口无任何响应,示波器也无法检测到信号。
请问是否哪里设置错误,希望得到指正,我的芯片外部时钟频率为25M。谢谢!
函数是这样的:
void InitGpio(){
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
HWREG(GPIO_PORTB_BASE + GPIO_O_PCTL) |= GPIO_PCTL_PB0_SSI2TX |GPIO_PCTL_PB1_SSI2RX |GPIO_PCTL_PB2_SSI2CLK |GPIO_PCTL_PB3_SSI2FSS; //设置PB0为SSI2TX ,PB1为_SSI2RX,PB2为SSI2CLK ,PB3为SSI2FSS
SSIConfigSetExpClk(SSI2_BASE,SysCtlClockGet(25000000),SSI_FRF_MOTO_MODE_3,SSI_MODE_MASTER,2000000,8);
SSIEnable(SSI2_BASE);
SSIDataPut(SSI2_BASE,0x0f); //发送一个数据
}
int main(void) {
//Disable Protection
unsigned char ledshow[6],i,key;
HWREG(SYSCTL_MWRALLOW) = 0xA5A5A5A5;
// Sets up PLL, M3 running at 100MHz and C28 running at 100MHz
SysCtlClockConfigSet(SYSCTL_USE_PLL | (SYSCTL_SPLLIMULT_M & 0x8) |
SYSCTL_SYSDIV_1 | SYSCTL_M3SSDIV_1|SYSCTL_XCLKDIV_4);
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
FlashInit();
SysCtlPeripheralDisable(SYSCTL_PERIPH_WDOG1);
SysCtlPeripheralDisable(SYSCTL_PERIPH_WDOG0);
IntMasterEnable();
InitGpio();//设置ssi模式并发送数据
while(1){
}
}
Eric Ma:
你选择SSI2在PB的GPIO口,需要配置GPIO的外设模式为alternate peripheral模式。
需要设置寄存器GPIOAPSEL。建议你调用如下的函数:
GPIOPinConfigure(GPIO_PA2_SSI0CLK); GPIOPinConfigure(GPIO_PA3_SSI0FSS); GPIOPinConfigure(GPIO_PA4_SSI0RX); GPIOPinConfigure(GPIO_PA5_SSI0TX);
// Configure the GPIO settings for the SSI pins. This function also gives // control of these pins to the SSI hardware. Consult the data sheet to // see which functions are allocated per pin. // The pins are assigned as follows: // PA5 – SSI0Tx // PA4 – SSI0Rx // PA3 – SSI0Fss // PA2 – SSI0CLK // TODO: change this to select the port/pin you are using. GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 | GPIO_PIN_2);
Eric