[En-Nut-Discussion] RFC: spibus: Return status of MISO line with transfer with xlen == 0;

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Wed Sep 7 19:54:04 CEST 2016

>>>>> "Ole" == Ole Reinhardt <ole.reinhardt at embedded-it.de> writes:

    Ole> Hi Uwe, you wrote "owidriver", but you mean "spibus driver", right?

    Ole> I thought a little about this idea. Such a function should ideally
    Ole> be implemented as IOCTL to the driver. Unfortunately the SPI-bus is
    Ole> not a NUTDEVICE and therefore can not implement IOCTLs.

    Ole> Personally I think this is a very special function of this special
    Ole> SPI client device. So it might be a good idea to implement it as a
    Ole> IOCTL of the SPI node driver?

A short web search for "SPI POLL MISO brings up:
"The cc1200 requires the cpu wait until the MISO goes low after dropping CS
before talking with the chip"

and for the EM9301:
1) The host sets MOSI signal to `1'
2) The host shall activate CSN after 100ns
3) The host shall poll MISO line. The first polling shall be done at least
   100 ns after CSN is activated.
4) If MISO = '0' then the controller reception buffer is full and the host
   is not allowed to start the transaction.

So there is a class of SPI devices needing that poll.

    Ole> If not, I personally would suggest to implement a special API call
    Ole> like

    Ole> int NutSpiBusGetMISOLine(NUTSPINODE * node).

Polling is much more like a zero length transfer than an IoCtl. And
introducing an IoCtl function to the spibus driver will need more changes
and more ram for the driver function table.

Why do you prefer changing the Api interface versus changing an Api return

The return value of the poll could also be written to dout of the transfer,
not changing the API at all. Would that be more acceptable?

    Ole> Any further ideas?

    Ole> Btw: there is another LPC SPI driver beside of
    Ole> "nut/arch/cm3/dev/nxp/lpc176x_spi.c":

    Ole> nut/arch/cm3/dev/nxp/lpc17xx_ssp.c

Will care for that driver too...

Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 1623569 ------- Fax. 06151 1623305 ---------

More information about the En-Nut-Discussion mailing list