LM3S的SPI,用SPI读写TC72一直都不到数据,设置如下。
// Enables a peripheral SSI0
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
// Configures pin(s) for use by the SSI peripheral
// PA2 SSI0CLK(SSCK) PA4 SSI0RX(MISO) PA5 SSI0TX(MOSI)
GPIOPinTypeSSI(GPIO_PORTA_BASE, (GPIO_PIN_2 | GPIO_PIN_4 | GPIO_PIN_5));
// PA2 SSI0CLK(SSCK)
//GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2);
// PA4 SSI0RX(MISO)
//GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_4);
// PA5 SSI0TX(MOSI)
//GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5);
// Disables the synchronous serial interface
SSIDisable(SSI0_BASE);
// Configure the SSI, 1MHZ
SSIConfigSetExpClk(SSI0_BASE, // Base
//SysCtlClockGet(), // SSIClk
20000000, // 5MHZ
SSI_FRF_MOTO_MODE_1, // Protocol
SSI_MODE_MASTER, // Mode
1000000, // BitRate
8 // DataWidth
);
// Enables the synchronous serial interface
SSIEnable(SSI0_BASE);
有用模块读写SPI EEPROM的吗?
// CS 25LC256
CS_25LC256 = 0;
// Write Enable
//SSIDataPut(SSI0_BASE, 0x06);
// Read data from memory array beginning at selected address
SSIDataPut(SSI0_BASE, 0x03);
SSIDataPut(SSI0_BASE, 0x00);
SSIDataPut(SSI0_BASE, 0x00);
//while((HWREG(SSI0_BASE + SSI_O_SR) & 0x04) == 0x04)
//{ SSIDataGet(SSI0_BASE, pulData);}
SSIDataPut(SSI0_BASE, 0xFF);
SSIDataGet(SSI0_BASE, pulData++);
CS_25LC256 = 1;
读不到数据? |