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.

TMS320F28377D: 使用TI的C2000例程库,在spi模块中从机无法发送数据给主机。

Part Number: TMS320F28377D

使用TI的C2000例程库,在spi模块例程中,配置了两个SPI模块:SPIA and SPIB A为SLAVE B为MASTER 模块B发送数据给模块A时,可以正常接受数据。当把配置改为A为MASTER B为SLAVE时,使用相同的发送代码,模块B无法发送数据给模块A,请问下该问题的原因和解决办法。谢谢。

  • 你好,工程师将在工作时间为你解答。

  • 你好,具体使用的是哪个例程?例程中具体又是修改的哪些语句呢?方便的话还请标示清楚。
    另外,有没有测试过各个SPI引脚接口是否有信号?

  • 你好,例程名称为spi_ex3_external_loopback_fifo_interrupts,我更改的代码部分为配置GPIO部分,更换了具有相同SPI复用功能的GPIO引脚。原例程是将SPIA配置为SLAVE, SPIB为MASTER,我更改了配置,将SPIB配置为SLAVE,SPIA配置为MASTER.发送与接收数据函数没有进行更改。以下为我更改后的代码,麻烦你看一下。

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    //#############################################################################
    //
    // FILE: spi_ex3_external_loopback_fifo_interrupt.c
    //
    // TITLE: SPI Digital Loopback with FIFO Interrupts
    //
    //! \addtogroup driver_example_list
    //! <h1>SPI Digital External Loopback with FIFO Interrupts</h1>
    //!
    //! This program uses the external loopback between two SPI modules. Both
    //! the SPI FIFOs and their interrupts are used. SPIA is configured as a slave
    //! and receives data from SPI B which is configured as a master.
    //!
    //! A stream of data is sent and then compared to the received stream.
    //! The sent data looks like this: \n
    //! 0000 0001 \n
    //! 0001 0002 \n
    //! 0002 0003 \n
    //! .... \n
    //! FFFE FFFF \n
    //! FFFF 0000 \n
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • 你好,收到了,我会跟其他工程师确认一下之后回复你,还请耐心等待。

  • 你好,抱歉回复晚了,对方回复:

    In a SPI communication, the master should always initiate the transfer. In this code you have shared, only SPIB (slave) is transmitting the data. The data is not send out on lines till the master SPI initiates a transfer. If there is no data to be sent from the master node, you could send some dummy data.