Embedded Systems & Firmware

When an SPI part is connected but correct data cannot be read, which setting is most worth checking?

  1. AWhether the I2C address matches the part
  2. BWhether the UART baud rate matches the part
  3. CWhether the clock polarity and phase (CPOL and CPHA, the SPI mode) match the part's specification
Show answer and explanation

Answer: C. Whether the clock polarity and phase (CPOL and CPHA, the SPI mode) match the part's specification

SPI has four modes formed by combining the idle level of the clock (CPOL) and which clock edge samples the data (CPHA). If master and part use different modes, sampling is off by half a period, shifting bits or giving undefined values. The mode must be checked in the part's datasheet and the microcontroller's SPI configured to match.

  • A. SPI has no addresses.
  • B. SPI does not synchronize via a baud rate.
  • C. Correct. Which of the four modes is used depends on the part.
Practice this topic Back to topic

More Embedded Systems & Firmware questions

  1. What is a characteristic of I2C communication?
  2. In I2C, how does the receiver of a data byte acknowledge it?
  3. You want to connect two identical I2C temperature sensors to the same I2C bus, but both have the same address. Which is a correct solution?
  4. Which comparison of UART, SPI and I2C is correct?
  5. What is the difference between polling and interrupts as ways to learn a peripheral's status?