I2C slave emulation with Pyboard D-series

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

I2C slave emulation with Pyboard D-series

Post by luca824 » Sat Jun 13, 2020 10:15 pm

Hi all,

I'd like to use a pyboard d-series as i2c slave to emulate the behavior of some (sensor such as temperature sensor AD7415)

In particular I'd like my pyboard will be able to:
- receive address byte from master
- send ack to master
- receive byte from master with the register where he want to read data
- execute an interrupt handler (ISR) if this byte is equal to 0x01, and inside this ISR:
1) send ack to master
2) send N bytes as to the master (these bytes are already saved in a list)
3) receive ack from master

Considering that in this project I have no chance to modify master code, after some tests verifying with oscilloscope I found 2 major promblems:
1) not having the same register structure of the sensor I'd like to emulate, pyboard will not sends ack after byte received by master. Exists any solution to "re-create" via software register structure of the emulated sensor?
2) how can I read byte received from master and eventually execute an ISR?

Thank you guys, any suggestion and code examples are well accepted

Post Reply