pycom / pycom-micropython-sigfox

A fork of MicroPython with the ESP32 port customized to run on Pycom's IoT multi-network modules.
MIT License
196 stars 167 forks source link

LoPy-4 I2C bus error problem #221

Closed teusH closed 5 years ago

teusH commented 5 years ago

Use of PyCom LoPy-4 board, firmware 1.18.0.r1 with 2 I2C modules on same channel 0, pins=(P23,P22) This problem does not occure running 3 other LoPy-4 board with previous firmware release and same modules and pin settings. The (DMA?) problem seems to occure mostly with more memory use on I2C bus, e.g. Seed I2C oled display.

My workaround which seems to work well is:

for cnt in range(0,2):
  try:
    read/write actions to I2C device
    break
  except OSError:
     i2c.init(I2C.MASTER,pins=('P23','P22'))
     sleep(0.2)
if cnt > 1: raise OSError

I did notice another forum write on this issue, which disabled the irq, do the mem_read, and enable the irq. I'm not sure this workaround (unhandy for me as it involves a lot work in libraries) was cured in a later firmware release. Question: is this a firmware bug or not? Teus Hagen

teusH commented 5 years ago

This bug report can be closed. The BME680 I2C/TTL modules were corrrupting the bus (i2c.scan gave various outputs ..). The I2C BME280 replacement solved the problem. This headache is gone. Reason why this BME80 serie (tried 3 modules) is causing rubish on the I2C bus is unknown to me. teus