import bme280.py fails

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
der_kps
Posts: 20
Joined: Sat Feb 22, 2020 6:30 pm

import bme280.py fails

Post by der_kps » Fri Apr 03, 2020 11:01 pm

Hello,
I've some programms running well in an ESP32 environment and I want to run them on a
D1mini Pro (16MB) with ESP8266 firmware (flashed by uPyCraft).
Several Problems occur. One of them is this:
import bmp280.py is ok. I get at last the answer >>>
import bme280.py fails with the answer:

Code: Select all

download ok
excec(open('bmy280.py').read(),globals())
Traceback (most recent call last):
   File "<stdin>", line 1 in <module>
MemoryError:
>>>
This bme280.py runs well with ESP32. I tried 3 others.

What's that?

Regards

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: import bme280.py fails

Post by jimmo » Sat Apr 04, 2020 11:25 am

The ESP8266 has very limited RAM, so the way that your IDE is doing the exec(open(file)) thing is particularly difficult. This requires it to have the entire text of the program in RAM, plus the parse tree, and then the compiled bytecode.

You'd likely have better luck if you put the file on the filesystem and imported it hte normal way (I think that's what you're saying works). That way you only need the last two.

If you make a .mpy you'll only need the frozen bytecode in RAM.

And if you freeze it into your firmware you won't need any RAM.

der_kps
Posts: 20
Joined: Sat Feb 22, 2020 6:30 pm

Re: import bme280.py fails

Post by der_kps » Sun Apr 05, 2020 8:13 pm

Ok,the small RAM (<36KB) might be a problem.
But I think I don't understand the solution and have tried this:
I open the bme280.py (or any other library) and download this file into the device.
I do not run it (F5)!

BMP280 (7kB) is a Sensor for Temp + Press; BME280 (11kB) is a Sensor for Temp + Press + Hum with a larger library.

Using import bmp280 in a corresponding program works.
Using import bme280 in a corresponding program does not work.

I get:

Code: Select all

download ok
exec(open('openbme280_p-h-t.py').read(),globals())
T
:(

Post Reply