嵌入式应用程序中SPI / I2C的位击是什么的缺点 [英] What are the disadvantages of bit banging SPI/I2C in embedded applications
问题描述
我已经明白,当涉及到通过GPIO的SPI / I2C时,bit bit是可怕的做法。为什么会这样?
Bit-banging携带一个消耗CPU循环的软件开销为其他目的。这可能会对系统对其他事件的响应性产生明显的影响,而在硬实时系统中,可能会对系统的实时期限遇到影响。
如果bit-banged接口不会对实时性能产生不利影响,那么它必须被赋予低优先级,所以在数据吞吐量和延迟方面本身就不是非确定性的。 / p>
通过使用硬件接口和DMA传输来最大限度地降低软件开销,实现了CPU效率最高的传输。比特敲击与此相反。
我不会说这是可怕的;如果在您的应用程序中,您可以实现响应性和实时限制,并且使用bit-banging可能会降低所需部件的成本,或者允许您使用现有硬件,否则可能完全有道理。
I have come to understand that bit banging is horrible practice when it comes to SPI/I2C over GPIO. Why so?
Bit-banging carries a software overhead consuming CPU cycles that you could otherwise utilise for other purposes. This may have a noticeable effect on system responsiveness to other events, and in a hard real-time system, may significantly impact the systems ability to meet real-time deadlines.
If the bit-banged interface is not to have a detrimental effect on real-time performance, then it must be given low priority so will then itself be non-deterministic in terms of data throughput and latency.
The most CPU efficient transfer is achieved by using a hardware interface and DMA transfer to minimise the software overhead. Bit-banging is at the opposite extreme of that.
I would not say it was horrible; if in your application you can achieve responsiveness and real-time constraints and the use of bit-banging perhaps reduces the cost of the part needed or allows you to use existing hardware for example, then it may be entirely justified.
这篇关于嵌入式应用程序中SPI / I2C的位击是什么的缺点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!