Low-level I2C slave

jas39_
Posts: 3
Joined: Mon Aug 29, 2016 8:26 pm

Low-level I2C slave

Postby jas39_ » Tue Apr 04, 2017 8:16 pm

I want to make a small timing critical I2C-slave which basically only returns one or two bytes depending on the state of the ESP32 and I can't get it to work with the slave example provided.

What I basically need is an interrupt for each new byte (or full transaction) that comes in and the possibility in the interrupt handler to send a byte back.

* Is there any documentation on how to use the I2C hardware directly?
* Is there anyone using the slave mode that can share some alternative code?
* Any pointers to usefull code are welcome

ESP_Sprite
Posts: 1176
Joined: Thu Nov 26, 2015 4:08 am

Re: Low-level I2C slave

Postby ESP_Sprite » Wed Apr 05, 2017 2:04 am

FWIW, all hardware documentation on the ESP32 (except for the peripherals we haven't come around to documenting yet) is in the Technical Reference Manual: https://espressif.com/en/content/esp32- ... nce-manual . You can also find the I2S hardware description there if you want to make your own driver.

jas39_
Posts: 3
Joined: Mon Aug 29, 2016 8:26 pm

Re: Low-level I2C slave

Postby jas39_ » Wed Apr 05, 2017 8:45 pm

Thanks but the documentation doesn't say much about slave mode. Would be good with an example snippet of code

jas39_
Posts: 3
Joined: Mon Aug 29, 2016 8:26 pm

Re: Low-level I2C slave

Postby jas39_ » Tue Jun 27, 2017 9:22 am

I'm still struggling with getting an i2c-slave running. A real help to me would be to add interrupts to the current i2c example taking actions when data is available in the buffers. Is this something that could be put on the To-do list?

dkaufmann
Posts: 8
Joined: Wed May 17, 2017 9:06 am

Re: Low-level I2C slave

Postby dkaufmann » Wed Sep 13, 2017 10:56 am

Hi all,

I run a I2C in slave mode and I have a problem with the i2c_slave_read_buffer function. I can receive data without any problem if I set the function parameter max_size exactly to the number of bytes received. If I set it to a higher value, the function stucks even if an ACK plus STOP was received. It is not nice if I need to know the exact number of data received of each command. Do you have similar experience?

In ESP-IDF-v2.1 it says that this issue is fixed now, but it is not.

thanks for any help.

Who is online

Users browsing this forum: No registered users and 5 guests