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

    [SOLVED] Core2 - how to fix the error: call of overloaded 'begin(int ....)' is ambiguous

    Arduino
    3
    19
    16.0k
    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.
    • Marelli7M
      Marelli7
      last edited by

      I added these lines to the .cpp file, but there is no related output on the Serial Monitor.

          _sda   = sda;
          _scl   = scl;
          _speed = speed;
      	Serial.printf("SDA: %d SCL: %d\n", SDA, SCL);
      	Serial.printf("_sda: %d _scl: %d\n", _sda, _scl);
          _wire->begin((int)_sda, (int)_scl, _speed);
      

      Any other tips to get these GPIO's displayed?

      No worries. I'll do the testing for you.

      1 Reply Last reply Reply Quote 0
      • felmueF
        felmue
        last edited by

        Hello @Marelli7

        after burning the modified application and attaching the debug window try resetting your M5Core2 (button next to the SD card slot). The debug output probably happens before the debug window has reattached. Alternatively add a delay() of a couple of seconds before those lines.

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        Marelli7M 1 Reply Last reply Reply Quote 0
        • Marelli7M
          Marelli7 @felmue
          last edited by

          @felmue

          SDA: 21 SCL: 22
          _sda: 21 _scl: 22
          

          The sticker on bottom of the Core2 :
          0_1664812413941_45b23e0b-b792-468a-8321-9e7f07f4285b-afbeelding.png

          1 Reply Last reply Reply Quote 0
          • felmueF
            felmue
            last edited by

            Hello @Marelli7

            ok, for some reason the compiler / linker thinks you are using an M5Stack. Is there a way you can select the board you are using? It should be M5Core2.

            Alternatively you can try to force it to use the correct GPIOs for M5Core2 by replacing this line:

                sensor.begin();
            

            with

                sensor.begin(&Wire, 0x40, 32, 33);
            

            Thanks
            Felix

            GPIO translation table M5Stack / M5Core2
            Information about various M5Stack products.
            Code examples

            1 Reply Last reply Reply Quote 0
            • Marelli7M
              Marelli7
              last edited by

              Hello @felmue,

              Arduino IDE 2.0.0 current settings:
              0_1664821688430_Core2.jpg

              No luck using sensor.begin(&Wire, 0x40, 32, 33);

              teastainT 1 Reply Last reply Reply Quote 0
              • Marelli7M
                Marelli7
                last edited by

                It's getting worse: same issue using the M5Stamp_I/O:
                connected an HW-040 (rotary encoder module) to the M5Stamp I/O.
                WireScan.ino found address 0x45.

                while (!extio.begin(&Wire, 32, 33, 0x45)) {  //I2C was 21,22 for Core 2 32,33
                    //Serial.println("extio Connect Error");
                    M5.Lcd.drawString("extio Connect Error", 0, 0, 4);
                    while (1) {}
                  }
                

                Core2 display shows: extio Connect Error

                BTW: The Unit_DDS function generator with an STM32 works fine connected to the Core2.

                1 Reply Last reply Reply Quote 0
                • teastainT
                  teastain @Marelli7
                  last edited by

                  @marelli7 Hi!
                  I set up my Core2 with a M5Stack ENVII sensor with this simple program...and it works fine.
                  #include <Wire.h>
                  #include <M5Core2.h>
                  #include <SHT3X.h>
                  SHT3X sht30;
                  float tempC = 12.3;

                  void setup() {
                  Wire.begin(32, 33); //SDA, SCL for Core 2 and Stamp PICO
                  Serial.begin(115200);
                  delay(1000);
                  Serial.println("Setup " );
                  }
                  void loop() {
                  if (sht30.get() == 0)
                  {
                  tempC = sht30.cTemp;
                  }
                  delay(1000);
                  Serial.print("Temp= " );
                  Serial.println(tempC, 1);
                  }

                  I realize that the ENVII does not use sensor.begin(), but I just wanted to say that Wire.begin(32, 33); works with Core2 and an I2C sensor.
                  Hope this helps!

                  Cheers, Terry!

                  100% M5Stack addict with several drawers full of product!

                  1 Reply Last reply Reply Quote 0
                  • felmueF
                    felmue
                    last edited by

                    Hello @Marelli7

                    hmm, not sure what's going on.

                    Could you try installing UIFlow firmware (using M5Burner) onto your M5Core2 and then use UIFlow online? I've checked and the Encoder Unit is available for M5Core2. That would tell us that the hardware and setup is ok.

                    Thanks
                    Felix

                    GPIO translation table M5Stack / M5Core2
                    Information about various M5Stack products.
                    Code examples

                    Marelli7M 1 Reply Last reply Reply Quote 0
                    • Marelli7M
                      Marelli7
                      last edited by

                      Hi @felmue,

                      I'm not familiar with UIFlow (yet). Currently using Arduino IDE to program and maintain a dozen ESP32 Devkits.
                      Can I use both UIFlow and Arduino IDE alternately?

                      I cannot understand why my Unit_DDS runs fine on a Core2 and where it goes wrong using the encoder and Stamp I/O -using Arduino IDE. All 3 are using the STM32-chip.

                      The lack of easy accessible I/O makes the Core2 less usable for me. That's why I first bought the Extend I/O (PCA9554PW) > Not working. Then the I2C Encoder (not working) and Stamp I/O (not working). Quite frustrating.

                      First I'll try the Encoder on an ESP32 or even an Uno to set the frequency of the DDS.

                      1 Reply Last reply Reply Quote 0
                      • felmueF
                        felmue
                        last edited by

                        Hello @Marelli7

                        yes, you can use UIFlow and Arduino IDE alternately. UIFlow is just another ESP32 firmware.

                        While those units use the same STM32 chip the firmware inside the STM32 chip is different.

                        I do have the unit EXTIO2 (which uses the same internal STM32 firmware as Stamp I/O) and it works fine with my M5Core2 after adapting the M5Stack example for M5Core2 by replacing those two lines:

                        #include <M5Stack.h>
                        
                        while (!extio.begin(&Wire, 21, 22, 0x45)) {
                        

                        with

                        #include <M5Core2.h>
                        
                        while (!extio.begin(&Wire, 32, 33, 0x45)) {
                        

                        like you did.

                        Note: Make sure you have installed the latest M5Unit-EXTIO2 library. It has been fixed as well for the I2C master slave issue, but the version number has not been increased. So you probably need to re-install it in your environment manually. If your installed version has this line

                        _wire->begin((int)_sda, (int)_scl);
                        

                        then your version already has the fix. Note the two (int).

                        Thanks
                        Felix

                        GPIO translation table M5Stack / M5Core2
                        Information about various M5Stack products.
                        Code examples

                        1 Reply Last reply Reply Quote 0
                        • Marelli7M
                          Marelli7
                          last edited by

                          @felmue

                          Thanks a lot!! Message "extio Connected" made my day. I already changed the I2C adresses, but the (int) did the trick.
                          I was close to the point to give the Core2 some flying lessons.

                          Next will be getting familiar with UIFlow

                          let's close this topic

                          1 Reply Last reply Reply Quote 0
                          • Marelli7M
                            Marelli7 @felmue
                            last edited by

                            Hello @felmue ...A Catch22

                            Finally managed to get the M5Burner to do its job (needed a Burner beta version for the Mac .....why...)

                            the IDE doesn't has the encoder unit listed in the Unit list when using the (+), but the IDE does connect to my Core2. And I don't know how to add unlisted Units to the IDE

                            The web version has the Unit_Enoder but is unable to connect to the Core2 (using Chrome). Somehow I'm unable to select the port to be used. User ajb2k3 suggested to use the orange Terminal button. The terminal connects OK, but the UIFlow doesn't.

                            1 Reply Last reply Reply Quote 0
                            • felmueF
                              felmue
                              last edited by

                              Hello @Marelli7

                              the IDE version is quite old and as I understand no longer maintained. I don't think you can add unlisted units to it.

                              When UIFlow firmware is burned and running on your M5Core2 use M5Burner to set SSID and password. It should then connect to your WiFi and the UIFlow (online) backend.

                              UIFlow, running in the browser, also connects the the backend. You then type in the ID that is shown on the M5Core2 screen and the browser and the M5Core2 then talk to each other through the backend.

                              Note: for that to work no USB connection is needed.

                              Thanks
                              Felix

                              GPIO translation table M5Stack / M5Core2
                              Information about various M5Stack products.
                              Code examples

                              1 Reply Last reply Reply Quote 0
                              • Marelli7M
                                Marelli7
                                last edited by

                                Thanks again @felmue
                                I appreciate these spot-on answers other then guessing what might be the cause (sorry).

                                I wasn't aware of that and I noticed that my Mac was on another SSID. No I understand why 'it' asks to use the same SSID as my mac....

                                FYI: I got my Unit_DDS running on the Core2, controlled by a rotary-encoder (HW-040) connected to the M5Stamp I/O. Both, DDS and I/O, on I2C. Completely useless, other than testing my oscilloscope and hearing loss and blowing a candle with 10Hz, but fun to build.

                                groeten,
                                Paul

                                1 Reply Last reply Reply Quote 0
                                • felmueF
                                  felmue
                                  last edited by

                                  Hello @Marelli7

                                  you are welcome. I sounds like you are having fun. And thanks for reporting back. I am glad to hear you got it working to your liking.

                                  Thanks
                                  Felix

                                  GPIO translation table M5Stack / M5Core2
                                  Information about various M5Stack products.
                                  Code examples

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