-
Notifications
You must be signed in to change notification settings - Fork 7.6k
I2c frequency #6444
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
Comments
Please try latest Arduino git version. Many changes since version 2.0.1 |
Hi @fary99, did you try it with v2.0.2? |
Tried it. Same thing |
Hello @fary99, thanks for your test. @PilnyTomas Can you please test this issue on the latest master? In the meantime. |
Hi, what exactly does it means that the frequency does not change - are you checking it on an oscilloscope, or how? |
Hi again, we already checked the issue on the oscilloscope and indeed the real output CLK frequency is off by a lot. We will investigate... |
Yes, the IIC frequency can not exceed 100K set in the library file, but I have seen the introduction of ESP-IDF, the IIC frequency can exceed 100K. So I modified the source code so that it could be set to be greater than 100K. Then I used the logic analyzer to capture the frequency of IIC, but it was different from the actual. Looking forward to your solution. Here is the code I modified |
Confirmed on an oscilloscope that the I2C bus frequency is significantly lower than configured. For example, when Wire() is initialized at 400kbps, SCL is clocked around 360kHz. When Wire.begin() is initialized at 450kbps, SCL is around 384kHz. I'm using IO21, IO22, 2K pull-ups on SDA and SCL, and current Arduino Core: I was also surprised to see the ESP32 not assert SDA synchronously with SCL for the first bit after an ACK. It looks like glitching at 400kbps and is clearer at 100kbps (both shown below). For the bit after an ACK, SDA floats briefly before the ESP32 drives it low. Is it possible that this is contributing to ESP32 I2C instability at higher clock speeds? This happens to the next data bit after each ACK. Is there a reason the ESP32 doesn't drive SDA low (for a 0 bit) concurrently with falling SCL? |
I tried upstream (4.4-beta1) and I2C reliability is dramatically better. When I initialize wire at 400kbps: Wire.begin(IO_SDA, IO_SCL, (uint32_t)400000); |
Hi, we are investigating this issue with ESP-IDF team. |
Status update: Issue is solved in ESP-IDF, we will let you know when it's reflected to Arduino core. |
Thank you @VojtechBartoska, I'm actually working on switching to ESP-IDF, so I'll try it there. |
@PilnyTomas Can you please just quickly retest this? It's supposed to be solved. |
This appears to be pertinent:
espressif/esp-idf#4300
David
…On Mon, Aug 1, 2022 at 1:05 AM Tomáš Pilný ***@***.***> wrote:
The IDF fix has improved the situation, but it is still not exactly
matching the requested frequency.
For example:
Requested 500 000Hz
Before the fix, with 10k Ohm external pullup: 430 000Hz
After the fix, with 10k Ohm external pullup: 460 000Hz
[image: image]
<https://user-images.githubusercontent.com/34927466/182102339-462b4379-c8f7-432c-aa8b-31519f353c2e.png>
—
Reply to this email directly, view it on GitHub
<#6444 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEDQSVMOROO6CZ4C66WMGDVW6AN3ANCNFSM5RBJDR5Q>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Hi everyone, I have retested the frequency response to the external pull-up value and it seems that lower values correspond better to the requester frequency - try using values less than 5kOhm - 1k should be pretty good. Also according to Technical Reference Manual the supported speed is up to 400kbit/s (see page 278) |
Yes, this will be included for 2.0.5 milestone. |
Board
esp32
Device Description
esp32
Hardware Configuration
not have
Version
v2.0.1
IDE Name
Arduino IDE
Operating System
windows10
Flash frequency
80
PSRAM enabled
no
Upload speed
921600
Description
I want to change the I2C clock, but I find that if the frequency exceeds 100K, the IIC frequency will not change to the size I set. For example, if I set 400K, it can only reach about 350K. Is there any way to optimize it?
Sketch
Debug Message
Other Steps to Reproduce
not have
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: