modified methods for SPI module

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

modified methods for SPI module

790 Views
mehdikarimibiuk
Contributor V

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):

9976_9976.pngspi0.PNG.png

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:

9984_9984.pngisr1.PNG.png

9983_9983.pngisr2.PNG.png

and also here is my onBlockReceived:

9985_9985.pngreceived 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?

Labels (1)
0 Kudos
Reply
0 Replies