Emulation of multiple I2C slaves with a Pyboard D-series

The official PYBD running MicroPython, and its accessories.
Target audience: Users with a PYBD
Post Reply
luca824
Posts: 1
Joined: Fri May 15, 2020 10:12 pm

Emulation of multiple I2C slaves with a Pyboard D-series

Post by luca824 » Sun May 17, 2020 9:08 am

Hi all,

I'm working on a project with the aim to adopt a pyboard d-series to emulate the behavior of multiple i2c slave like a temperature or a magnetic sensor, ecc...

The pyboard in this case, acting as a slave, should be able to:
- receive the slave address from master (reading the byte first byte sent)
- identify slave address and R/W bit
- check if the address received is attributed to one of the sensors that I want to emulate (whose addresses are known)
- if it is, send the ACK to master and send data related to the sensor called (already stored in pyboard's memory)

Main problems met to accomplish these functions are:
- it seems to be impossible attribute multiple I2C address to single device
- find out which particular I2C address was queried

I'd like to know if any solutions exist to implement these functions on micropython (in particular on Pyboard D-series) or if is needed adopt a different microcontroller and a lower level language.

Thank you guys, any suggestion is well accepted

Online
User avatar
pythoncoder
Posts: 4165
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Emulation of multiple I2C slaves with a Pyboard D-series

Post by pythoncoder » Mon May 18, 2020 5:52 am

The pyb module doesn't support multiple slave addresses on one bus. You might be able to do it at register level using the stm module, but you'd have to do some research with the chip datasheet. As far as I know you're the first person to consider this.
Peter Hinch

chuckbook
Posts: 115
Joined: Fri Oct 30, 2015 11:55 pm

Re: Emulation of multiple I2C slaves with a Pyboard D-series

Post by chuckbook » Mon May 18, 2020 8:00 am

STM32F7xx supports two slave addresses in HW plus one broadcast (ADDR 0). MP currently supports only one slave address.

Post Reply