Mo & Terry Smedley |
Propagation Delays on the Parallel to Serial Shift Register for the SPI MOSI Circuit After very occasionally encountering SPI errors at 16MHz during long-term use of the board, I started looking carefully at some timing constraints. During initial board design, it was noted that the accumulated propagation delay through "LS" technology components wasn't fast enough to handle switching of a 16MHz clock. To resolve that issue, several of the ICs in the WizNET circuit were specified as "F" family devices with much lower propagation delays than "LS" devices. During long-term testing of the board, I still very occasionally encountered 16MHz errors with SPI. The discussion below shows what I found when looking further into timing issues associated with the remaining "LS" family devices in the SPI circuit. Shift register 74xx165 at U205 converts parallel data from the H8 bus to a serial data stream for the SPI MOSI signal. The SPI devices sample the serial data on the rising edge of the clock, while the shift register clocks the data out on the falling edge (the clock signal to the shift register is inverted by U210D). Assuming a completely symmetrical clock signal at 16MHz, this allows just 31.5ns between the "clock out" signal to the shift register and the "clock in" to the SPI device. There are three timing components that must be considered:
Ouch! Devices operating at the datasheet maximums will fail to meet the setup requirements of the WizNET module. The initial design for this board uses a 74F14 inverter for the bus control signals, including the clock. The 74LS14 is often used on H8 boards to improve the noise margin on the bus control signals. But the built-in hysteresis of the Schmitt trigger results in an asymmetric clock, where the "clock low" portion of the waveform has a shorter duration than the "clock high". In other words, the time between the falling and rising edges of the clock is less than the time between the rising and falling edge. This reduces the available window for the serial clock output from 31.5ns to less than 25ns (see scope traces) making it even more likely that there will be occasional errors due to missing the setup time requirements. The solution to this timing issue was two-fold. First, the 74LS165A was replaced with a 74ALS165, which has a PD at least 10ns better than the LS chip: 3ns (typical), 14ns (maximum). As can be seen in the scope traces below, just making this substitution brings the transitions on MOSI well ahead of the setup time requirement. Secondly, the 74F14 at U1 was replaced with a 74F04. This restores the fully symmetric clock, adding even more margin to the MOSI signal. The scope traces below show the improvement in setup time margin that was possible with these two changes. This does reduce the noise immunity on the IOWR and IORD bus signals however.
|