Reset I2C

gregstewart90
Posts: 41
Joined: Thu Jan 19, 2017 5:17 pm

Reset I2C

Postby gregstewart90 » Fri Jun 16, 2017 8:41 pm

I'm working on a project using MCP23017's which are port expanders using the i2c protocol. Occasionally, the chips start returning the wrong readings. I use relays in my design, which I imagine is causing the problem. I hooked it up to a login analizer and got the following result.

Screen Shot 2017-06-16 at 2.35.03 PM.png
Screen Shot 2017-06-16 at 2.35.03 PM.png (21.57 KiB) Viewed 484 times


Right now, when I detect a problem, I reset the esp32 with esp_restart(). This always fixes the issue. Is there a way to correct this without a reset? Is there some way to reset the i2c bus?

Thanks!

User avatar
kolban
Posts: 899
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Reset I2C

Postby kolban » Sat Jun 17, 2017 3:47 am

Howdy there @gregstewart90,
Without more context, the I2C trace doesn't look "wrong".
What you seem to be showing is a clock rate at the top signal and a data trace at the bottom signal. It also looks like you are using the Saleae software for examining the trace. It has an I2C mode where you can ask it to decode the protocol into I2C values. Are these parsing correctly. My arithmetic may be off, but I think I'm seeing 8 clock pulses before repetition.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

gregstewart90
Posts: 41
Joined: Thu Jan 19, 2017 5:17 pm

Re: Reset I2C

Postby gregstewart90 » Mon Jun 19, 2017 12:49 pm

That top is the clock. It is unable to parse the signal. The small segment I showed in the first picture repeats continuously. When it works normally, I only see it poll the mcp's a few times a second.

novalight
Posts: 12
Joined: Tue Apr 19, 2016 1:13 pm

Re: Reset I2C

Postby novalight » Mon Jun 19, 2017 12:54 pm

I think several people have noticed such problems but so far I could not find any solution rather than just reset the ESP32.

Also see:
- viewtopic.php?f=2&t=2178&p=10265&hilit=i2c#p10265
- https://github.com/espressif/esp-idf/issues/680
- https://github.com/espressif/arduino-esp32/issues/349

Maybe someone at espressif can shed some light on what is happening here.

User avatar
rudi ;-)
Posts: 1041
Joined: Fri Nov 13, 2015 3:25 pm
Contact:

Re: Reset I2C

Postby rudi ;-) » Mon Jun 19, 2017 2:01 pm

gregstewart90 wrote:That top is the clock. It is unable to parse the signal. The small segment I showed in the first picture repeats continuously. When it works normally, I only see it poll the mcp's a few times a second.


ok
we see the clk
we see the data

we see no start condition
we see no stop condition

can you post please the CS ( /CE or RST ) pin too?

or how you interference you the device you want to poll?




thank you

best wishes
rudi ;-)
Last edited by rudi ;-) on Mon Jun 19, 2017 2:12 pm, edited 2 times in total.
note:
We enjoy our summer holidays 29th july to 11th september and recharge our batteries
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

gregstewart90
Posts: 41
Joined: Thu Jan 19, 2017 5:17 pm

Re: Reset I2C

Postby gregstewart90 » Mon Jun 19, 2017 2:05 pm

With this being i2c, I only have the SCL and SDA lines. What is the CS ( /CE or RST ) pin?

User avatar
rudi ;-)
Posts: 1041
Joined: Fri Nov 13, 2015 3:25 pm
Contact:

Re: Reset I2C

Postby rudi ;-) » Mon Jun 19, 2017 2:16 pm

gregstewart90 wrote:With this being i2c, I only have the SCL and SDA lines. What is the CS ( /CE or RST ) pin?



if you speak from MCP
there is a CE to select the device

or my second question was:

or how you interference you the device you want to poll?

means then if you talk by address example.

how you set the 3 pins of MCP
A0
A1
A2

btw:
CE = Chip enable
CS = Chip select
RST = Reset

1.png
1.png (23.03 KiB) Viewed 435 times
note:
We enjoy our summer holidays 29th july to 11th september and recharge our batteries
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

Who is online

Users browsing this forum: No registered users and 4 guests