Other Parts Discussed in Thread: C2000WARE
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号: TMS320F2800157
主题: C2000WARE 中讨论的其他器件
您好、
我使用 C2000Ware 5.04 中的 SPI EEPROM 示例 开发以下代码、以便从使用 24 位寻址的 EEPROM 中读取数据。 下面的代码发送 24 位地址、但如果我尝试寻址超过 255(8 位)的任何地址、SPI 总线上的位模式不正确(从示波器查看)、我收到错误。
任何见解都将有帮助!
// 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;
}