Skip to content

SERCOM::startTransmissionWIRE() freezes on hardware issue.  #476

Open
@Jolbas

Description

@Jolbas

I have a problem when using I2c with Wire library. When the SDA signal is disturbed by something then sometimes when the process reaches line 530 in SERCOM.cpp it gets stuck in an infinite loop running SERCOM::startTransmissionWIRE() over and over again. If I add a 1500 µS delay before line 530 it seems to get out of the loop. Its like the hardware do not get time to recover without the delay. But a delay would maybe be bad for performance if it's common for this code to be run.
I have this problem on two MKR GSM 1400. Maybe someone can confirm this on different hardware. If I connect SDA to 3V3 I run into this problem.

Here is the lines around SERCOM.cpp:530 with my fix.

if(!isBusOwnerWIRE())
{
  // Restart communication after small delay
  delayMicroseconds(1500);
  startTransmissionWIRE(address >> 1, flag);
}

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