ESP32 I2C power/distance problem?

Archibald
Posts: 107
Joined: Mon Mar 05, 2018 12:44 am

Re: ESP32 I2C power/distance problem?

Postby Archibald » Mon Mar 26, 2018 10:23 am

antonyc wrote:Just to confirm, it works with the replacement files!
That's really good news.

I have not followed the discussion on GitHub closely, but I am not clear what issue or issues the new library files solve. I get the impression it was problems with real-time multitasking. I've been more focussed on why my I²C fails when I insert a few metres of cable, even when I slow up the clock.

I note in the Technical Reference Manual(page 274):
Users need to configure the values of I2C_SDA_HOLD_TIME and I2C_SDA_SAMPLE_TIME, according to the host characteristics, for the I2C slave to receive data properly.
It would be nice if the Wire library for ESP32 included functions to set these values.
Hexman64 wrote:. . . . . . I cannot observe any change on my scope after using Wire.setClock(10000); . . . . .
Wire.setClock(10000) definitely works here.

Hexman64
Posts: 16
Joined: Wed Mar 14, 2018 3:03 pm

Re: ESP32 I2C power/distance problem?

Postby Hexman64 » Mon Mar 26, 2018 7:39 pm

Wire.setClock(10000) definitely works here.
The command is accepted, but with no effect - I guess you DO observe a change in frequency after changing the clock speed with this command. Strange, I don't.
As my problem is resolved for the moment (I reset the bus as soon as the RTClock returns impossible values), I'll maybe do further setClock testing on the next project, before three different libraries that use the Wire.h are integrated.
I have not followed the discussion on GitHub closely
Me neither, it was some "when this line is high while that line is high during that operation... it fails".
As a much slower bus speed does not resolve your problem, it does not seem like the cable length causes it. Why not give it a try and work through the information on what files to replace and where to get them.

Archibald
Posts: 107
Joined: Mon Mar 05, 2018 12:44 am

Re: ESP32 I2C power/distance problem?

Postby Archibald » Tue Mar 27, 2018 12:33 pm

Hexman64 wrote:Why not give it a try and work through the information on what files to replace and where to get them.
Yes, I intend to get the Wire library working with the new files. Perhaps it's silly but I don't really feel I have things in things in control when I use a library. The issues there have been with the Wire library only reinforce this feeling.

I expect to be using an I²C bus that's about 0.6m long. I don't need multitasking but I would like to be able to wind the speed up above 100kHz.

Hexman64
Posts: 16
Joined: Wed Mar 14, 2018 3:03 pm

Re: ESP32 I2C power/distance problem?

Postby Hexman64 » Wed Mar 28, 2018 2:28 pm

Well, I decided to make my project even more stable yesterday evening and copied over only the 5 files 'stickbreaker' mentioned. That gave a bunch of compiler errors, so I replaced the whole Wire library with this one:

https://github.com/stickbreaker/arduino-esp32

It has been running for about 20 hours now and the bus-error-counter is still zero.
It used to count up 5-10x per day, so I'd say it fixed my bus errors too.

Who is online

Users browsing this forum: No registered users and 44 guests