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.

[参考译文] TMS320F2800157:向 SPI EEPROM 发送 24 位地址

Guru**** 2782625 points

Other Parts Discussed in Thread: C2000WARE

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1614038/tms320f2800157-sending-24-bit-address-to-spi-eeprom

器件型号: 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;
}
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、John:

    让我明天再回到您的身边。

    此致、

    Aishwarya

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    谢谢,我可以节省你的麻烦,因为修复是在一次送一个字节的地址   SPI_transmitByte.

    // 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 24-bit address to read data. The call must be fed a byte at a time
        SPI_transmitByte(SPIA_BASE, (address>>16) & 0xFF);
        SPI_transmitByte(SPIA_BASE, (address>>8) & 0xFF);
        SPI_transmitByte(SPIA_BASE, address & 0xFF);
    
        // Receive length number of bytes
        SPI_receiveNBytes(SPIA_BASE, data, length, txdly);
    
         CS_HIGH;
    }