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.

[参考译文] LP-MSPM0G3507:SPI 连接错误

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1404450/lp-mspm0g3507-spi-connection-error

器件型号:LP-MSPM0G3507
主题中讨论的其他器件:MSPM0G3507

工具与软件:

我会将我的连接、设置、示例代码以及我创建的代码发送给您。 我无法通过 SPI 接收信息。

示例代码;(用于其他 MCU)

unsigned char MFRC522_SPIreceive (unsigned char address_rcv)
    SPI_RECEIVE_ADDRESS=(((address_rcv<<1)&0x7E)| 0x80)

  SPI_NSS= 0


    SPI_WRITE_TX (SPI0、SPI_RECEIVE_ADDRESS);
    while (SPI_IS_BUSY (SPI0));

  SPI_ClearRxFIFO (SPI0);

    SPI_WRITE_TX (SPI0、dummy);
    while (SPI_IS_BUSY (SPI0));

    SPI_RECEIVED_DATA = SPI_READ_RX (SPI0);

    SPI_NSS= 1

    返回 SPI_RECEIVED_DATA;
}


void MFRC522_SPIsend (unsigned char address_sndunsigned char data_snd)
    SPI_SEND_ADDRESS=((ADDRESS_SND<<1)&0x7E);
    SPI_SEND_DATA= data_snd

   SPI_NSS= 0

   SPI_WRITE_TX (SPI0、SPI_SEND_ADDRESS);

    while (SPI_IS_BUSY (SPI0));

    SPI_WRITE_TX (SPI0、SPI_SEND_DATA);

    while (SPI_IS_BUSY (SPI0));

    SPI_NSS= 1
}

MSPM0G3507代码:

unsigned char MFRC522_SPIreceive (unsigned char address_rcv)

SPI_RECEIVE_ADDRESS=(((address_rcv<<1)&0x7E)| 0x80);

DL_SPI_setControllerCommandDataModeConfig (SPI_0_INST、1);// 1 Bayt komut gönderilecek
DL_SPI_transmitData8 (SPI_0_INST、SPI_RECEIVE_ADDRESS);

while (DL_SPI_isBusy (SPI_0_INST))


DL_SPI_setControllerCommandDataModeConfig (SPI_0_INST、1);// 1 Bayt komut gönderilecek
DL_SPI_transmitData8 (SPI_0_INST、dummy);

while (DL_SPI_isBusy (SPI_0_INST))

SPI_RECEIVED_DATA = DL_SPI_receiveDataBlocking8 (SPI_0_INST);

返回 SPI_RECEIVED_DATA;
}

void MFRC522_SPIsend (unsigned char address_snd、unsigned char data_snd)

SPI_SEND_ADDRESS=((ADDRESS_SND<<1)&0x7E);
SPI_SEND_DATA= data_snd;


DL_SPI_setControllerCommandDataModeConfig (SPI_0_INST、1);// 1 Bayt komut gönderilecek
DL_SPI_transmitData8 (SPI_0_INST、SPI_SEND_ADDRESS);

while (DL_SPI_isBusy (SPI_0_INST))


DL_SPI_setControllerCommandDataModeConfig (SPI_0_INST、1);// 1 Bayt komut gönderilecek
DL_SPI_transmitData8 (SPI_0_INST、SPI_SEND_DATA);

while (DL_SPI_isBusy (SPI_0_INST))


}