LPC54xxx SPI_MasterHalfDuplexTransferBlocking bug?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC54xxx SPI_MasterHalfDuplexTransferBlocking bug?

799 次查看
Anonymous
不适用

Hi,

I just stumbled upon a possible bug in the SPI driver of the LPCXpresso54608 SDK (SDK version 2.5.0)

If the SPI_MasterHalfDuplexTransferBlocking function is used to only write data, the SPI signals are in a wrong state after this function finishes.

E.g: if the clock polarity is "active high" (low in stand by), the clock will be low before the transfer but it will stay high at the end of the transfer.

Looking at the source code, I see that the HalfDuplexTransfer functions calls the SPI_MasterTransferBlocking twice; first with the tx (or rx) data and a second time for the rx (or tx) data. But no check is done to see if the dataSize is 0.

This results in an invalid situation where MasterTransferBlocking() is being requested to send (or receive) 0 bytes.

My easy fix is to use the SPI_MasterTransferBlocking() but then I need to have an extra variable for the xfer parameter.

I implemented a final fix by adding an extra check in the HalfDuplexTransfer to check on both instances for a valid dataSize.

The SPI_MasterTransferBlocking() function has a parameter check at the start of a function but there is no check on the dataSize. Adding this check will make sure that the driver does not leave the SPI pins in an incorrect state.

Regards,

Rob

标记 (2)
0 项奖励
3 回复数

651 次查看
soledad
NXP Employee
NXP Employee

Hi, 

Thank you for your feedback. Could you please try using the MCUXpresso SDK 2.6? 

For SDK 2.5, the SPI driver version is 2.0.4.
• 2.0.4
– Bug fix:
* Fixed the bug of using read only mode in DMA transfer. In DMA transfer mode, if transfer->txData is NULL, code attempts to read data from the address of 0x0 for configuring the last frame.

Regards

Soledad

0 项奖励

651 次查看
Anonymous
不适用

Hi,

I just downloaded 2.6.0, there are no actual changes between this one and 2.5 except for a small change in the SPI_FIFO_DEPTH macros

Rob

0 项奖励

651 次查看
soledad
NXP Employee
NXP Employee

Hi, 

Could you tell me which exactly demo you run for testing, in addition, could you please add the modification about the demo?
As I'd like to replicate the phenomenon on my site for checking.

Have a great day,
Soledad

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 项奖励