In SPI communication, when the clock frequency of SPI is 1M Hz and the sampling clock frequency is set to be 2M Hz, why do communication errors always happen?
The purpose of sampling clock is to prevent received data from glitch noise, but lower sampling clock would affect the speed of communication. Sampling clock frequency > = 4SPI clock frequency is recommended. When the SPI clock frequency is 1M Hz, the sampling clock frequency >= 41M Hz = 4M Hz, namely the sampling clock frequency must be higher than 4 M Hz to ensure the slave device can receive the right data. Here the sampling clock should be set as 4M Hz.