Part Number: TMS320F2800157
Other Parts Discussed in Thread: C2000WARE
Hi,
I used the SPI EEPROM example in C2000Ware 5.04 to develop the code below to read from my EEPROM which uses 24-bit addressing. The code below sends out the 24-bit address, but if I try to address anything over 255 (8 bits) the bit pattern on the SPI bus is incorrect (viewing from a scope) and I get an error.
Any insight will be helpful!
// Function to read data from the EEPROM
// - address is the byte address of the EEPROM
// - data is a pointer to an array of data being received
// - length is the number of characters in the array to receive
void PR_ReadData(uint32_t address, uint16_t *data, uint16_t length, uint16_t txdly)
{
uint32_t RXdata = 0;
CS_LOW;
// Send the READ opcode.
SPI_transmitByte(SPIA_BASE, READ);
// Send EEPROM 24bit address to write data
SPI_transmitByte(SPIA_BASE, address>>16);
SPI_transmitByte(SPIA_BASE, address>>8);
SPI_transmitByte(SPIA_BASE, address);
// Receive length number of bytes
SPI_receiveNBytes(SPIA_BASE, data, length, txdly);
CS_HIGH;
}