How can I broadcast data to multiple SPI slaves and how it works?

前端 未结 3 1522
盖世英雄少女心
盖世英雄少女心 2021-01-29 09:01

I know basic SPI protocol and its master to slave operations. I want to know that is it possible to broadcast data on multiple slave? If it is possible then how it works.

<
相关标签:
3条回答
  • 2021-01-29 09:02

    You cannot broadcast data to multiple slaves at the same time.

    0 讨论(0)
  • 2021-01-29 09:13

    It is possible if you have multiple SPI controllers. I have four SPI controllers connected to four different chips of the same type. I control the SS in software because the the SPI controller can't control it in a useful way. My driver has read, write, and broadcast methods. Read and write act on one SPI controller instance while the broadcast method (write-only of course) takes an array of SPI controller instances.

    The broadcast method then takes the common address buffer of size bytes and the common data buffer of size bytes and sends them to all four SPI controllers sequentially (but close in time) to effect a broadcast from the caller's perspective. It isn't a hardware based broadcast but it does allow higher level software to think it is broadcasting common commands and setup data to all four chips at once.

    It is also overall more time-efficient than sequentially sending the same thing to all four chips since efficiencies are to be had by having the lower layer SPI controller do the work.

    0 讨论(0)
  • 2021-01-29 09:27

    No, it's not possible. Since SPI is 4- wire interface. The SS line is used for slave selection.One SPI master can have multiple slaves but it cannot select all the slaves at once since it is either using some bit or SS signal to select the slave(and cannot select multiple slave at a single time).

    SPI works in full duplex mode(most of time and cases), and is implemented using shift registers. Hence while writing the data on MOSI(assumption: master is writing),we are getting the data in MISO line too (inserting data in master shift register does shift the data in slave shift register). Hence we get data on both of the TX and RX lines.

    0 讨论(0)
提交回复
热议问题