SPI OnBlockSent too early

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SPI OnBlockSent too early

Jump to solution
592 Views
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!

Tags (2)
0 Kudos
1 Solution
427 Views
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

View solution in original post

0 Kudos
2 Replies
428 Views
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 Kudos
427 Views
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 Kudos