r-map / rmap

rete monitoraggio ambientale partecipativo documentation at https://doc.rmap.cc
https://rmap.cc
52 stars 43 forks source link

firmware: i2c-th sometime Wire.requestFrom return 0 byte when master is connected #399

Closed pat1 closed 2 years ago

pat1 commented 2 years ago

i2c-th disconnected from master have no error. when connected to the master sometime happen:

#     15527 : E: hyt_read 0 < 4
#     15532 : E: hyt2x1 get NO confirmation by read error: 0
#     15548 : E: hyt2x1 get... [ FAIL ]
#     15560 : E: Sensor is getted... [ retry ]

debugging Wire library seems that in TwoWire::requestFrom the address transmission terminate without error but twi_readFrom return 0

pat1 commented 2 years ago

it's no solved twi_readFrom sometime with bus activity return 0

pat1 commented 2 years ago

statistically on ~10.000 sample (12 hours, one sample every 4 sec ) we have 10 Wire.requestFrom failed:

#     45137 : E: hyt_read 0 < 4
#     45520 : E: hyt_read 0 < 4
#     49557 : E: hyt_read 0 < 4
#    102592 : E: hyt_read 0 < 4
#    236445 : E: hyt_read 0 < 4
#    709492 : E: hyt_read 0 < 4
#   1061230 : E: hyt_read 0 < 4
#   1930067 : E: hyt_read 0 < 4
#   1930452 : E: hyt_read 0 < 4
#   3347920 : E: hyt_read 0 < 4

and 4 sample are lost:

#     45553 : E: Sensor is getted... [ FAIL ]
#   1930485 : E: Sensor is getted... [ FAIL ]
#   2154668 : E: Sensor is getted... [ FAIL ]
#   3055751 : E: Sensor is getted... [ FAIL ]
pat1 commented 2 years ago

problem reduced by https://github.com/r-map/ArduinoCore-avr/commit/a17d84676bb7d87731ac2a29610506e6d6f99e26