Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting I2C error #10

Open
vonmartins opened this issue May 8, 2024 · 1 comment
Open

Getting I2C error #10

vonmartins opened this issue May 8, 2024 · 1 comment

Comments

@vonmartins
Copy link

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
@qsjhyy
Copy link
Contributor

qsjhyy commented May 9, 2024

Perhaps you can try using this pin to do an address scan, one by one to troubleshoot the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants