SPI OnBlockSent too early

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

SPI OnBlockSent too early

ソリューションへジャンプ
1,217件の閲覧回数
trow
Contributor I

Im Using Processor Expert to write Code for an SPI Application (KL26z Eval Board). Now I'm having problems with the SPI OnBlockSent() function. It seams as this event is called when all Data is written to the SPI Buffer, but the Data is not yet written out. But I need to know when the Data is really sent out to the BUS. Is there any possibility?

Main:

  SPI_DataSentFlag = FALSE;

  Error = SPI0_SendBlock(SPI0_DeviceData , OutData, BLOCK_SIZE);    /* Start transmission/reception */

  while (!SPI_DataSentFlag) {};                            /* Wait until data block is transmitted/received */

-> this place is reached before the whole Data is sent out to the BUS.

  Event.c:

  void SPI0_OnBlockSent(LDD_TUserData *UserDataPtr)

  {

    SPI_DataSentFlag = TRUE;

  }

Thanks a lot!

タグ(2)
0 件の賞賛
返信
1 解決策
1,052件の閲覧回数
Petr_H
NXP Employee
NXP Employee

Hi,


yes, the OnBlockSent is called when the data are written to the output buffer and it signals that you can continue sending next data.

To be sure that the data went out to the bus (and back as SPI does always both sending and reception at once), you need to use OnBlockReceive event or you can call GetBlockReceivedStatus to get the information.

Best regards

Petr Hradsky

Processor Expert Support Team

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,053件の閲覧回数
Petr_H
NXP Employee
NXP Employee

Hi,


yes, the OnBlockSent is called when the data are written to the output buffer and it signals that you can continue sending next data.

To be sure that the data went out to the bus (and back as SPI does always both sending and reception at once), you need to use OnBlockReceive event or you can call GetBlockReceivedStatus to get the information.

Best regards

Petr Hradsky

Processor Expert Support Team

0 件の賞賛
返信
1,052件の閲覧回数
trow
Contributor I

Thanks Petr!

This is the solution to my problem! Now I get an interrupt when the whole data is transmitted on the BUS.

0 件の賞賛
返信