Navigation

    M5Stack Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. ForestRupicolous
    F
    • Continue chat with ForestRupicolous
    • Start new chat with ForestRupicolous
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups
    Save
    Saving

    ForestRupicolous

    @ForestRupicolous

    1
    Reputation
    10
    Posts
    1265
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    ForestRupicolous Follow

    Posts made by ForestRupicolous

    • RE: MicroPython port form M5StickC

      I now found the documentation about the pins (https://docs.micropython.org/en/latest/esp8266/tutorial/pins.html) and was able to trigger a callback when pressing the big M5 button (btna):

      #Define Callback:
      def on_wasPressed(p):
      print("Button was pressed: ", p)
      B_M5 = Pin(37, Pin.IN, handler=on_wasPressed, trigger=Pin.IRQ_FALLING, debounce= 500)
      
      
      posted in M5 Stick/StickC
      F
      ForestRupicolous
    • RE: MicroPython port form M5StickC

      @lukasmaximus said in MicroPython port form M5StickC:

      from machine import Pin
      btna = Pin(37, Pin.IN)

      Perfekt, thanks a lot! Thats exactly the piece of code which I needed now.
      For the link: Thats also very helpful. I didn't took the time to port the complete AXP192 library and just added the commands I needed. I will use his full port. Additionally I have to check his port because of some LCD issues I have.

      posted in M5 Stick/StickC
      F
      ForestRupicolous
    • RE: MicroPython port form M5StickC

      Thank you for the link. I got micropython running on the M5StickC but I'm missing some libraries (e.g. AXP, or buttons). When UIFLow is working on top of micropyton I hoped it means that the libraries are available somewhere and can be used/ examined.
      I'm currently working on porting the parts I need from the Arduino M5StickC lib.

      posted in M5 Stick/StickC
      F
      ForestRupicolous
    • RE: MicroPython port form M5StickC

      @ajb2k3 said in MicroPython port form M5StickC:

      @forestrupicolous If you use UIFlow firmware 1.4.3 then the screen works fine however it is built on a slightly older version of Micropython.

      Hi @ajb2k3, is the source code available somewhere? I wasn't able to find the code for the M5StickC anywhere on github. The only UIFlow code I was able to find (https://github.com/m5stack/UIFlow-Code) has gotten it's last commit in June and I think is missing the M5StickC libraries.

      posted in M5 Stick/StickC
      F
      ForestRupicolous
    • RE: M5StickC screen don't work

      Is see two possible issues:

      OSError: I2C bus error (-1)

      The AXP192 PMIC is controlled via I2C, if the bus isn't working maybe the LDO3/2 isn't enabled. Start with a I2C scan to see if a device with address 52 (thats the AXP192) is available. More code is in the post linked above.

      NameError: name 'lcd' isn't defined

      Something went wrong with the initialization of the lcd python module. Maybe the wrong version is included?

      posted in M5 Stick/StickC
      F
      ForestRupicolous
    • RE: M5StickC: turn off screen completely

      @klimbot: I think you have to turn LDO3 and LDO2 off, in your code only LDO2 is off. Take a look at this picture: https://docs.m5stack.com/assets/img/product_pics/core/minicore/m5stickc/m5stickc_05.webp

      posted in M5 Stick/StickC
      F
      ForestRupicolous
    • RE: M5Stick C - Cannot flash firmware

      Are you sure you set the correct baud rate in the flasher module? I had the same issue and reducing the baud-rate to 115200 worked for me.

      posted in M5 Stick/StickC
      F
      ForestRupicolous
    • RE: M5StickC screen don't work

      Hello together,
      I had an Issue with the screen together with micropython (see http://community.m5stack.com/topic/1578/micropython-port-form-m5stickc) and it is possible that for the same reason your sw isn't working. The M5MicroC uses the AXP192 PMIC (this picture is really good: https://docs.m5stack.com/assets/img/product_pics/core/minicore/m5stickc/m5stickc_05.webp) to control all the energy related stuff. As far as I've seen the documents it was introduced in the orange version and is not part of the bigger M5Core (at least not for the version I saw the code). Therefore a lot of libraries don't enable the LDO for the display and background led which led to my issues. In the code you are referencing I'm also not seeing any AXP192 files.

      posted in M5 Stick/StickC
      F
      ForestRupicolous
    • RE: MicroPython port form M5StickC

      Thank you both for your answers. @lukasmaximus is right I would prefer using the standard micropython firmware. As I wasn't able to find an available python module I took a look at the M5StickC Arduino code (https://github.com/m5stack/M5StickC/edit/master/src/AXP192.cpp) and transferred the parts I needed to python. The available datasheet is just in Chinese but together with the code I got the display enabled.

      Here is my prototype code to enable the display and backlight. Please be aware that I haven't included everything from the cpp file so some functionality is missing:

      from machine import I2C
      i2c = I2C(freq=400000, sda=21, scl=22) #Enable I2C
      i2c.scan()  #Check for devices
          [52, 81, 104] #52 is the adress of AXP192
      
      i2c.writeto_mem(52, 0x28, b'\xcc') #Set TFT and TFT_LED to 3.0V
      i2c.readfrom_mem(52, 0x12, 1) #Read Byte 12
        #returns  b'\x13' = 0b10011 -> DCDC enabled but LDO3/2 disabled
      i2c.writeto_mem(52, 0x12, b'\x1f') # enable LDO3/2 (TFT and TFT_LED)
      
      # other code parts:
      i2c.writeto_mem(52, 0x12, b'\x13') #disable LDO3/2 (TFT and TFT_LED)
      i2c.writeto_mem(52, 0x28, b'\x9c') #Dimm display by reducing the voltage
      

      One important thing is that the register 0x12 is also responsible for powering the ESP32. Thats the reason why just setting the LDO3/2 bits alone isn't enough.

      posted in M5 Stick/StickC
      F
      ForestRupicolous
    • MicroPython port form M5StickC

      I'm currently trying to get the LCD running with MicroPython (from https://github.com/m5stack/M5Stack_MicroPython) on the M5StickC. MicroPython is running but the LCD stays dark and I think the issue is the control of the PMIC AXP192 which according to the block diagram controls the chip enable of the LCD and the backlight LED.
      Is there a MicroPython port or module available which controls the AXP192? All examples I found for the M5Stack directly control the LCD without the AXP192.

      posted in M5 Stick/StickC
      F
      ForestRupicolous