AnsweredAssumed Answered

How to send SPI data via interrupt?

Question asked by miroslavmartisek on Mar 6, 2017
Latest reply on Mar 15, 2017 by Kerry Zhou

Hi everybody,


I would like to send block of data using SPI interface and relevant interrupt. In CW there is function "byte SM1_SendBlock(SM1_TComData *Ptr, word Size, word *Snd)", but I think, it is blocking. My aim is to fill output buffer and then to use interrupt to dispatch it away without waiting in the loop.


My current solution of this problem is:

a) in main loop I activate interrupt from SPI (SM1_OnTxChar) and then I send one byte from buffer via byte SM1_SendChar(SM1_TComData Chr) function

b) in interrupt routine I use the same function to dispatch the rest of data


It works, but in my opinion this way is not so elegant. Is there any method to start interrupt without first call of function mentioned in the point a) above? For example set up the flag of this interrupt and so induce it "artificially"?


Thank you a lot.




P.S.: I know DMA, but I am not familiar with it...... My platform is FRDM-KL25Z