Re: ESP32 I2C power/distance problem?
Posted: Fri Mar 23, 2018 10:47 am
Things will look nice and sharp on your logic analyser because it only detects 'low' and 'high', nothing in between.
With my 5m of cable and oscilloscope, I am seeing clearly the shape of the rising and falling edges, at least master-to-slave signals. However, because of all the data flying around with the I²C scanner, I am not able to examine the pulse train in detail (it does not help that my oscilloscope's delayed timebase is not working).
Especially as I had reduced the clock to 50kHz, looking at the rising and falling edges, I think the bus should have been able to work happily with 5m of cable.
From what I could make out from the overlapping traces on my oscilloscope screen, I was surprised to see that the clock signal did not appear as a simple square wave: the period of its cycles was not always 20μs.
I am now addressing my slave on the end of 5m of cable using Arduino code and I can see the response coming back on the oscilloscope. I have not yet tried to read what it's sending. At least so far it tends to demonstrate that I²C can work over that cable with an ESP32.
My hunch at present is that the ESP-IDF I²C driver is not allowing sufficient data setup/hold times (in one or both directions) so even a small cable capacitance stops the bus working (even at reduced clock rate). But it's only a hunch.
P.S. Where have you read that "the I2C bus on the esp32 is not stable without some modifications"?
With my 5m of cable and oscilloscope, I am seeing clearly the shape of the rising and falling edges, at least master-to-slave signals. However, because of all the data flying around with the I²C scanner, I am not able to examine the pulse train in detail (it does not help that my oscilloscope's delayed timebase is not working).
Especially as I had reduced the clock to 50kHz, looking at the rising and falling edges, I think the bus should have been able to work happily with 5m of cable.
From what I could make out from the overlapping traces on my oscilloscope screen, I was surprised to see that the clock signal did not appear as a simple square wave: the period of its cycles was not always 20μs.
I am now addressing my slave on the end of 5m of cable using Arduino code and I can see the response coming back on the oscilloscope. I have not yet tried to read what it's sending. At least so far it tends to demonstrate that I²C can work over that cable with an ESP32.
My hunch at present is that the ESP-IDF I²C driver is not allowing sufficient data setup/hold times (in one or both directions) so even a small cable capacitance stops the bus working (even at reduced clock rate). But it's only a hunch.
P.S. Where have you read that "the I2C bus on the esp32 is not stable without some modifications"?