Raspberry Pi SPI device example?

Luiz Otavio O Souza lists.br at gmail.com
Tue Mar 10 04:00:39 UTC 2015


On 6 March 2015 at 15:19, Milan Obuch wrote:
> Now there is another problem to solve - there are two devices on the
> spibus0, ILI9341 and STMPE610, on chip selects 0 and 1 respectively.
> In the end, there will be 'ili' driver for the former and 'tsc' driver
> for the later. Both will use SPIBUS_TRANSFER to transfer their
> respective bytes, but could they interfere as they are on the same bus?
> Is it necessary to use some kind of protection against that or does spi
> bus driver ensure transfers cound not interfere?

The SPI support is very simple at moment, there is no bus
serialization and neither userland access.

At least on RPi, each SPI transfer is serialized by the driver, so
once a thread start a transfer, any other transfers will be put to
sleep until the first one finishes.  The problem is only if you need
to guarantee that consecutive transfers to the same device won't be
interrupted by another threads (e.g. in a read-modify-write cycle).

I hope to eventually fix this (unless someone make it first).

Luiz


More information about the freebsd-arm mailing list