Skip to content

i2c_sam0 LOWTOUT is not functional #21232

@sslupsky

Description

@sslupsky

Describe the bug
When using the i2c_sam0 driver, SCL remains low indefinitely after a bus transaction. SCL should be released when a bus transaction completes. LOWTOUT is intended to guard against situations where SCL is held low too long.

The i2c_sam0 driver enables LOWTOUT (SCL low timeout). However, the driver does not initialize GCLK_SERCOM_SLOW which is required to enable the timeout (see 28.5.3 and 28.6.3.1).

To Reproduce
Steps to reproduce the behavior:

  1. use blinky example
  2. Add opt3001 i2c peripheral (actually, any i2c peripheral)
  3. make
  4. observe SCL
  5. See error

Expected behavior
SCL will be released after the LOWTOUT timeout.

I applied the following patch to i2c_sam0_initialize() to test the expected behaviour:

    GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID_SERCOMX_SLOW | GCLK_CLKCTRL_GEN_GCLK2 |
                GCLK_CLKCTRL_CLKEN;

Impact
When SCL is held low, the pull up resistors on the bus consume power on the order of 500uA or more (depending on the value of the pull up resistor). This bug rules out any low power applications that require the i2c driver.

Metadata

Metadata

Assignees

Labels

StalebugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions