AnsweredAssumed Answered

How to shoot the trouble?

Question asked by guo huoping on Nov 14, 2014
Latest reply on Nov 26, 2014 by guo huoping

I create a project in KDS, and it use MK10DX256VLH7. Now, I have a question to ask for your help.

I use PE to initial a SPI component, which involve Input interrupt and Output interrupt,and at the initial progress, PE auto enable SPI component also.Then, I define two variables, spi_tx_fin and spi_rx_fin. In the project, PE create two event functions, void SPI_OnBlockReceived(LDD_TUserData *UserDataPtr) and void SPI_OnBlockSent(LDD_TUserData *UserDataPtr). For the convenience of polling SPI transmit and/or receive progress success or not, I write the code: spi_tx_fin = Yes and spi_rx_fin = Yes  (Macro: Yes=1, No=0) in the two event functions respectively. Afterward, I define another function MotorInit(), which call function  LDD_TError SPI_SendBlock(LDD_TDeviceData *DeviceDataPtr, LDD_TData *BufferPtr, uint16_t Size) generated by PE to transmit data on the SPI module. The code as follows:

 

  spi_tx_fin = No;

  SPI_SendBlock(pSPI,if_configuration_429.buffer,4);

  while(spi_tx_fin == No);

 

Unfortunately, when debug program, the progress was blocked here while(spi_tx_fin == No); I checked the debug progress and was sure in the event function void SPI_OnBlockSent(LDD_TUserData *UserDataPtr) the variable spi_tx_fin was set Yes

 

By the way, I offer my project to you. Thank you!

Original Attachment has been moved to: workspace.kds.rar

Outcomes