I2C Slave RTL8720DN


I have a simple question. I just want to know if I can use the slave mode on a RTL8720DN using the Wire library in Arduino.


yes, you should be able to set it in I2C slave mode with Wire.begin(address)


You have to be extra careful though, because in its current version (3.1.2) the Arduino Ameba SDK 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, 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, and the corrected version of I2C_SlaveWrite() here.

Good luck!

1 Like


I am having the issue where the receiveEvent function is not being called. I have changed the library files as you suggested. I have updated the Arduino realtek library with the Amebad library. I appreciate the help.

#include "Wire.h"                              

byte I2C_OnOff;                                 //defining the variable that will be sent

void setup() 
  Wire.begin(0x3a);                                // Join I2C bus as the slave 

void loop() 
   Serial.println("Check if Received....");

void receiveEvent(int Press)
  I2C_OnOff = Wire.read();                      // Reads the data sent via I2C