本帖最后由 tengring 于 2013-6-25 20:11 编辑
以下内容来自M25P64 DATASHEET,高手请忽略!
Figure 4 shows an example of three devices connectedto an MCU, on an SPI bus. Only one device is selected at a time, so only one device drives the Serial Data Output (Q) line at a time, the other devices arehigh impedance. Resistors R (represented in Figure 4 ) ensure that the M25P64is not selected if the Bus Master leaves the S line in the high impedance state. As the Bus Master may enter a statewhere all inputs/outputs are in high impedance at the same time (for example,when the Bus Master is reset), the clock line (C) must be connected to anexternal pull-down resistor so that, when all inputs/outputs become high impedance,the S line is pulled High while the Cline is pulled Low (thus ensuring thatS and C do not become High at the sametime, and so, that the tSHCH requirement is met). The typical value of R is 100k Ω, assuming that the time constant R*Cp (Cp = parasitic capacitance of thebus line) is shorter than the time during which the Bus Master leaves the SPIbus in high impedance.
Example: Cp = 50pF, that is R*Cp = 5 µs <=> the application must ensure that the Bus Masternever leaves the SPI bus in the high impedance state for a time period shorterthan 5µs.
第一段话中提到CS脚和VCC脚之间要接一个R(100K)值的电阻,以确保CS脚和SCK脚不能同时是高电平。
最后这段话意思是SPI总线控制其不能离开CS脚超过5 µs,否则FLASH芯片即认为CS脚为高电平,FLASH不被选择,如果这里的R值越小则这个时间范围更小。
多FLASH正确接法:
每个FLASH芯片的CS脚和VCC脚(VCC脚也可以使用板子上任意的VCC)之间(就是1脚和8脚之间)串联一个100k欧的电阻(网上有人用10k的也可以),然后把每个芯片的CS脚通过开关接到路由主板上的CS脚,开关切换到哪个FLASH芯片哪个被选中。
|