Announcement

Collapse
No announcement yet.

Issues with Slave I2C (IoD-09th)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Issues with Slave I2C (IoD-09th)

    Hello,
    I have several issues with using the IoD-09th as a slave i2c device along with the <Wire.h> arduino library.
    • When defining the "Wire.onRequest(handler)", the device crash. (This is perhaps link to this issue : https://github.com/espressif/arduino-esp32/pull/5746)
    • The documentation is not clear about which pin is SDA or SCL (see p.5 https://4dsystems.com.au/mwdownloads...d/link/id/201/). I guess SDA is GPIO0 and SCL GPIO2?
    • I tried to use the device as a slave I2C device along with a raspberry Pi which acts as a master. There is no way do define the pin such as in this topic https://forum.4dsystems.com.au/node/60678 as the address of the device is required for Wire.begin(address) and cannot be set to Wire.begin(2,0). When I tried to connect the Rapsberry Pi 4 to the device without defining the onRequest handler, no device is seen with "i2cdetect -y 0" (I use the i2c-0 port).
    Has the slave mode been tested? I'm looking for ideas on how to make it work.
    Thanks

    ___
    Code:
    void setup(){
     Wire.begin(0x04); // join i2c bus with address #4
     Wire.onReceive(receiveEvent); // register event
    
     gfx.begin();
     gfx.Cls();
     gfx.ScrollEnable(false);
     gfx.BacklightOn(false);
     gfx.Orientation(LANDSCAPE);
     gfx.SmoothScrollSpeed(5);
     gfx.TextColor(WHITE, BLACK); gfx.Font(1); gfx.TextSize(1);
     gfx.TextWrap(false);
     Serial.begin(115200);
    }
    
    void loop(){
     yield(); // Required for ESP
    }
    
    void receiveEvent(int howMany){
      while(Wire.available()){
       Serial.println(Wire.read());
      }
    }
    Code:
    i2cset -y 0 0x04 97
    Last edited by ThomasLM; 27 October 2021, 09:35 AM.

  • #2
    Hi Thomas,

    Welcome to the forum.

    The i2C pins SDA and SCL is GPIO0 and GPIO2.

    Try to use lower baud rates and try to see if this will be applicable on your setup. Also, try to use the code below for your wire.begin() setup..

    Code:
    Wire.begin(2, 0, (uint8_t)0x04);


    Regards,
    Ferdinand

    Comment

    Working...
    X