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



  • Hello @felmue,

    Arduino IDE 2.0.0 current settings:
    0_1664821688430_Core2.jpg

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



  • 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.



  • @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!



  • 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



  • 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.



  • 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



  • @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



  • 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.



  • 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



  • 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



  • 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