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

I2C - Wire Library crashing when setting clock frequency > 142857 Hz #8772

Closed
1 task done
blackhack opened this issue Oct 16, 2023 · 1 comment · Fixed by #8777
Closed
1 task done

I2C - Wire Library crashing when setting clock frequency > 142857 Hz #8772

blackhack opened this issue Oct 16, 2023 · 1 comment · Fixed by #8777
Assignees
Labels
Area: Peripherals API Relates to peripheral's APIs. Status: In Progress Issue is in progress Type: Bug 🐛 All bugs Type: Regression Result of unforeseen consequences of a previous change
Milestone

Comments

@blackhack
Copy link
Contributor

blackhack commented Oct 16, 2023

Board

ESP32 Dev Module

Device Description

ESP32 Dev Module, nothing connected.

Hardware Configuration

Just the bare board, it is not necessary to have an I2C device connected to reproduce the crash.

Version

latest master (checkout manually)

IDE Name

VSCode PlatformIO, Arduino IDE

Operating System

Windows 11

Flash frequency

80 MHz

PSRAM enabled

no

Upload speed

921600

Description

In the latest version with IDF 5.1, something has changed, and whenever we attempt to set the clock speed for the I2C bus to a value greater than 142857 Hz (e.g., 400 KHz), this assertion assert(scl_high > 13) fails.

Sketch

#include "Wire.h"

void setup() {
  Serial.begin(115200);
  Wire.begin();
  Wire.setClock(400000);
}

void loop() {
}

Debug Message

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1416
load:0x40078000,len:14804
load:0x40080400,len:4
load:0x40080404,len:3356
entry 0x4008059c

assert failed: i2c_ll_set_bus_timing i2c_ll.h:109 (scl_high > 13)


Backtrace: 0x40082529:0x3ffb2080 0x40088335:0x3ffb20a0 0x4008d362:0x3ffb20c0 0x400da30e:0x3ffb21f0 0x400d229d:0x3ffb2210 0x400d163f:0x3ffb2240 0x400d145d:0x3ffb2260 0x400d333d:0x3ffb2290




ELF file SHA256: 067952623cffaa5f

Rebooting...
ets Jun  8 2016 00:22:57  

DECODED LOG:

#0  0x40082812:0x3ffb4f50 in panic_abort at C:\Users\david\.platformio\packages\framework-espidf\components\esp_system/panic.c:452
  #1  0x40087321:0x3ffb4f70 in esp_system_abort at C:\Users\david\.platformio\packages\framework-espidf\components\esp_system\port/esp_system_chip.c:84
  #2  0x4008cd8d:0x3ffb4f90 in __assert_func at C:\Users\david\.platformio\packages\framework-espidf\components\newlib/assert.c:81
  #3  0x400dbef0:0x3ffb50b0 in i2c_ll_set_bus_timing at C:\Users\david\.platformio\packages\framework-espidf\components\hal\esp32\include/hal/i2c_ll.h:109 (discriminator 1)
  #4  0x400dc10d:0x3ffb50d0 in i2c_hal_set_bus_timing at C:\Users\david\.platformio\packages\framework-espidf\components\hal/i2c_hal.c:36
  #5  0x400d1e58:0x3ffb5110 in i2cSetClock at C:/Users/david/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-i2c.c:370 (discriminator 4)
  #6  0x400d191f:0x3ffb5140 in TwoWire::setClock(unsigned long) at C:/Users/david/.platformio/packages/framework-arduinoespressif32/libraries/Wire/src/Wire.cpp:393
  #7  0x400d13f1:0x3ffb5160 in app_main at src/main.cpp:10
  #8  0x40089e40:0x3ffb5190 in main_task at C:\Users\david\.platformio\packages\framework-espidf\components\freertos/app_startup.c:208 (discriminator 13)
  #9  0x40089a49:0x3ffb51c0 in vPortTaskWrapper at C:\Users\david\.platformio\packages\framework-espidf\components\freertos\FreeRTOS-Kernel\portable\xtensa/port.c:162

Other Steps to Reproduce

It happens on normal Arduino core, and when use as IDF component.

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@blackhack blackhack added the Status: Awaiting triage Issue is waiting for triage label Oct 16, 2023
@me-no-dev
Copy link
Member

I can confirm this. You could get around it for now by starting the Wire with correct frequency Wire.begin(SDA, SCL, 400000);

@me-no-dev me-no-dev added Type: Bug 🐛 All bugs Area: Peripherals API Relates to peripheral's APIs. Type: Regression Result of unforeseen consequences of a previous change and removed Status: Awaiting triage Issue is waiting for triage labels Oct 16, 2023
@me-no-dev me-no-dev self-assigned this Oct 16, 2023
@VojtechBartoska VojtechBartoska added this to the 3.0.0 milestone Oct 16, 2023
@VojtechBartoska VojtechBartoska added the Status: In Progress Issue is in progress label Oct 16, 2023
@VojtechBartoska VojtechBartoska moved this from Todo to In Progress in Arduino ESP32 Core Project Roadmap Oct 16, 2023
@VojtechBartoska VojtechBartoska moved this from In Progress to Under investigation in Arduino ESP32 Core Project Roadmap Oct 16, 2023
@github-project-automation github-project-automation bot moved this from Under investigation to Done in Arduino ESP32 Core Project Roadmap Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Peripherals API Relates to peripheral's APIs. Status: In Progress Issue is in progress Type: Bug 🐛 All bugs Type: Regression Result of unforeseen consequences of a previous change
Projects
Development

Successfully merging a pull request may close this issue.

3 participants