Part Number: LAUNCHXL-F280049C
Other Parts Discussed in Thread: C2000WARE
Tool/software: Code Composer Studio
Hi all:
I am now trying to modify the SPI example code which is "C2000_LAUNCHPAID\software_install\C2000Ware_3_02_00_00\driverlib\f28004x\examples\spi\spi_ex4_eeprom.c".
I don't very undestand these three functions which are "readStatusRegister()" and "SPI_writeDataBlockingNonFIFO", "SPI_readDataBlockingNonFIFO".
What do these functions for? If I don't use these functions, what kinds of errors will occur? Do the "readStatusRegister()" just for checking the SPI bus is busy or not? or check the INT_FLAG?
Also, I don't really understand these marcons for(see below). I don't find them in datasheet.
#define RDSR 0x0500 #define READ 0x0300 #define WRITE 0x0200 #define WREN 0x0600 #define WRDI 0x0400 #define WRSR 0x0100
uint16_t readStatusRegister(void)
{
uint16_t temp;
//
// Pull chip select low.
//
CSCON_TXLOW;
//
// Send RDSR opcode
//
SPI_writeDataBlockingNonFIFO(SPIA_BASE, RDSR);
//
// Dummy read to clear INT_FLAG.
// spi read rxbuf will clear INT_FLAG
temp = SPI_readDataBlockingNonFIFO(SPIA_BASE);
//
// Send dummy data to receive the status.
//
SPI_writeDataBlockingNonFIFO(SPIA_BASE, 0x0000);
//
// Read status register.
//
temp = SPI_readDataBlockingNonFIFO(SPIA_BASE);
//
// Pull chip select high.
//
CSCON_TXHIGH;
//
// Read the status from the receive buffer
//
return(temp);
}
If I just want communicate peripherals through SPI with non-FIFO, what should I modify in example code?