apache / apache/nuttx

BMP280 sensor is not working with sensortest

Open
#8,831 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
C
Stars
4k
Forks
1.7k
Avg merge
1d 17h
Merged PRs (30d)
237

Description

I noticed that sensortest is not working with BMP280 sensor

How to test:

1) connect a BMP280 module to I2C pins 22 and 23 of ESP32-Devkitc
2) run: $ ./tools/configure.sh esp32-devkitc:bmp280
3) run: $ make flash ESPTOOL_PORT=/dev/ttyUSB1 -j

Use minicom or other serial console and run:

```
nsh> ls /dev
/dev:
console
i2c0
kmsg
null
ttyS0
uorb/

nsh> ls /dev/uorb
/dev/uorb:
sensor_baro0

nsh> sensortest baro0
sensor_ioctl: cmd=a81 arg=000f4240
bmp280_set_standby: Failed to set value for standby time.
Failed to set interval for sensor:/dev/uorb/sensor_baro0, ret:Unknown error
```

I confirmed that commenting these lines solves the issue:

```
diff --git a/testing/sensortest/sensortest.c b/testing/sensortest/sensortest.c
index 3fd24d027..65b73d277 100644
--- a/testing/sensortest/sensortest.c
+++ b/testing/sensortest/sensortest.c
@@ -346,7 +346,7 @@ int main(int argc, FAR char *argv[])
goto open_err;
}

- ret = ioctl(fd, SNIOC_SET_INTERVAL, interval);
+ /*ret = ioctl(fd, SNIOC_SET_INTERVAL, interval);
if (ret < 0)
{
ret = -errno;
@@ -356,7 +356,7 @@ int main(int argc, FAR char *argv[])
devname, strerror(errno));
goto ctl_err;
}
- }
+ }*/

ret = ioctl(fd, SNIOC_BATCH, latency);
if (ret < 0)
```

Then running the above command again I can see the pressure and temperature changing:
```
baro0: timestamp:66870000 value1:1008.37 value2:31.70
baro0: timestamp:66870000 value1:bmp280_fetch: press = 285032, temp = 543600
bmp280_fetch: press = 285028, temp = 543616
bmp280_fetch: press = 285028, temp = 543616
1008.37 value2:31.70
baro0: timestamp:66890000 value1:1008.31 value2:31.70
baro0: timestamp:66890000 value1:1008.31 value2:31.bmp280_fetch: press = 285024, temp = 543616
bmp280_fetch: press = 285024, temp = 543616
```

@xiaoxiang781216 could you please take a look?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.