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.

[参考译文] TMS570LS1224:如何安全地对 SPI 轮询方法进行编码?

Guru**** 2473270 points
Other Parts Discussed in Thread: HALCOGEN

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/683690/tms570ls1224-how-to-code-spi-polling-method-safely

器件型号:TMS570LS1224
主题中讨论的其他器件:HALCOGEN

你(们)好。 由于我的主 SPI 控制2从器件、控制它的正确、良好、安全的方法是什么? 我想我不能总是写这样的东西、

   while ((spiREG4->FLG & 0x0200)=0);
   spiREG4->DAT1 = 0x0080 | 0x10FE0000;    //发送前8位

   while ((spiREG4->FLG & 0x0200)=0);
   spiREF4->DAT1 =(val & 0xFF)| 0x00FE0000; //发送第二个8位

因为我不需要这样的死区环路。 是否有任何安全的轮询方法? 如果不是、那么我们必须使用中断方法吗?

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

    为了与2个从器件通信、应该使用两个芯片选择(CS)。

    HALCoGen 生成的代码具有用于在轮询模式下发送数据和接收数据的函数:

    uint32 spiTransmitData (spiBASE-t * SPI、spiDAT1_t *数据通信 fu_t、uint32块大小、uint16 * srcbuff)



    uint32 piReceiveData (spiBASE-t * SPI、spiDAT1_t * dataconfi_t、uint32 blocksize、uint16 * destbuff)