8000 Is there any way to ensure 100% accurate i2c interfacing ? · Issue #811 · espressif/arduino-esp32 · GitHub
[go: up one dir, main page]

Skip to content
Is there any way to ensure 100% accurate i2c interfacing ? #811
Closed
@euquiq

Description

@euquiq

I came to realize that i2c timing is critical and since Arduino layer is on top os RTOS, interfacing with espressif IDF, depending on my code, it may be very difficult to maintain such i2c strict timing requirements.

I cannot get 100% clean data from my Melexis MLX90621 termal array sensor. It communicates through i2c with my ESP32 and sooner or later, data gets garbled. I already posted this issue before. #659

On the esp8266 everything works smoothly, no errors after days of running my code. On the esp32, sadly, the i2c communication is at most, unstable.

I get:

[E][esp32-hal-i2c.c:313] i2cRead(): Timeout! Addr: 60, index 32
[E][esp32-hal-i2c.c:161] i2cWrite(): Busy Timeout! Addr: 60
[W][esp32-hal-i2c.c:280] i2cRead(): Busy Timeout! Addr: 60

By the dozen each minute.

I did follow user stickbreaker recommendation, stating "The I2C subsystem is timing dependent. If any of the core error messages are generated it causes a chain reaction of additional timeout/ack failures. Disable the core logging and test the return codes in your application. uint8_t err=Wire.endTransmission() uint8_t err=Wire.requestFrom(slaveId,count);"

I can see the correct number of bytes being returned by my sensor, and no error after wire.endTransmission() ... until the errors start.

I can catch this and retry the reading / writing to i2c, or even first RESETTING the wire interface and then retry.

Right now I am doing just that. But it does not feel right (unless it is the only way to cope with it) ... hence the question:

Is there any way to tell Arduino "suspend all RTOS activities while I execute this code" ?

Regards, Enrique

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0