AnsweredAssumed Answered

How to receive arbitrary number of bytes through SPI DMA (Kinetis SDK)?

Question asked by Alex Martir on Jan 3, 2017
Latest reply on Jan 10, 2017 by xiangjun.rong

Hi,

 

I have a KS22 controller that is configured as a SPI slave device. Another microcontroller (SPI Master) wishes to send some arbitrary number of bytes (not much, maybe 15 to 200 bytes at a time). Now, I've configured the KS22 to use SPI over DMA and noticed that I have to define how much data I wish to send/receive in order for the DMA interrupt to trigger. This is not ideal for me since I don't know how much data the Master is going to send beforehand.

 

My question is, without having to provide some kind of handshake (meaning, the Master having to send some pre-defined header before the actual data), how can the KS22 slave device receive arbitrary number of bytes using the SPI DMA provided code (Kinetis SDK)?  I notice that whenever the Master de-asserts the Chip Select line, the SPI Slave does not interrupt. What I would like is for the Slave to provide a big enough receive buffer (256 bytes should be enough for my application). As soon as either the buffer gets full, or Chip Select is de-asserted, the low layer SPI DMA should interrupt me. Is this possible with the current Kinetis SDK?

 

Thank you for taking the time to read through this post.

 

Alex

Outcomes