M5Paper I2C
-
Hello @Powersoft
the two I2C use
Wire
(internal) andWire1
(external). By default the Adafruit library usesWire
, but for M5Paper we want it to useWire1
. Luckily thesgp.begin()
function allows to overwrite the default.Try something like this (untested):
M5.begin(); // initialises internal I2C (uses Wire) Wire1.begin(25, 32); // initialises external I2C (uses Wire1) Serial.println("\n\n=====SGP30 test===="); if (! sgp.begin(&Wire1)){
Hope this works.
Cheers
Felix -
Felix, I've tried it and for this device it is working. But when I try it with a BMP280 it is not working. I think it is depending on the header of the program.
I will investigate this further.Cheers,
Jan -
Hello @Powersoft
thank you for reporting back. I am glad it works - well, at least for this device.
And yes, not all libraries allow for the
Wire/Wire1
parameter to be supplied viabegin()
function call. There are a lot of libraries which haveWire
hard coded. In such a case you can modify your local copy of the library to your needs.Thanks
Felix -
@felmue
Is there a principal difference in the I2C approach between the M5Paper and the CORE2? -
Hello @Powersoft
yes and no. They both use a different set of GPIOs for internal and external I2C (unlike M5Stack Fire, Gray, etc., which use the same).
However M5Paper uses
Wire
for the internal I2C andWire1
for external I2C. M5Core2 does it the other way round and usesWire1
for internal I2C andWire
for external I2C.When M5Core2 came out I thought the assignment makes a lot of sense since a lot of external libraries have
Wire
hard coded (as I mentioned already) so on M5Core2 those libraries can be used without modification.Why on M5Paper the M5Stack engineers decided to use it the other way round is anyones guess. If I had to guess it was a different engineer preparing M5Paper than M5Core2, but that is my personal opinion alone.
The other thing is that M5Core2 always initialises
Wire1
andWire
can be initialised via a parameter inM5.begin()
whereas on M5Paper onlyWire
is initialised always by default.Other than that I don't think there are any other differences regarding I2C of this two devices.
Thanks
Felix -
I will stop to interface I2C devices to the M5Paper.
Tried to make a connection with various devices, no positive results so far. It is a pity that they have taken this path. Now a number of devices are no longer usable for me on the M5Paper. -
Hello @Powersoft
I am sorry to hear that. I found that sometimes it is helpful to take a break, work on something different for a while and then come back with fresh ideas.
Best of luck!
Felix -
Today I rewrote the routines for the BMP280 and BME280 for a single device.
Simple include the source into the main program, and call it.
This is now working as I wont. It takes a afternoon of work!
Now put the finishing touches on the BMP280/BME280.Would it make sense to post them on the forum when they are ready?
Cheers
Jan -
@powersoft said in M5Paper I2C:
Today I rewrote the routines for the BMP280 and BME280 for a single device.
Simple include the source into the main program, and call it.
This is now working as I wont. It takes a afternoon of work!
Now put the finishing touches on the BMP280/BME280.Would it make sense to post them on the forum when they are ready?
Cheers
JanHi @Powersoft sorry for the absence, ive had some issues to deal with.
nice work finding the issue.
Create a project in the project forum and post your code and solution in there. -
@powersoft said in M5Paper I2C:
Today I rewrote the routines for the BMP280 and BME280 for a single device.
Simple include the source into the main program, and call it.
This is now working as I wont. It takes a afternoon of work!
Now put the finishing touches on the BMP280/BME280.Would it make sense to post them on the forum when they are ready?
Cheers
JanHi @Powersoft sorry for the absence, ive had some issues to deal with.
nice work finding the issue.
Create a project in the project forum and post your code and solution in there.