mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 17:43:34 +08:00
ms5611: check for all zero in the prom
when SPI CLK fails we get all zero data
This commit is contained in:
committed by
Lorenz Meier
parent
39b40e41c2
commit
8744aa7536
@@ -236,9 +236,12 @@ MS5611_SPI::_read_prom()
|
|||||||
usleep(3000);
|
usleep(3000);
|
||||||
|
|
||||||
/* read and convert PROM words */
|
/* read and convert PROM words */
|
||||||
|
bool all_zero = true;
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
uint8_t cmd = (ADDR_PROM_SETUP + (i * 2));
|
uint8_t cmd = (ADDR_PROM_SETUP + (i * 2));
|
||||||
_prom.c[i] = _reg16(cmd);
|
_prom.c[i] = _reg16(cmd);
|
||||||
|
if (_prom.c[i] != 0)
|
||||||
|
all_zero = false;
|
||||||
//debug("prom[%u]=0x%x", (unsigned)i, (unsigned)_prom.c[i]);
|
//debug("prom[%u]=0x%x", (unsigned)i, (unsigned)_prom.c[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,6 +250,10 @@ MS5611_SPI::_read_prom()
|
|||||||
if (ret != OK) {
|
if (ret != OK) {
|
||||||
debug("crc failed");
|
debug("crc failed");
|
||||||
}
|
}
|
||||||
|
if (all_zero) {
|
||||||
|
debug("prom all zero");
|
||||||
|
ret = -EIO;
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user