I need to emulate an (small) I2C slave device that is no longer manufactured.
Is it possible to use the esp8266 in slave rather than master mode ??
Otherwise, is there an alternative or work-around ??
I2C Slave Mode
Re: I2C Slave Mode
The ESP8266 doesn't have any I2C peripheral by itself. The I2C that is available in MicroPython is implemented in software. Slave mode is not currently implemented in MicroPython in software.
What you could do is program your ESP8266 in Arduino, or port the Arduino I2C slave code to MicroPython...
What you could do is program your ESP8266 in Arduino, or port the Arduino I2C slave code to MicroPython...
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: I2C Slave Mode
I doubt slave mode can be made to work at any reasonable speed on the ESP8266 as I2C needs a realtime response to incoming signals. If you use interrupts to achieve this you are hamstrung by the large and variable interrupt latency of the chip. A polled solution would be likely to suffer from latency caused both by the underlying RTOS and by garbage collection.
A polled solution is also likely to lead to difficult synchronisation problems with the master - the I2C protocol assumes that the slave is always ready for data.
A polled solution is also likely to lead to difficult synchronisation problems with the master - the I2C protocol assumes that the slave is always ready for data.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: I2C Slave Mode
Thanks, I kind of thought that would be the answer.
I have reverted to the trusty Microchip PICs and have achieved what I wanted to do.
I have reverted to the trusty Microchip PICs and have achieved what I wanted to do.