Part Number: TMS320F2800157
Other Parts Discussed in Thread: C2000WARE
Hi,
I am integrating a SPI EEPROM with my system and have followed the SPI EEPROM example in C2000Ware 5.04. One of the calls that aren't used in the example but is referenced is SPI_receiveNBytes. Since I want to read a longer string of bytes in at a time, I thought this call would be benificial.
I noticed the example is designed around an EEPROM that only requires 16 bits of address and mine requires 24. Thus I have made that modification to send the 24 bits of address. This works with SPI_receive32Bits correctly.
In the snip-it below I include both calls, and swapped between the SPI_receive32Bits and SPI_receiveNBytes. The snip-it shows SPI_receiveNBytes commented out because I used SPI_receive32Bits in my last run.
My problem is that both calls do not return the same data. I know that SPI_receive32Bits only receives 32 bits, but those 32 bits recieved are correct.
A little more info on SPI_receiveNBytes. I'm supplying length = 8 (bytes) and txdly = NO_DELAY.
Can you please show me where I'm falling in the pit?
// 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);
RXdata = SPI_receive32Bits(SPIA_BASE, SPI_DATA_LITTLE_ENDIAN, DUMMY_DATA, txdly);
CS_HIGH;
}