Skip to content

Getting I2C error #10

@vonmartins

Description

@vonmartins

Greetings, I'm getting this error requestFrom(): i2cWriteReadNonStop returned Error -1. When I try the example code for I2C it works but then with my code doesn't. Both codes are more or less the same. I'm using an ESP32-S3 so i use the pins that I want, 5 for clock and 6 for data. I tried using other pins, using pullup resistors, or changing to UART but there's no communication. What it stranges me the most is that sometimes with anotther code, like the example code, it works. But then with another similar code it doesn't. I think it's something about the hardware or even the module itself. Thanks

Here's my code:

#include "includes.h"

// ------------------- Voice Module -------------------
DFRobot_DF2301Q_I2C DF2301Q;
// ----------------------------------------------------

void setup()
{

  Serial.begin(115200);
  Wire.begin(I2C_SDA,I2C_SCL);

   while( !( DF2301Q.begin() ) ) {
        Serial.println("Communication with device failed, please check connection");
        delay(3000);
    }
    Serial.println("Voice module enabled!");
    DF2301Q.setVolume(4);
    DF2301Q.setMuteMode(0);
    DF2301Q.setWakeTime(15);
    DF2301Q.playByCMDID(23);
}

void loop() {
    uint8_t CMDID = 0;
    CMDID = DF2301Q.getCMDID();
    if(0 != CMDID) {
        Serial.print("CMDID = ");
        Serial.println(CMDID);
    }
    delay(3000);
}

Output:

[487111][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error -1
[490111][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error -1
[493111][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error -1
[496111][E][Wire.cpp:499] requestFrom(): i2cWriteReadNonStop returned Error -1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions