diff options
author | Andrew Tridgell <tridge@samba.org> | 2013-12-09 10:03:50 +1100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-12-10 11:39:28 +0100 |
commit | 8744aa7536d2c52417855bd28ef589b72a42e5de (patch) | |
tree | b85a4c13d1d9a6b88a05e0f02ba7b4a71558f664 /src/drivers/ms5611/ms5611_spi.cpp | |
parent | 39b40e41c2126cb2aeba586a57333ebb2aa3c2a6 (diff) | |
download | px4-firmware-8744aa7536d2c52417855bd28ef589b72a42e5de.tar.gz px4-firmware-8744aa7536d2c52417855bd28ef589b72a42e5de.tar.bz2 px4-firmware-8744aa7536d2c52417855bd28ef589b72a42e5de.zip |
ms5611: check for all zero in the prom
when SPI CLK fails we get all zero data
Diffstat (limited to 'src/drivers/ms5611/ms5611_spi.cpp')
-rw-r--r-- | src/drivers/ms5611/ms5611_spi.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/drivers/ms5611/ms5611_spi.cpp b/src/drivers/ms5611/ms5611_spi.cpp index e9dff5a8b..bc4074c55 100644 --- a/src/drivers/ms5611/ms5611_spi.cpp +++ b/src/drivers/ms5611/ms5611_spi.cpp @@ -236,9 +236,12 @@ MS5611_SPI::_read_prom() usleep(3000); /* read and convert PROM words */ + bool all_zero = true; for (int i = 0; i < 8; i++) { uint8_t cmd = (ADDR_PROM_SETUP + (i * 2)); _prom.c[i] = _reg16(cmd); + if (_prom.c[i] != 0) + all_zero = false; //debug("prom[%u]=0x%x", (unsigned)i, (unsigned)_prom.c[i]); } @@ -247,6 +250,10 @@ MS5611_SPI::_read_prom() if (ret != OK) { debug("crc failed"); } + if (all_zero) { + debug("prom all zero"); + ret = -EIO; + } return ret; } |