A couple of days ago I had an issue where I was unable to read data from an SPI slave. I finally fixed and I'm now able to read data quite well.
However, I found another interesting issue today. If I connect the slave's output directly to the MCU, the data is corrupted. The following picture shows this:
However, if I put in a series 220 Ohm resistor the data comes in just fine, like so:
The byte transferred was 11001101. You can see the start and end of the transfer from the two small dips in the waveform. The starting dip is seen near the trigger indicator. These are nowhere to be seen in the corrupted waveform.
The rate of data transfer is not very fast. The clock rate is just 62500 Hz.
What could cause this? And how can I make sure that it does not occur when I finally layout the PCB?
The top waveform is the clock (SCK) and the bottom is MISO.
These waveforms show the ringing in more detail. Again, top waveform is the clock and the bottom is MISO. This picture has the CPLD and MCU connected via 220 Ohm resistor:
This shows the ringing when the MCU and CPLD are connected directly (no resistor between them). Note that I cannot get to the source pin (in this case, the CPLD's pin) because the CPLD is on a development board and the chip is on a BGA package. I will try and see if the pin can be probed. Also, I forgot to add, I also have a 100 Ohm resistance in series on the SCK like. I needed this to reduce ringing from the MCU on the clock and because its required for the AVR ISP programmer. Otherwise, AVR Studio simply puts out an error. So, on the final PCB layout they are going to be needed.