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

ESP32 I2C response data limitation #756

Closed
hbraasch opened this issue May 25, 2021 · 4 comments · Fixed by nanoframework/nf-interpreter#2103
Closed

ESP32 I2C response data limitation #756

hbraasch opened this issue May 25, 2021 · 4 comments · Fixed by nanoframework/nf-interpreter#2103

Comments

@hbraasch
Copy link

Details about Problem

nanoFramework area: (C# code )

Target: ESP2

Description

When an ESP32 communicates with a I2C slave device, it appears to fail if the slave needs to provide a large number of return values, or if the the response duration from the slave exceeds an unnecessary short time.
If the slave return the data really fast (minimum delay inbetween transfers), the ESP starts failing at byte 32, which being the value 32... feels a bit suspect. Could be a hardcoded limit?

Detailed repro steps so we can see the same problem

  1. With an ESP32 as device, execute a simple I2C WriteRead instruction, with the response buffer large e.g. 20. See attached project.

I2cMasterTesterEsp32.zip

  1. Connect an Arduino e.g. Nano to the ESP32 via I2C. Run an Arduino app that acts as a slave which responds to the ESP2 I2C command. See attached .ino file

I2cSlaveArduino.zip

  1. See hardware connection example

I2TestHw

Other suggested things

I think it could be a timing ussue on the ESP side.
Please have a look at this piece of code for a possible problem. It appears the timeout is hard-coded at 1s (1000 ms), but it times out earlier (I think)...

I2cTimeout

Expected behaviour

The I2C should be able to handle an unlimited amount of return data.

Sample Project

Attached as a link

Screenshot

Showing below it fails at 32 bytes
I2cScreenAt32

@AdrianSoundy
Copy link
Member

I think the issue is to do with interrupts.
There is a 32 byte read buffer used by controller which when filled is moved to a ram a buffer as a result of an interrupt.
Maybe due to no interrupt Alloc specified on i2c_driver_install()

@stale
Copy link

stale bot commented Jul 29, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale The issue/PR hasn't seen any activity from the past 60 days. label Jul 29, 2021
@AdrianSoundy AdrianSoundy removed the stale The issue/PR hasn't seen any activity from the past 60 days. label Jul 29, 2021
@stale
Copy link

stale bot commented Oct 2, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale The issue/PR hasn't seen any activity from the past 60 days. label Oct 2, 2021
@josesimoes
Copy link
Member

@hbraasch this should be fixed now. Please retest and provide feedback.

@stale stale bot removed the stale The issue/PR hasn't seen any activity from the past 60 days. label Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants