AnsweredAssumed Answered

modified methods for SPI module

Question asked by mehdikarimibiuki on Feb 27, 2014

I have MK10DN512Z VLL10 and using bareboard in codewarrior with PE attached.


I don't want to use SendBlock and ReceiveBlock methods that PE generates for SPI, because, with these methods I have to tell what is the size of my data, and since I am slave I cannot tell what is the size. Sometimes, master sends me 1 block (16bits), sometimes 2 blocks (32bits) and sometimes 4 blocks (64bits).

This is my SPI0 setup in PE (SPI0 is as slave):


No since I did not used those SPI PE methods (SendBlock and ReceiveBlock), I created my owen in the interrupt event and also modified the ISR as below:



and also here is my onBlockReceived:

received spi.PNG.png

this works fine unless for the time that I receive two interrupt events for every 2 and 4 block (32bits and 64bits) sendings. I don't know why?


One possible solution I was thinking is maybe I can go back to using SendBlock and ReceiveBlock functions provided by PE and use them in onBlockReceived event method, but for that I need to know the size that I am receiving? Is there any smart way for this?