The function must be called before the master starts the transfer.
Do you use the Lpspi_Ip_GetStatus() to check the transfer?
Does the transfer completed successfully?
Thanks,
Daniel
Hi @龙开云,
If this failure rate depends on the baud rate, can you examine the SPI signals using an oscilloscope and ensure that it is within the SPI specification (DS rev8, Table 44. LPSPI)
Thank you,
BR, Daniel
Hi @龙开云,
What is in the Spi1TxBuffer?
Why do you call the AsyncTransfer() in a while loop?
Also, you cancel the transfer if the GetStatus() function returns other status that IDLE.
You should simply call the AsyncTransfer() once and then poll the GetStatus() function until the transfer is completed, and you have to make sure the AsyncTransfer() function is called before the Master starts the transfer.
Please share the project?
Regards,
Daniel
1.Spi1TxBuffer is 0x00
2.Why do you call the AsyncTransfer() in a while loop? 没有一直loop这个,需要传输新的数据并且上一次传输完成才会调用;
3.是在AsyncTransfer()调用后的时候使用GetStatus()来检测是否空闲。
工程没法共享哦,涉及的代码太多。
主要是第一个位为何会主动拉高一下,因为填充的数据都为0,没理解内部如何产生;
Hi @龙开云,
Is the pointer to Spi1TxBuffer 0x00 (NULL) or is the pointer valid and the content of the buffer is 0x00.
Because if the pointer is NULL, the driver sends the SpiDefaultData.
Regards,
Daniel
It really requires some debugging on your side.
For example, you can use a GPIO to see when the transfer starts and ends.
Use another communication interface to send the state of the LPSPI TX FIFO.
Also, as I mentioned, there are issues in the code you posted, like you cancel the transfer if the function does not return SUCCESS. You disable the interrupt before the code reads the status of the previous transfer in a while loop etc.
I would recommend simplifying the project, and using at least the GPIOs.
I guess there must be some data left in the TX FIFO from a previous transfer when the current transfer starts.
Regards,
Daniel