Unable to read from BME280
Unable to read from BME280
Hi,
I'm trying to read values from a BME280 sensor. connected to an ESP32 dev board.
As I'm a complete newbie, I followed the board and the sensor setup guides.
Running the I2C_ReadAllData sketch from the sensor examples I see that it doen't manage to read the registers of the sensor through I2C
Running this I2cScanner shows that it finds something at 0x77.
The data sheet indicates that reading from 0xD0 register should get the value 0x60, but in my case it gets 0x78.
All other registers have 0xFF
I've connected the sensor to the board using the I2C pins:
- GND to GND
- 3.3V to 3.3V
- SDA to pin 21
- SCL to pin 22
Both are placed on a breadboard.
The board is powered through the microUSB port used to upload the flash.
What could be wrong?
Software?
Wrong connection?
Not enough power?
Broken sensor?
Please help.
I'm trying to read values from a BME280 sensor. connected to an ESP32 dev board.
As I'm a complete newbie, I followed the board and the sensor setup guides.
Running the I2C_ReadAllData sketch from the sensor examples I see that it doen't manage to read the registers of the sensor through I2C
Running this I2cScanner shows that it finds something at 0x77.
The data sheet indicates that reading from 0xD0 register should get the value 0x60, but in my case it gets 0x78.
All other registers have 0xFF
I've connected the sensor to the board using the I2C pins:
- GND to GND
- 3.3V to 3.3V
- SDA to pin 21
- SCL to pin 22
Both are placed on a breadboard.
The board is powered through the microUSB port used to upload the flash.
What could be wrong?
Software?
Wrong connection?
Not enough power?
Broken sensor?
Please help.
- Attachments
-
- DSC_0723.JPG (945.58 KiB) Viewed 21955 times
-
- DSC_0722.JPG (1011.78 KiB) Viewed 21955 times
Last edited by shadow on Wed Dec 07, 2016 10:47 pm, edited 1 time in total.
Re: Unable to read from BME280
I have moved this topic to Arduino forum.
Do you have a logic analyzer to check what happens on the I2C bus?
Do you have a logic analyzer to check what happens on the I2C bus?
Re: Unable to read from BME280
Hi,
Unfortunately no
No voltage meter either, thinking that maybe the sensor doesn't get any power
Unfortunately no
No voltage meter either, thinking that maybe the sensor doesn't get any power
Re: Unable to read from BME280
What else can I do?
Should I return these? Maybe they just are not compatible? Or maybe broken?
Can it be some software problem still?
Should I return these? Maybe they just are not compatible? Or maybe broken?
Can it be some software problem still?
Re: Unable to read from BME280
Can you test the sensor with something like e.g. a Raspberry pi first, and then try the software? I'd really suggest some sort of logic analyser -- bus pirate may do what you need for $30 or so.
Re: Unable to read from BME280
Interestingly, I too am having problems with a similar device ... the BMP180. I tracked it down with a logic analyzer and found that when the code attempts to send two bytes using a:
I see 1 byte sent on the wire and sendBytes() doesn't terminate. I happened to be chatting with the author of the Arduino libs over the weekend and he was interested to hear about the puzzle and took a copy of my test code. I also offered up any tests he might need to run on my system either live or by correspondence. I'd suggest instrumenting your code with log points and lets drill down in your environment and see where we are ending up.
Code: Select all
Wire.beginTransaction();
Wire.sendBytes(2, [data]);
Wire.endTransaction();
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: Unable to read from BME280
@kolban: I can add logs, sure, though the current ones don't look too encouraging.
Like I've said before, the registers that are read by the I2C_ReadAllData example sketch from the Arduino library return 0xFF or 0x0 values
Regarding a logic analyzer, I was hoping to get away without having to buy one, as this project is for my school and I was hoping to keep costs at a minimum, especially since I'll probably never use it again after this.
I've even tried connecting the sensor to the esp32 using SPI, but still no luck
I hope I did it correctly:
Like I've said before, the registers that are read by the I2C_ReadAllData example sketch from the Arduino library return 0xFF or 0x0 values
Regarding a logic analyzer, I was hoping to get away without having to buy one, as this project is for my school and I was hoping to keep costs at a minimum, especially since I'll probably never use it again after this.
I've even tried connecting the sensor to the esp32 using SPI, but still no luck
Had a bit of fun writing the flash until finding out I had to leave the SPI pins unconnected for the write to work.Starting BME280... result of .begin(): 0xFF
Displaying ID, reset and ctrl regs
ID(0xD0): 0xFF
Reset register(0xE0): 0x0
ctrl_meas(0xF4): 0x0
ctrl_hum(0xF2): 0x0
I hope I did it correctly:
- * GND - GND
* 3.3V - 3.3V
* SCK - pin 18
* SDO - pin 19
* SDI - pin 23
* CS - pin 2
-
- Posts: 10
- Joined: Sun Nov 20, 2016 12:09 am
Re: Unable to read from BME280
If it helps, I've ported the Arduino i2c driver to a IDF FreeRTOS C project, and get similar results.
I'm trying to write 2 bytes to a small OLED using i2cWrite(), and only see the address and first byte on the logic analyzer.
Looking at the i2c registers, all the status bits look as expected, but the last command (I2C_CMD_STOP) never completes and the i2c driver gets stuck in a loop waiting for it.
I had a different device (accelerometer) mostly working on i2c - but the driver would randomly lock up. I even disabled all my WiFi tasks etc just incase they were screwing things up but didn't help.
I have plenty of test gear on my desk, so please let me know if I can help debug this issue.
I'm trying to write 2 bytes to a small OLED using i2cWrite(), and only see the address and first byte on the logic analyzer.
Looking at the i2c registers, all the status bits look as expected, but the last command (I2C_CMD_STOP) never completes and the i2c driver gets stuck in a loop waiting for it.
I had a different device (accelerometer) mostly working on i2c - but the driver would randomly lock up. I even disabled all my WiFi tasks etc just incase they were screwing things up but didn't help.
I have plenty of test gear on my desk, so please let me know if I can help debug this issue.
Re: Unable to read from BME280
hishadow wrote: ..
I've connected the sensor to the board using the I2C pins:
- GND to GND
- 3.3V to 3.3V
- SDA to pin 21
- SCL to pin 22
..
i have not the SparkFun DevBoard but:
- which Pull up ( Value ) you use for each ( SDA, SCL )
- have you tried to swap SDA, SCL Pins
- have you tried to use other GPIO example GPIO16, GPIO17
how looks your code in the IDE, can u post the complett Sketch?
best wishes
rudi
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪
Who is online
Users browsing this forum: No registered users and 142 guests