1.1.2 Example: Constant Return Value

An SPI sensor always returns 0xFF during communication.

Some possible causes:

  • The sensor is not properly soldered to the PCB (Mechanical)
  • Logic-level mismatch between the sensor and the controller (Electrical)
  • An incorrect timing waveform causes communication failure (Protocol)
  • The Analog mode is set on the GPIO (Driver)
  • The SPI driver is not operating correctly (Driver)

Like in Example: Random I2C NACKs. It is possible to eliminate some of these by knowing the specifics of the application. Documentation or measurement can verify logic-level mismatches and then cross-checked with the sensor data sheet. An SPI driver failure can also be eliminated if communication with another SPI device occurs without issues on the bus. This will also eliminate the analog mode select issue. An oscilloscope or logic analyzer can measure incorrect timing waveforms while the soldering may be optically inspected and/or reworked.