farmerkeith / BMP280-library

This is an Arduino library for the BME280 and BMP280 sensors.
18 stars 9 forks source link

Program freeze in Serial monitor #1

Open dresik111 opened 5 years ago

dresik111 commented 5 years ago

I have module from Aliexpress and strange issue, Arduino stops working on " bmp0.begin(); ". It does not do any different what sketch from the BMP280 library I use. For example, sketch "scanRawPressureAndTemperature", on the serial monitor shows:

Start of scanRawPressureAndTemperature sketch Time at s"

where that serial message is cut off when program realize bmp0.begin(). I add some delay(10); after every line and all of Serial messages show on the monitor before bmp0.begin(). Exactly:

Start of scanRawPressureAndTemperature sketch Time at start of setup=0.010 Temperature samples=1 Pressure samples=1

Also changing the baud rate repeats messages so maybe Arduino does not stop working at all. No errors show while compilation.

farmerkeith commented 5 years ago

Hi dresik111, This is very puzzling. Do other example sketches show the same behaviour? You can run the sample sketch with the BMP280 disconnected. It will show errors but should not get stuck in the way yours seems to. This will help you work out whether it is your Arduino or the BMP280 that is causing the problem. If you comment out the line "bmp0.begin()" does it go on and keep printing out the subsequent messages? You could try changing the debug print control in line 10 from 0 to 1, which may give you some more clues as to what is going on. Please let me know how you go. Keith

Tech-TX commented 4 years ago

There are cheap no-name clones of the BMP280 and BME280 out of China... he possibly has one of those. All bets are off with a clone from a fly-by-night fab.

shekhuverma commented 3 years ago

Hello , i am using STM32F1 (blue pill board) and i am also getting the exact same issue. The Debug print is also not working. When i comment the bmp0.begin() command everything seems to work just fine.

arthurfprecht commented 2 years ago

Hello everybody, I also ran into this problem using the BMP280 and the Blue pill (STM32F103), using the official core. The code hangs on bmp0.begin(), more specifically, in the Wire.endTransmission() in the readRegister() function, after asking the sensor to send it's chip_id - writing 0xD0 to the address of the sensor, in my case, 0x76, this all correctly, as expected. Interestingly enough, the Adafruit BMP280 and the BMP280_DEV libraries work, and seem to do exactly the same thing, not hanging on the endTransmission(). Probably my sensor is a clone, since it came from China, but I don't think it is all that bad, since it works with the other libraries. I tried other BMP280 and they exhibit the same behavior.

To illustrate what I say, I turned on the debug feature of this library and added some lines to show what is being written in the readRegister() function: image

The code stops working in the Wire.endTransmission(): image

I hope I can help with this issue, since I like this library very much for its simplicity and straightforwardness.

Best regards, Arthur Precht

arthurfprecht commented 2 years ago

Hi everybody! I think I found the issue.

By commenting the "noInterrupts()" and "interrupts()" the code runs flawlessly.

I think the newer STM32 core uses interrupts to handle the Wire.endTransmission(), so when this function is called after noInterrupts(), it hangs. I hope to help anyone who passes by this error.