🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    [Fixed] Scanning the i2c ports on the camera.

    PRODUCTS
    2
    5
    6.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ajb2k3A
      ajb2k3
      last edited by ajb2k3

      First of, I am lost and utterly confused.
      I am trying to run the following code

      void setup()
      {
      Wire.begin();

      Serial.begin(9600);
      while (!Serial); // Leonardo: wait for serial monitor
      Serial.println("\nI2C Scanner");
      }

      void loop()
      {
      byte error, address;
      int nDevices;

      Serial.println("Scanning...");

      nDevices = 0;
      for(address = 1; address < 127; address++ )
      {
      // The i2c_scanner uses the return value of
      // the Write.endTransmisstion to see if
      // a device did acknowledge to the address.
      Wire.beginTransmission(address);
      error = Wire.endTransmission();

      if (error == 0)
      {
        Serial.print("I2C device found at address 0x");
        if (address<16) 
          Serial.print("0");
        Serial.print(address,HEX);
        Serial.println("  !");
      
        nDevices++;
      }
      else if (error==4) 
      {
        Serial.print("Unknown error at address 0x");
        if (address<16) 
          Serial.print("0");
        Serial.println(address,HEX);
      }    
      

      }
      if (nDevices == 0)
      Serial.println("No I2C devices found\n");
      else
      Serial.println("done\n");

      delay(5000); // wait 5 seconds for next scan
      }

      Serial monitor reports -

      Scanning...
      No I2C devices found

      I think this is because its not looking at the correct pins.

      How do I get this to work on the esp32?

      UIFlow, so easy an adult can learn it!
      If I don't know it, be patient!
      I've ether not learned it or am too drunk to remember it!
      Author of the WIP UIFlow Handbook!
      M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

      1 Reply Last reply Reply Quote 0
      • ajb2k3A
        ajb2k3
        last edited by

        Switched to debug mode and now get

        [V][esp32-hal-i2c.c:693] i2c_isr_handler_default(): AcK Err errorByteCnt=1, errorQueue=0 queuepos=0

        No information from google except that its to do with the Ack bit

        UIFlow, so easy an adult can learn it!
        If I don't know it, be patient!
        I've ether not learned it or am too drunk to remember it!
        Author of the WIP UIFlow Handbook!
        M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

        1 Reply Last reply Reply Quote 0
        • ajb2k3A
          ajb2k3
          last edited by

          OK, found an error on the prams card.
          SDA and Vsinc are both assigned to G22
          Soic and SCL assigned to G23

          How do I access the MPU6050 and BME280?

          UIFlow, so easy an adult can learn it!
          If I don't know it, be patient!
          I've ether not learned it or am too drunk to remember it!
          Author of the WIP UIFlow Handbook!
          M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

          1 Reply Last reply Reply Quote 0
          • J
            Jimmy
            last edited by

            hello, the old camera version's IP5306 maybe connect to I2C, maybe confused. so if u need to use I2C, you should cut the sda/scl pin 0_1538192027124_f49fff66-59d8-413e-9629-60ed4cd885a6-image.png of IP5306.

            1 Reply Last reply Reply Quote 0
            • ajb2k3A
              ajb2k3
              last edited by

              Solved, please see this post.

              http://forum.m5stack.com/topic/343/i2c-scanner-working-on-cameras-grove-connector

              UIFlow, so easy an adult can learn it!
              If I don't know it, be patient!
              I've ether not learned it or am too drunk to remember it!
              Author of the WIP UIFlow Handbook!
              M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

              1 Reply Last reply Reply Quote 0
              • First post
                Last post