Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using I2C_CLK_SRC_DEFAULT as a clk_source and LP_I2C_NUM_0 as i2c_port in i2c_master_bus_config_t crashes when calling i2c_master_bus_add_device() (IDFGH-14098) #14908

Closed
3 tasks done
sampohuttunen-pehutec opened this issue Nov 19, 2024 · 0 comments
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@sampohuttunen-pehutec
Copy link

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.

5.3.1

Espressif SoC revision.

ESP32-C6

Operating System used.

Linux

How did you build your project?

VS Code IDE

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

None

Development Kit.

ESP32-C6-DevKitC-1

Power Supply used.

USB

What is the expected behavior?

Either just work as a i2c master, or, like with legacy i2c API, gracefully exit with an error message of not supported configuration.

What is the actual behavior?

Crash with core dump on assert failed: lp_i2c_ll_set_source_clk /IDF/components/hal/esp32c6/include/hal/i2c_ll.h:823 (false)

Steps to reproduce.

Initialialize i2c master with the new API (driver/i2c_master.h) and using the following configuration:

i2c_master_bus_config_t master_config = {
    .clk_source = I2C_CLK_SRC_DEFAULT
    .i2c_port = LP_I2C_NUM_0,
    .scl_io_num = I2C_MASTER_SCL_PIN,
    .sda_io_num = I2C_MASTER_SDA_PIN,
    .glitch_ignore_cnt = 7,
    .flags.enable_internal_pullup = true,
};

and call ESP_ERROR_CHECK(i2c_master_bus_add_device(bus_handle, &esp_slave_dev_cfg, &esp_slave_dev_handle));

That is, the intention here is to use the low power i2c port for i2c master, as the I2C_NUM_0 is already occupied for a i2c slave, i.e. there are both master and slave i2c ports in use simultaneously in the same ESP32. If using the legacy i2c API, then trying to use LP_I2C_NUM_0 as the port is handled gracefully with an error description (although with a typo), but using the new i2c API, there's just a crash. But if the clock source is also set to SOC_MOD_CLK_XTAL_D2, then the communication can be succesfully initialized.

Debug Logs.

No response

More Information.

No response

@sampohuttunen-pehutec sampohuttunen-pehutec added the Type: Bug bugs in IDF label Nov 19, 2024
@github-actions github-actions bot changed the title Using I2C_CLK_SRC_DEFAULT as a clk_source and LP_I2C_NUM_0 as i2c_port in i2c_master_bus_config_t crashes when calling i2c_master_bus_add_device() Using I2C_CLK_SRC_DEFAULT as a clk_source and LP_I2C_NUM_0 as i2c_port in i2c_master_bus_config_t crashes when calling i2c_master_bus_add_device() (IDFGH-14098) Nov 19, 2024
@espressif-bot espressif-bot added the Status: Opened Issue is new label Nov 19, 2024
@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: Opened Issue is new labels Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

3 participants