如何将数据广播到多个SPI从机,以及它如何工作? [英] How can I broadcast data to multiple SPI slaves and how it works?

查看:491
本文介绍了如何将数据广播到多个SPI从机,以及它如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道基本的SPI协议及其从主机到从机的操作.我想知道是否可以在多个从站上广播数据?如果有可能,那么它如何工作.

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.

我听说写入任何SPI从设备后,即使您不打算使用读取数据,也必须从该设备读取.如果可以广播的话,在广播的情况下怎么可能?

I've heard that after writing to any SPI slave you have to read from slave even if you are not going to use read data. How is this possible in case broadcast if broadcast is possible?

推荐答案

如果有多个SPI控制器,则有可能.我有四个SPI控制器连接到相同类型的四个不同芯片.我用软件控制SS,因为SPI控制器无法以有用的方式控制它.我的驱动程序具有读取,写入和广播方法.读取和写入操作针对一个SPI控制器实例,而广播方法(当然是只写)采用一组SPI控制器实例.

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.

然后,广播方法获取大小为字节的公共地址缓冲区和大小为字节的公共数据缓冲区,并将它们顺序发送到所有四个SPI控制器(但要及时关闭),以从调用者的角度进行广播.它不是基于硬件的广播,但是它确实允许更高级别的软件认为它正在一次将通用命令和设置数据广播到所有四个芯片.

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.

总的来说,这比顺序发送相同的消息到所有四个芯片要省时得多,因为要使下层SPI控制器完成工作就可以提高效率.

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.

这篇关于如何将数据广播到多个SPI从机,以及它如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆