Skip to content

driver: stm32-i2c-v2: negative return from i2c_target_read_processed causes lockup. #93881

@iabdalkader

Description

@iabdalkader

Describe the bug

According to the docs, a negative return from i2c_target_read_requested_cb_t or i2c_target_read_processed_cb_t should:

cause the controller to ignore bus operations until a new start condition is received.

However, what actually happens is that the I2C target stops responding, not quite sure what happens, voltage turns off and break points don't get hit anymore.

Here's a normal test with these functions returning 0:

I2C> scan
I2C address search:
0x60 (0xC0 W) (0xC1 R)

I2C> [0xC1 r:1]

I2C START
TX: 0xC1 ACK 
RX: 0x42 NACK 
I2C STOP
I2C> [0xC1 r:1]

I2C START
TX: 0xC1 ACK 
RX: 0x42 NACK 
I2C STOP
I2C> [0xC1 r:1]

Here's a test with sample_target_read_processed_cb returning -1:

I2C> [0xC1 r:1]

I2C START
TX: 0xC1 ACK 
RX: 0x42 NACK 
I2C STOP
I2C> [0xC1 r:1]

I2C START
TX: 0xC1 NACK 
RX: 0xFF NACK 
I2C STOP

FWIW I'm testing with an Arduino Giga R1.

Also, this might be related: #80994

Regression

  • This is a regression.

Steps to reproduce

  1. In samples/drivers/i2c/custom_target/src/main.c change sample_target_read_processed_cb to return -1.
  2. Read from the I2C target.

Relevant log output

Impact

Functional Limitation – Some features not working as expected, but system usable.

Environment

No response

Additional Context

No response

Metadata

Metadata

Assignees

Labels

area: I2CbugThe issue is a bug, or the PR is fixing a bugplatform: ArduinoArduino boards and shieldspriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions