Unable to read from BME280

shadow
Posts: 23
Joined: Fri Dec 02, 2016 4:56 pm

Unable to read from BME280

Postby shadow » Fri Dec 02, 2016 11:44 pm

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 :cry:
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
DSC_0723.JPG (945.58 KiB) Viewed 21994 times
DSC_0722.JPG
DSC_0722.JPG (1011.78 KiB) Viewed 21994 times
Last edited by shadow on Wed Dec 07, 2016 10:47 pm, edited 1 time in total.

shadow
Posts: 23
Joined: Fri Dec 02, 2016 4:56 pm

Re: Unable to read from BME280

Postby shadow » Mon Dec 05, 2016 11:12 am

Anybody? :|

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: Unable to read from BME280

Postby ESP_igrr » Mon Dec 05, 2016 11:28 am

I have moved this topic to Arduino forum.
Do you have a logic analyzer to check what happens on the I2C bus?

shadow
Posts: 23
Joined: Fri Dec 02, 2016 4:56 pm

Re: Unable to read from BME280

Postby shadow » Mon Dec 05, 2016 1:00 pm

Hi,
Unfortunately no :(
No voltage meter either, thinking that maybe the sensor doesn't get any power

shadow
Posts: 23
Joined: Fri Dec 02, 2016 4:56 pm

Re: Unable to read from BME280

Postby shadow » Mon Dec 05, 2016 3:55 pm

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?

jimbob
Posts: 29
Joined: Fri Aug 05, 2016 10:47 pm

Re: Unable to read from BME280

Postby jimbob » Mon Dec 05, 2016 9:06 pm

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.

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Unable to read from BME280

Postby kolban » Mon Dec 05, 2016 9:19 pm

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:

Code: Select all

Wire.beginTransaction();
Wire.sendBytes(2, [data]);
Wire.endTransaction();
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.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

shadow
Posts: 23
Joined: Fri Dec 02, 2016 4:56 pm

Re: Unable to read from BME280

Postby shadow » Tue Dec 06, 2016 7:24 am

@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 :(
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
Had a bit of fun writing the flash until finding out I had to leave the SPI pins unconnected for the write to work.

I hope I did it correctly:
  • * GND - GND
    * 3.3V - 3.3V
    * SCK - pin 18
    * SDO - pin 19
    * SDI - pin 23
    * CS - pin 2

dldtechnology
Posts: 10
Joined: Sun Nov 20, 2016 12:09 am

Re: Unable to read from BME280

Postby dldtechnology » Tue Dec 06, 2016 8:53 pm

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.

User avatar
rudi ;-)
Posts: 1729
Joined: Fri Nov 13, 2015 3:25 pm

Re: Unable to read from BME280

Postby rudi ;-) » Wed Dec 07, 2016 4:10 pm

shadow 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
..
hi

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.
-------------------------------------
問候飛出去的朋友遍全球魯迪

Who is online

Users browsing this forum: No registered users and 55 guests