Closed Koepel closed 5 years ago
Thanks for the hints, i will look at this. I assume I2C problems with the HAL from the display library, u8g2, too. Could you take at look at i2c driver in hal file of u8g2 lib, too?
Do you mean the u8g2 library itself? I think it is okay.
There is only one Wire.requestFrom()
in u8g2, and that one is correct (link valid on sep 20, 2018). Everything else is writing data, and as far as I can tell, they are also correct.
There is a long thread on some wired kind of interrupt problems possibly caused by i2c hal of u8g2. Indeed, display speed on paxcounter is very low since last updates.
Thanks, I will read it, but I don't think I can help them. The ESP32 Wire-compatible library has changed, perhaps they still have few things to fix.
i made changes in lorawan.cpp and gps.cpp according to your hints. Could you please re-check? You find the changes in the development branch. Thanks.
The usage of the Wire library is correct in the development branch. I don't know what the result was of the wrong use of the Wire library. I hope it still works, because it is now doing something different.
oh, it should do still the same.
In the file "ESP32-Paxcounter/src/lorawan.cpp", in the function
get_hard_deveui()
, the functions to read and write data with I2C are mixed together.The first part has the sequence: Wire.begin - Wire.beginTransmission - Wire.write - Wire.endTransmission That is good.
The second part has the sequence: Wire.beginTransmission - Wire.write - Wire.requestFrom - Wire.available - Wire.read - Wire.endTransmission That is a mix between reading and writing. Writing data should always have
Wire.endTransmission()
at the end, and theWire.beginTransmission()
andWire.endTransmission()
may not be used together withWire.requestFrom()
.See my alternative explanation of the functions of the Wire library.
A similar issue is in the file: "ESP32-Paxcounter/src/gps.cpp". In that file the
Wire.requestFrom()
is encapsulated byWire.beginTransmssion()
andWire.endTransmission()
. Explanation: Common-mistakes, number 2 and 3.