Other Parts Discussed in Thread: C2000WARE
器件型号: TMS320F2800157
主题: C2000WARE 中讨论的其他器件
您好、
我正在将 SPI EEPROM 与我的系统集成、并且已经按照 C2000Ware 5.04 中的 SPI EEPROM 示例进行了操作。 示例中未使用但引用的调用之一是 SPI_receiveNBytes。 因为我想一次读一个更长的字串,我认为这种调用将是肤浅的。
我注意到该示例是围绕 EEPROM 设计的、只需要 16 位地址、我的需要 24 位地址。 因此、我进行了相应修改以发送 24 位地址。 这适用于 SPI_receive32Bits。
在下面的监听中、我包含这两个调用、并在 SPI_receive32Bits 和 SPI_receiveNBytes 之间交换。 snip-it 显示了 SPI_receiveNBytes 注释掉、因为我在上次运行中使用了 SPI_receive32Bits。
我的问题是两个呼叫都不会返回相同的数据。 我知道 SPI_receive32 位仅接收 32 位、但接收到的这 32 位是正确的。
更多有关 SPI_receiveNBytes 的信息。 我提供的长度= 8(字节)、txdly = no_delay。
您能告诉我我我在坑里的下落吗?
// 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;
}