Page 1 of 4

SPI Slave Driver

Posted: Thu Feb 25, 2016 3:37 pm
by Tabulous
Hi Did this ever get implemented ?

There was alot of talk about it pre 3.0

Re: SPI Slave Driver

Posted: Thu Feb 25, 2016 4:44 pm
by Giovanni
Not yet, I have no a clear idea of how a SSPI API should look like.

Giovanni

Re: SPI Slave Driver

Posted: Thu Feb 25, 2016 5:01 pm
by Tabulous
Giovanni wrote:Not yet, I have no a clear idea of how a SSPI API should look like.

Giovanni


I'm trying to hack together something using the SPIv1 (on F103) setting up should not be an issue as just needed to let the lower level driver know its either Master or Slave, do this by adding another variable to the SPIConfig struct.


The issue will be around what does one do to wait for incoming data from SPI master ?


Do you have any ideas ? Would be nice a callback interface, so every reception from the SPI you get a callback where you can process the recieved data and then send back response message.

Re: SPI Slave Driver

Posted: Thu Feb 25, 2016 5:25 pm
by Giovanni
The problem is when you have a scenario when the incoming data is not of fixed size (you can hack the existing driver for that). Imagine having to implement an SD/MMC card in SPI mode, a driver should be flexible enough to allow something like that.

Giovanni

Re: SPI Slave Driver

Posted: Fri Feb 26, 2016 10:11 am
by Tabulous
If the data is fixed length, then will the current driver able able to receive data and send data when set in slave mode ?

if so what is the best method / API calls i.e

spiExchange(&SPID1, 1, txbuf, rxbuf); /* Atomic transfer operations. */

or

spiReceive
spiSend

Re: SPI Slave Driver

Posted: Fri Feb 26, 2016 10:25 am
by Giovanni
I know somebody did it, I have no details.

I think you can use any of those functions, depending on what you need to do.

Giovanni

Re: SPI Slave Driver

Posted: Fri Feb 26, 2016 2:21 pm
by Tabulous
Giovanni wrote:I know somebody did it, I have no details.

I think you can use any of those functions, depending on what you need to do.

Giovanni


but i believe they used a raw interface not the dma one as used by the current driver.

So not sure if the dma will cause me issues

Re: SPI Slave Driver

Posted: Fri Feb 26, 2016 2:46 pm
by Giovanni
Tabulous wrote:
Giovanni wrote:I know somebody did it, I have no details.

I think you can use any of those functions, depending on what you need to do.

Giovanni


but i believe they used a raw interface not the dma one as used by the current driver.

So not sure if the dma will cause me issues


It does: you need to know the transfer size beforehand.

Giovanni

Re: SPI Slave Driver

Posted: Fri Feb 26, 2016 2:56 pm
by Tabulous
transfer size before hand is not an issue, lets say it is 10bytes everytime

then should the current dma based API calls like spiRecieve work ok ?

Re: SPI Slave Driver

Posted: Fri Feb 26, 2016 3:01 pm
by Giovanni
It should, you will know for sure after testing it :)

Giovanni