SPI Interrupt Mode on MQX 3.6

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

SPI Interrupt Mode on MQX 3.6

1,071 Views
w2vy
Contributor V

I have an application where I periodically dump a buffer of data out a SPI port.

 

I want to be able to write() the data without waiting around for it to complete, so I have been trying to use ISPI0:

and I have made the TX buffer large enough to hold my whole message.

 

Will the driver turn off CS when it completes the write?

 

I am testing on a M52259DEMO board

 

tom

0 Kudos
3 Replies

346 Views
w2vy
Contributor V

I was able to run the SPI CLK at 10Mhz and the transfer took only 300us so waiting around for it to complete is not a problem.

 

If it were the next best soution would require an extra buffer and a task to do the write..

 

tom

0 Kudos

346 Views
w2vy
Contributor V

Now this is strange...

 

ISPI0: is implemented as a NON_BLOCKING I/O request

 

SPI0: is implrmented as a BLOCKING I/O is request

 

IMHO: If you want Interrupt I/O you want it to be fast, so maybe ISPI0 should also be blocking.

That way you do not have to poll(sic) the file handle to push the data out.

 

tom

0 Kudos

346 Views
PetrM
Senior Contributor I

CS is not deasserted after write, you have to call fflush() to do that - this function also waits until all bytes are transmitted.

Interrupt mode let's you to write, in the meanwhile do some other stuff, and finally finish the transfer using blocking fflush().

 

PetrM

 

0 Kudos