Will Apache #NuttX OS talk I2C with Bosch BME280 Sensor? (Temperature + Humidity + Air Pressure) ... Let's find out!
Verify with Bus Pirate that our BME280 works OK ... Despite my horrid soldering 😂
https://github.com/lupyuen/bme280-nuttx#test-with-bus-pirate
Enable the I2C Port and I2C Character Driver on Apache #NuttX OS ... So it will talk with BME280
Apache #NuttX OS doesn't have a BME280 Driver ... Let's test the BMP280 Driver instead (Air Pressure only)
We patch the I2C Address and Device ID in the #NuttX BMP280 Driver ... So it will work with BME280
https://github.com/lupyuen/bme280-nuttx#change-i2c-address-and-device-id
Here's how we register the BMP280 Driver at #NuttX Startup
https://github.com/lupyuen/bme280-nuttx#register-bmp280-driver
#NuttX BMP280 Driver fails because the detected Device ID is 0 ... Let's find out why 🤔
Logic Analyser shows that #BL602 sent the wrong Register ID to BME280 ... Let's fix this 🤔
Here's how we connected our Logic Analyser to PineCone #BL602 ... For testing the #NuttX BMP280 Driver
https://github.com/lupyuen/bme280-nuttx/blob/main/README.md#invalid-register-id
#BL602 has a peculiar I2C Port ... We need to send the I2C Sub Address (Register ID) separately from the I2C Data ... This might cause the BMP280 Driver to fail
Here's how we patch the #NuttX BMP280 Driver to send the Register ID as I2C Sub Address (instead of I2C Data)
#NuttX BMP280 Driver loads OK on #BL602 ... After setting the Register ID as I2C Sub Address! 🎉
https://github.com/lupyuen/bme280-nuttx#bmp280-driver-loads-ok
#NuttX BMP280 Driver appears as "/dev/sensor/baro0" ... Let's read the device
https://github.com/lupyuen/bme280-nuttx#bmp280-driver-loads-ok
We enable the #NuttX Sensor Test App ... To test the BMP280 Driver
#NuttX BMP280 Driver says it's 29 °C with air pressure 1,006 millibars ... Yep looks right for Sunny Singapore by the Seaside 👍
#NuttX BMP280 Driver works OK with our BME280 Sensor ... But we're missing one thing: Humidity ... Can we port the BME280 Driver from Zephyr OS? 🤔
https://github.com/lupyuen/bme280-nuttx#port-bme280-driver-from-zephyr-os
Zephyr BME280 Driver looks similar to #NuttX BMP280 Driver ... So porting Zephyr BME280 Driver to NuttX might not be so hard 🤔
https://github.com/lupyuen/bme280-nuttx#port-bme280-driver-from-zephyr-os
Zephyr BME280 Driver builds OK on #NuttX (with a few tweaks) 🎉 ... Now we wrap the Zephyr Driver as a NuttX Driver
https://github.com/lupyuen/bme280-nuttx#wrap-zephyr-driver-as-nuttx-driver
Our #NuttX Driver Wrapper wraps around the Zephyr BME280 Driver ... So it works like a NuttX Driver
https://github.com/lupyuen/bme280-nuttx#wrap-zephyr-driver-as-nuttx-driver
Our #NuttX BME280 Driver reads the Sensor Data from Zephyr Driver in two steps: 1️⃣ Fetch the sensor sample 2️⃣ Get the channel data
https://github.com/lupyuen/bme280-nuttx#read-sensor-data-from-zephyr-driver
Power Management works a little differently in #NuttX vs Zephyr ... Here's how our NuttX BME280 Driver calls the Zephyr Driver to do Power Management
BME280 Standby Duration is static in Zephyr but configured at runtime in #NuttX ... So we set it in our NuttX BME280 Driver
Zephyr BME280 Driver ported to Apache #NuttX OS ... Works great on NuttX! 🎉
We made minimal changes to Zephyr BME280 Driver while porting to #NuttX OS
https://github.com/lupyuen/bme280-nuttx#zephyr-driver-modified-for-nuttx
#NuttX doesn't have a Sensor Type that supports BME280 Temperature + Humidity + Pressure ... So our NuttX BME280 Driver combines 2 Sensor Types: 1️⃣ Barometer Sensor (Pressure + Temperature) 2️⃣ Humidity Sensor
https://github.com/lupyuen/bme280-nuttx#combined-barometer-and-humidity-sensor
Each #NuttX Sensor defines its operations for 1️⃣ Activating the sensor 2️⃣ Fetching sensor data 3️⃣ Setting the standby interval
https://github.com/lupyuen/bme280-nuttx#combined-barometer-and-humidity-sensor
At #NuttX Startup we register both BME280 sensors: Barometer Sensor and Humidity Sensor
https://github.com/lupyuen/bme280-nuttx#combined-barometer-and-humidity-sensor
Apache #NuttX OS doesn't have a BME280 Driver ... Let's tweak the BMP280 Driver to work with BME280
https://lupyuen.github.io/articles/bme280?3#start-with-bmp280-driver
Apache #NuttX Driver for BMP280 fails to load on #BL602 ... Let's fix this 🤔
https://lupyuen.github.io/articles/bme280?4#invalid-device-id
#BL602 has a peculiar I2C Port ... It uses I2C Sub Addresses! Here's how we fix our #NuttX Driver
https://lupyuen.github.io/articles/bme280?5#set-i2c-sub-address
Here's how we read the BMP280 Sensor on Apache #NuttX OS ... With the Sensor Test App
https://lupyuen.github.io/articles/bme280?6#run-sensor-test-app
Here's why we port the BME280 Driver from Zephyr OS to Apache #NuttX OS
https://lupyuen.github.io/articles/bme280?7#port-bme280-driver-from-zephyr-os
Mapping the BME280 Driver from Zephyr OS to Apache #NuttX OS
How our #NuttX BME280 Driver reads the Sensor Data from Zephyr BME280 Driver
https://lupyuen.github.io/articles/bme280?9#read-sensor-data-from-zephyr-driver
BME280 Standby Interval is configured by #NuttX at runtime ... Here's how we do it
https://lupyuen.github.io/articles/bme280?10#standby-interval
Our #NuttX BME280 Driver combines 2 sensors ... Here's why
https://lupyuen.github.io/articles/bme280?11#combined-barometer-and-humidity-sensor
Our #NuttX BME280 Driver defines the operations for the Barometer and Humidity Sensors
https://lupyuen.github.io/articles/bme280?12#sensor-operations
Our #NuttX BME280 Driver registers the Barometer and Humidity Sensors at startup
https://lupyuen.github.io/articles/bme280?15#register-sensors
Here's how we bundle the Zephyr BME280 Driver inside our #NuttX Driver
https://lupyuen.github.io/articles/bme280?16#bundle-nuttx-and-zephyr-drivers
What's inside our bundled BME280 Driver for #NuttX OS
https://lupyuen.github.io/articles/bme280?17#inside-the-bundle
How we minimised the changes when porting the Zephyr BME280 Driver to #NuttX OS
https://lupyuen.github.io/articles/bme280?18#zephyr-driver-modified-for-nuttx
Here's how we read the BME280 Sensor with #NuttX Sensor Test App
https://lupyuen.github.io/articles/bme280?19#run-bme280-driver
What's inside the #NuttX Sensor Test App
https://lupyuen.github.io/articles/bme280?20#sensor-test-app
Here's how we connect BME280 Sensor (Temperature / Humidity / Air Pressure) ... To PineCone #BL602 @PINE64
https://lupyuen.github.io/articles/bme280?2#test-and-connect-bme280