Skip to content

ULP I2C ulp_riscv_i2c_master_read_from_device loops/hangs when slave sends NAK on data (IDFGH-17676) #18628

@eriksl

Description

@eriksl

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.5.2

Espressif SoC revision.

ESP32-S3

Operating System used.

Linux

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

None

Development Kit.

LilyGo T7 S3

Power Supply used.

USB

What is the expected behavior?

I use ulp_riscv_i2c_master_read_from_device to send an address+register pair:

ulp_riscv_i2c_master_set_slave_addr(address);
ulp_riscv_i2c_master_set_slave_reg_addr(send_buffer.at(0));

	if((rv = ulp_riscv_i2c_master_read_from_device(receive_buffer.data(), receive_buffer.size())) != ESP_OK)
		throw(transient_exception(this->log.esp_string_error(rv, "I2c::ULPModule::send_receive: ulp_riscv_i2c_master_write_to_device")));

This works when the slave responds with data and ACK.

What is the actual behavior?

If the slave responds with ACK after the address and then NAK after the data (which is a real possibility), the function or the ULP I2C module goes haywire. It repeats the sequence for 48 times, after that it keeps repeating with address 0x00 and register 0x00 64 times. After that the slave stops responding to the 0x00 address and it's NAKs. A bit liater the address and data sent become fairly random.

The whole "process stops" after 3684 ms at 100 kHz.

Steps to reproduce.

  1. Send something to a slave using the ULP IC2
  2. Have the slave ACK the address and NAK the data.

That's enough to reproduce.

Debug Logs.


Diagnostic report archive.

No response

More Information.

Image Image Image Image

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions