Pages

Monday, May 13, 2013

spidev_test.c - testing spi looping back, or detecting a SPI device?

So I soldered a 10K to pull up MCP23S17's reset pin, and tried again.  But spidev_test.c still returns all 0's, and loop back test is OK, not all zeros.

I thought the MCP23S17 might be dead because earlier I might have burnt it with a wrong polarity power, making it crazily hot.  So I swapped with a new MCP23S17, but still no luck.

Then I suspected spidev_test is only for checking if SPI is more or less working, at least loop back output to input.

So I used ft2080.py to test the EEPROM at spi CE0 and Guzunty Pi LED driver at CE1, and found both OK.  Then without disconnecting any hardware, I tested spidev_test and found still all 0's, and then looping back still looks OK (not all 0's, and second line begins with 0x40 etc.)

Then I retested EEPROM and MCP23S17 a couple of times, with either power on and off.  I found spidev_test always returns all 00's, and rarely all FF's.

I came to the conclusion that spidev_test, unlike i2cdetect,  can tested SPI more or less OK, but CANNOT BE USED TO DETECT A SPI DEVICE.

So I guess I should forget spidev_test and move on to using Python to test MCP23S17.

.END

No comments:

Post a Comment