ESP32 i2c (BMP280) not working with ESP-IDF but OK with Arduino IDE

This page summarizes the projects mentioned and recommended in the original post on /r/esp32

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • esp-idf-bmx280

    BMP280 and BME280 I2C driver for ESP32 boards using the IDF toolchain.

  • If i use exactly the same setup on PINS 21 and 22 with the BMP280 simple test in Arduino IDE then the temperature and pressure are picked up without an issue. However if i use the ESP-IDF with the exact setup defined here but pins 21 & 22 (https://github.com/utkumaden/esp-idf-bmx280) then i do not get any output it fails on the first step to i2c_param_config(I2C_NUM_0, &i2c_cfg). I did try with pins 17 and 16 but it made no difference.

  • ulptool

    Program the esp32 ULP coprocessor in Arduino

  • My next step is to try https://github.com/duff2013/ulptool to get the ULP working with Arduino IDE but it would be good to see why the ESP-IDF setup doesn't work for me and try to get it working as i wrote the code for it.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • esp-idf

    Espressif IoT Development Framework. Official development framework for Espressif SoCs.

  • Use an official I2C example form the IDF. Like this: https://github.com/espressif/esp-idf/blob/master/examples/peripherals/i2c/i2c_simple/main/i2c_simple_main.c I’stand corrected with respect to the call order, it appears the driver install comes later. Your speed is unusually low, use the default speed of 400K. If you still get the error in the setup, use the source: the IDF is fully source distributed. Look into the implementation of the function, which errors occur form which code parts. Use ESP_LOGE or similar calls to get output messages on where you are getting to within the code. So that you learn where it’s expectations aren’t met.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts