This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F280049C: C2000 Ware spi_ex4_eeprom example

Part Number: TMS320F280049C

Hello TI-Support-Team,

I read over the spi_ex4_eeprom example as a start-point for my driver implementation. Now I am a little bit confused by the comment lines: 

//
// SPI configuration. Use a 2MHz SPICLK and 8-bit word size.
//
SPI_setConfig(SPIA_BASE, DEVICE_LSPCLK_FREQ, SPI_PROT_POL0PHA1,
SPI_MODE_MASTER, 1000000, 8);

This sets the eeprom to 1Mhz, not 2 MHz or did I get sth wrong from the documentation? I think setting it to:

SPI_setConfig(SPIA_BASE, DEVICE_LSPCLK_FREQ, SPI_PROT_POL0PHA1,
SPI_MODE_MASTER, 2000000, 8);
should set it to 2 MHz.

Furthermore, I think the lines: 

//
// Enable wirte on the EEPROM
//
enableWrite();

//
// Wait until the EEPROM is ready to write data
//
while(readStatusRegister() & MSG_STATUS_WRITE_READY_M == MSG_STATUS_WRITE_READY_M)
{
}

//
// Write to the EEPROM
//
writeData(EEPROM_ADDR, writeBuffer, NUM_BYTES);

are confunsing, too. Here 

(readStatusRegister() & MSG_STATUS_WRITE_READY_M == MSG_STATUS_WRITE_READY_M) 
is the same as
while(readStatusRegister() & MSG_STATUS_READY_M == MSG_STATUS_READY_M)

since == has a higher precedence than &, resulting in leaving the while loop even if the write enabled bit is not set. I know it is just an example, but maybe you can correct that in an newer versions of the C2000 driverlib.

Thanks in advance.