RTL8720DN I2C Slave Code


I am having the issue where the receiveEvent function is not being called. I have replaced the default Arduino i2c library files with the Amebad files. So I don’t understand why the code doesn’t facilitate I2C communication.

#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 


Hi which RTL8720DN board are you using? have you upgraded your arduino ameba package to the latest?


I am using the BW16 board and I do have the latest arduino ameba package.


Hi @Shaner3

Both onReceive and onRequest functions are NOT implemented, thus they do not work as of yet.

Though I2C slave is supported on the selected pins, software functions are only meant for Master mode, thus I2C slave might not work at all.

You may consider submit an ISSUE under Github repo to request for such feature to be added later.

Alternatively, you may try to use API directly from the BSP (more specifically the i2c_api.h) which give you full control of I2C peripheral, more detailes can be found in this thread