Core 2 and GoPlus2 - how to connect ?



  • Hi guys

    just a heads up. When you stack M5Core2 with GoPlus2 you'll loose I2C functionality on port A. The reason is that IR_OUT in the GoPlus2 uses the same GPIO as the external I2C (SCL) on port A.

    Here is the full explanation and possible work-a-round.

    Note: M5Core2 internal I2C is not affected.

    Thanks
    Felix



  • @felmue Thanks Felix! I saw your comments about IR_OUT earlier in another post. Hopefully they will fix GoPlus2 before I order one.
    I actually have another question for you. It's sort of off the topic from this one. But ...
    I have a FIRE and 4 Channel DC Motor module. I connected a LEGO motor and used an external DC to power up both FIRE and DC Motor module. I tried their Arduino example. The code was compiled successfully with some modifications, but the motor doesn't move at all. I turned to UIFLOW and saw your post saying current version doesn't support lego board unless downgrade to 1.4.5.
    Right now, I can't even make it work. Can you please help me out?

    Thank you!



  • https://github.com/m5stack/M5Stack/tree/master/examples/Modules/LEGO_PLUS
    The is the Arduino example I used.
    First, the screen didn't even display until I commented out the M5.update(). I changed the initial speed value to 255 and not use buttons to change the value. But the motor still doesn't rotate.

    Thank you!



  • I finally made it. It turns out there are a couple of problems. First, to stack DC Motor Module on FIRE, I had to remove the M5GO Bottom which has the battery. In the example, they have M5.Power.begin(). It doesn't cause problem until it executes M5.update(). If I comment out M5.update(), the buttons don't work. Anyway, this is the first problem. I ended up with commenting out the M5.Power.begin()
    The second problem is the if ... else if ... In the example, they used if...else if to catch the button released. It turns out this is not working. It had to be if ... if ...
    Well, I'm happy that it finally works.



  • Hello @raychmond

    I am glad to hear you got it working. Thank you for reporting back.

    Happy Stacking!
    Felix



  • @felmue
    I finally received the GoPlus2. I stacked first with my Fire, and used the GoPlus2 Example, the servos work perfectly. I haven't tested the PortB hub and DC motor on Fire yet.
    However, when I stack with Core2, the servos don't move at all. The only change I made is replaced #include <M5Stack> with #include <M5Core2>.
    Do you have any clue why it doesn't work with Core2?

    Thank you!



  • Hello @raychmond

    hmm, I think on M5Core2 the I2C bus (using GPIO21 / GPIO22) might get initialized twice. Once through M5.begin() - Touch.begin() using Wire1 and then again through below line, but using Wire. That is a recipe for disaster.

    In setup() try commenting out line //goPlus.begin();.

    Thanks
    Felix



  • @felmue Thank you very much for your help. You are the best!
    Simply commenting out that line seems not working. But I followed your idea and renamed all "Wire" to "Wire1" in GoPlus2.cpp. It then works. I don't even understand what "Wire1" is.



  • Hello @raychmond

    good thinking!

    M5Stack (Basic, Fire, Gray, etc.) use one I2C bus for everything. By default it uses Wire with GPIO21 and GPIO22.

    M5Core2 uses two I2C busses. The internal one uses Wire1 with GPIO21 and GPIO22; the external one (port A) uses Wire with GPIO32 and GPIO33.

    Since GoPlus2 was designed for M5Stack devices its I2C pins get mapped into the internal I2C bus of M5Core2.

    Thanks
    Felix



  • @felmue Thank you Felix.
    I tested the PortB hub. It works as well.



  • Has anyone been able to drive two DC motors from the go plus 2 and core2 stack ? I am facing a problem at motor A which only rotates on values greater than 0 to max 127 , but goes not change direction on negative values . Though motor B works absolutely fine . I tested many motors each showed same behaviour at mot A port and worked fine at mot B port .
    Is my goplus2 damaged ?