# I2C Slave RTL8720DN

**URL:** <https://forum.amebaiot.com/t/i2c-slave-rtl8720dn/1252>\
**Category:** Peripherals\
**Created:** [May 13, 2022, 3:33am UTC](https://forum.amebaiot.com/t/i2c-slave-rtl8720dn/1252 "2022-05-13T03:33:00Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![xsutter](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/xsutter/32/565_2.png) [@xsutter](https://forum.amebaiot.com/u/xsutter)\
**Post date:** [May 13, 2022, 5:09pm UTC](https://forum.amebaiot.com/t/i2c-slave-rtl8720dn/1252/3 "2022-05-13T17:09:06Z")

</div>

Hi,

You have to be extra careful though, because in its current version (3.1.2) the [Arduino Ameba SDK](https://github.com/ambiot/ambd_arduino) has a bug in a low-level function called `I2C_SlaveWrite()` which prevents the I2C slave mode to function properly. This bug was corrected in the [AmebaD SDK](https://github.com/ambiot/ambd_sdk), but unfortunately still exists in the Arduino SDK.

In order to circumvent this bug I had to reimplement the `I2C_SlaveWrite()` function in a bug-free private version which now resides permanently in my code.

You can find details about the bug in [this discussion](https://forum.amebaiot.com/t/rtl8720dn-as-i2c-slave/407), and the corrected version of `I2C_SlaveWrite()` [here](https://github.com/ambiot/ambd_sdk/blob/76daaaaa550c02cbfdd8a11e5023d89b235fd9d8/component/soc/realtek/amebad/fwlib/ram_common/rtl8721d_i2c.c#L719).

Good luck!

---

_[View the full topic](https://forum.amebaiot.com/t/i2c-slave-rtl8720dn/1252)._
