Esp32-s3无法扫描到i2c设备

连接正确,但是扫描不到,尝试过更换引脚,添加上拉电阻

这是我的代码

#include<Wire.h>
byte busStatus;
int nDevices=0;
void setup()
{
  Serial.begin(9600);
  Wire.begin(6, 7);  //SDA = GPIO-6, SCL = GPIO-7
  for (int i2cAddress = 0x00; i2cAddress < 0x80; i2cAddress++)
  {
    Wire.beginTransmission(i2cAddress);
    busStatus = Wire.endTransmission();
    if (busStatus == 0x00)
    {
      Serial.print("I2C Device found at address: 0x");
      Serial.println(i2cAddress, HEX);
      nDevices++;
    }

    else
    {
      Serial.print("I2C Device not found at address: 0x");
      Serial.println(i2cAddress, HEX);
    }
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");
}

void loop()
{

}

(由 AI 翻译成中文)
ESP32-S3 的 GPIO 6 和 7 可能被保留用于内部 SPI 闪存,在这种情况下不能用于 I2C。请查阅您的 ESP 文档(可以尝试使用 GPIO 8 和 9,通过 Wire.begin(8, 9); 设置 SDA = GPIO 8,SCL = GPIO 9)。请确保地线也已连接。

你好,我尝试了8,9,但是问题依然存在。我外接的是pn532模块,也许是硬件的问题?

➜ ESP32 PN532 NFC Module Code Examples in Arduino and more