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

    Unable to wake M5StickC using SH200Q's activity interrupt

    M5 Stick/StickC
    3
    4
    7.4k
    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.
    • M
      marsalkm
      last edited by marsalkm

      According to some of the documentation (and a random issue on GitHub), the SH200Q should be hooked up to GPIO35 to wake the stick from deep sleep upon activity. While running, I can see this interrupt being triggered, but it never actually wakes from deep sleep.

      Here's the code I use to set up the interrupt:

      // Enable acc interrupt
        buf = 1<<1;
        M5.IMU.I2C_Write_NBytes(SH200I_ADDRESS, 0x14, 1, &buf);
      
        // Set acc threshold
        buf = 100;
        M5.IMU.I2C_Write_NBytes(SH200I_ADDRESS, 0x17, 1, &buf);
        
        // Set amount of time acc must be in threshold before interrupt is triggered
        buf = 4;
        M5.IMU.I2C_Write_NBytes(SH200I_ADDRESS, 0x19, 1, &buf);
      
        // set gyro x/y/z as inputs for interrupt (bit 7 enables the use of TIME_THRESHOLD)
        buf = 1<<4 | 1<<5 | 1<<6 | 1<<7;
        M5.IMU.I2C_Write_NBytes(SH200I_ADDRESS, 0x1B, 1, &buf);
      

      And this is the line that should enable wake on GPIO35 activity:
      esp_sleep_enable_ext0_wakeup((gpio_num_t)35, 1); // set ext0 to wake up when GPIO35 is high

      I've also tried enabling wakeup on one of the external M5Stick buttons as a sanity check.. that worked fine.

      My question; is the SH200Q's interrupt actually hooked up to anything, and if so what? Or is there some error in my code?

      1 Reply Last reply Reply Quote 1
      • V
        vany5921
        last edited by

        IMU does not control GPIO35 to issue an interrupt

        1 Reply Last reply Reply Quote 1
        • D
          davesee
          last edited by

          Should this work when using the M5StickC model with the MPU6886 IMU?

          The schematic suggests that GPIO35 is wired to the external interrupt of the MPU6886 https://docs.m5stack.com/#/en/core/m5stickc

          Cheers,
          Dave

          1 Reply Last reply Reply Quote 0
          • D
            davesee
            last edited by

            @marsalkm This ability should work on M5StickC units with the MPU6886. There's more info on this thread here:
            https://community.m5stack.com/topic/2039/wake-up-on-pick-up

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