This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SK-AM62A-LP: Setting MCU GPIO wakeup source from deep sleep

Part Number: SK-AM62A-LP

Tool/software:

Hello,
I have followed this tutorial and this other tutorial to attempt to set MCU_GPIO0_16 as a wakeup source for my board.
I have modified "k3-am62x-sk-lpm-wkup-sources.dtso" on line 35 as suggested by the second tutorial. I noticed that one other thing that needed to be modified was "wake_mcugpio1_pins_default", which I did on line 63. See the file here:

// SPDX-License-Identifier: GPL-2.0
/**
 * AM62 family of devices can wakeup from Low Power Modes via
 * multiple wakeup sources. This overlay enables MAIN GPIO, MCU GPIO,
 * and MCU MCAN pins.
 *
 * Copyright (C) 2023 Texas Instruments Incorporated - http://www.ti.com/
 */

/dts-v1/;
/plugin/;

#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>

#include "k3-pinctrl.h"

&{/} {
	gpio_key {
		compatible = "gpio-keys";
		autorepeat;
		pinctrl-names = "default";
		pinctrl-0 = <&main_gpio1_pins_default>;
		switch {
			label = "WKGPIO";
			linux,code = <KEY_WAKEUP>;
			interrupts-extended = <&main_gpio1 10 IRQ_TYPE_EDGE_RISING>,
				<&main_pmx0 0x1a0>;
			interrupt-names = "irq", "wakeup";
		};
	};

	mcu_gpio_key {
		compatible = "gpio-keys";
			autorepeat;
		pinctrl-names = "default";
		pinctrl-0 = <&wake_mcugpio1_pins_default>;
		interrupt-parent = <&mcu_gpio0>;
		interrupts = <16 IRQ_TYPE_EDGE_RISING>;
		switch {
			label = "MCUGPIO";
			linux,code = <143>;
			gpios = <&mcu_gpio0 16 GPIO_ACTIVE_LOW>;
			wakeup-source;
		};
	};
};

&main_pmx0 {
	main_gpio1_pins_default: main-gpio1-pins-default {
		pinctrl-single,pins = <
			AM62X_IOPAD(0x1a0, PIN_INPUT_PULLUP, 7) /* (E18) MCASP0_AXR0.EHRPWM1_B */
		>;
	};
};

&mcu_pmx0 {
	wake_mcugpio1_pins_default: wake-mcugpio1-pins-default {
		pinctrl-single,pins = <
			/* AM62X_MCU_IOPAD(0x0010, PIN_INPUT, 7) (D8) MCU_SPI0_D1.MCU_GPIO0_4 */
			AM62AX_MCU_IOPAD(0x0040, PIN_INPUT, 7) /* (B9) MCU_GPIO0_16 */
		>;
	};

	mcu_mcan0_tx_pins_default: mcu-mcan0-tx-pins-default {
		pinctrl-single,pins = <
			AM62X_IOPAD(0x034, PIN_OUTPUT, 0) /* (D6) MCU_MCAN0_TX */
		>;
	};

	mcu_mcan0_rx_pins_default: mcu-mcan0-rx-pins-default {
		pinctrl-single,pins = <
			AM62X_IOPAD(0x038, PIN_INPUT, 0) /* (B3) MCU_MCAN0_RX */
		>;
	};

	mcu_mcan0_rx_pins_wakeup: mcu-mcan0-rx-pins-wakeup {
		pinctrl-single,pins = <
			AM62X_IOPAD(0x038, PIN_INPUT | WKUP_EN, 0) /* (B3) MCU_MCAN0_RX */
		>;
	};

	mcu_mcan1_tx_pins_default: mcu-mcan1-tx-pins-default {
		pinctrl-single,pins = <
			AM62X_IOPAD(0x03c, PIN_OUTPUT, 0) /* (E5) MCU_MCAN1_TX */
		>;
	};

	mcu_mcan1_rx_pins_default: mcu-mcan1-rx-pins-default {
		pinctrl-single,pins = <
			AM62X_IOPAD(0x040, PIN_INPUT, 0) /* (D4) MCU_MCAN1_RX */
		>;
	};

	mcu_mcan1_rx_pins_wakeup: mcu-mcan1-rx-pins-wakeup {
		pinctrl-single,pins = <
			AM62X_IOPAD(0x040, PIN_INPUT | WKUP_EN, 0) /* (D4) MCU_MCAN1_RX */
		>;
	};

	mcu_uart0_pins_default: mcu-uart0-pins-default {
		pinctrl-single,pins = <
			AM62X_MCU_IOPAD(0x001c, PIN_INPUT, 0) /* MCU_UART0_CTSn */
			AM62X_MCU_IOPAD(0x0020, PIN_OUTPUT, 0) /* MCU_UART0_RTSn */
			AM62X_MCU_IOPAD(0x0018, PIN_OUTPUT, 0) /* MCU_UART0_TXD */
		>;
	};

	mcu_uart0_rxd_pins_default: mcu-uart0-rxd-pins-default {
		pinctrl-single,pins = <
			AM62X_MCU_IOPAD(0x0014, PIN_INPUT, 0) /* MCU_UART0_RXD */
		>;
	};

	mcu_uart0_rxd_pins_wakeup: mcu-uart0-rxd-pins-wakeup {
		pinctrl-single,pins = <
			AM62X_MCU_IOPAD(0x0014, PIN_INPUT | WKUP_EN, 0) /* MCU_UART0_RXD */
		>;
	};
};

&mcu_gpio0 {
	status = "okay";
};

&mcu_gpio_intr {
	status = "okay";
};

&mcu_mcan0 {
	pinctrl-names = "default", "wakeup";
	pinctrl-0 = <&mcu_mcan0_tx_pins_default>, <&mcu_mcan0_rx_pins_default>;
	pinctrl-1 = <&mcu_mcan0_tx_pins_default>, <&mcu_mcan0_rx_pins_wakeup>;
	status = "okay";
};

&mcu_mcan1 {
	pinctrl-names = "default", "wakeup";
	pinctrl-0 = <&mcu_mcan1_tx_pins_default>, <&mcu_mcan1_rx_pins_default>;
	pinctrl-1 = <&mcu_mcan1_tx_pins_default>, <&mcu_mcan1_rx_pins_wakeup>;
	status = "okay";
};

&mcu_uart0 {
	pinctrl-names = "default", "wakeup";
	pinctrl-0 = <&mcu_uart0_pins_default>, <&mcu_uart0_rxd_pins_default>;
	pinctrl-1 = <&mcu_uart0_pins_default>, <&mcu_uart0_rxd_pins_wakeup>;
	status = "ok";
};


I followed the instructions exactly to compile this file to a .dtbo and include it in my device tree, I also modified uEnv.txt as specified.

When I enter deep sleep or MCU only mode, tying the pin (Pin 11 on J8 MCU Header) to ground didn't wake the device up (as recommended by the tutorial). Tying the pin to 3.3V also didn't wake the device up.
I know that the device can be woken up from deep sleep, as the RTC is able to, as well as WKUP_UART.

What else should I do to wake the device up with an MCU GPIO that is accessible on the J8 MCU Header?

  • I modified the k3-am62x-sk-lpm-wkup-sources.dtso some more to comment out the dual functionality of that pin, note lines 139-146:

    // SPDX-License-Identifier: GPL-2.0
    /**
     * AM62 family of devices can wakeup from Low Power Modes via
     * multiple wakeup sources. This overlay enables MAIN GPIO, MCU GPIO,
     * and MCU MCAN pins.
     *
     * Copyright (C) 2023 Texas Instruments Incorporated - http://www.ti.com/
     */
    
    /dts-v1/;
    /plugin/;
    
    #include <dt-bindings/input/input.h>
    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/interrupt-controller/irq.h>
    #include <dt-bindings/interrupt-controller/arm-gic.h>
    
    #include "k3-pinctrl.h"
    
    &{/} {
    	gpio_key {
    		compatible = "gpio-keys";
    		autorepeat;
    		pinctrl-names = "default";
    		pinctrl-0 = <&main_gpio1_pins_default>;
    		switch {
    			label = "WKGPIO";
    			linux,code = <KEY_WAKEUP>;
    			interrupts-extended = <&main_gpio1 10 IRQ_TYPE_EDGE_RISING>,
    				<&main_pmx0 0x1a0>;
    			interrupt-names = "irq", "wakeup";
    		};
    	};
    
    	mcu_gpio_key {
    		compatible = "gpio-keys";
    			autorepeat;
    		pinctrl-names = "default";
    		pinctrl-0 = <&wake_mcugpio1_pins_default>;
    		interrupt-parent = <&mcu_gpio0>;
    		interrupts = <16 IRQ_TYPE_EDGE_RISING>;
    		switch {
    			label = "MCUGPIO";
    			linux,code = <143>;
    			gpios = <&mcu_gpio0 16 GPIO_ACTIVE_LOW>;
    			wakeup-source;
    		};
    	};
    };
    
    &main_pmx0 {
    	main_gpio1_pins_default: main-gpio1-pins-default {
    		pinctrl-single,pins = <
    			AM62X_IOPAD(0x1a0, PIN_INPUT_PULLUP, 7) /* (E18) MCASP0_AXR0.EHRPWM1_B */
    		>;
    	};
    };
    
    &mcu_pmx0 {
    	wake_mcugpio1_pins_default: wake-mcugpio1-pins-default {
    		pinctrl-single,pins = <
    			/* AM62X_MCU_IOPAD(0x0010, PIN_INPUT, 7) (D8) MCU_SPI0_D1.MCU_GPIO0_4 */
    			AM62AX_MCU_IOPAD(0x0040, PIN_INPUT | WKUP_EN, 7) /* (B9) MCU_GPIO0_16 */
    		>;
    	};
    
    	mcu_mcan0_tx_pins_default: mcu-mcan0-tx-pins-default {
    		pinctrl-single,pins = <
    			AM62X_IOPAD(0x034, PIN_OUTPUT, 0) /* (D6) MCU_MCAN0_TX */
    		>;
    	};
    
    	mcu_mcan0_rx_pins_default: mcu-mcan0-rx-pins-default {
    		pinctrl-single,pins = <
    			AM62X_IOPAD(0x038, PIN_INPUT, 0) /* (B3) MCU_MCAN0_RX */
    		>;
    	};
    
    	mcu_mcan0_rx_pins_wakeup: mcu-mcan0-rx-pins-wakeup {
    		pinctrl-single,pins = <
    			AM62X_IOPAD(0x038, PIN_INPUT | WKUP_EN, 0) /* (B3) MCU_MCAN0_RX */
    		>;
    	};
    
    	mcu_mcan1_tx_pins_default: mcu-mcan1-tx-pins-default {
    		pinctrl-single,pins = <
    			AM62X_IOPAD(0x03c, PIN_OUTPUT, 0) /* (E5) MCU_MCAN1_TX */
    		>;
    	};
    	
    	mcu_mcan1_rx_pins_default: mcu-mcan1-rx-pins-default {
    		pinctrl-single,pins = <
    			AM62X_IOPAD(0x040, PIN_INPUT, 0) /* (D4) MCU_MCAN1_RX */
    		>;
    	};
    
    	mcu_mcan1_rx_pins_wakeup: mcu-mcan1-rx-pins-wakeup {
    		pinctrl-single,pins = <
    			AM62X_IOPAD(0x040, PIN_INPUT | WKUP_EN, 0) /* (D4) MCU_MCAN1_RX */
    		>;
    	};
    
    	mcu_uart0_pins_default: mcu-uart0-pins-default {
    		pinctrl-single,pins = <
    			AM62X_MCU_IOPAD(0x001c, PIN_INPUT, 0) /* MCU_UART0_CTSn */
    			AM62X_MCU_IOPAD(0x0020, PIN_OUTPUT, 0) /* MCU_UART0_RTSn */
    			AM62X_MCU_IOPAD(0x0018, PIN_OUTPUT, 0) /* MCU_UART0_TXD */
    		>;
    	};
    
    	mcu_uart0_rxd_pins_default: mcu-uart0-rxd-pins-default {
    		pinctrl-single,pins = <
    			AM62X_MCU_IOPAD(0x0014, PIN_INPUT, 0) /* MCU_UART0_RXD */
    		>;
    	};
    
    	mcu_uart0_rxd_pins_wakeup: mcu-uart0-rxd-pins-wakeup {
    		pinctrl-single,pins = <
    			AM62X_MCU_IOPAD(0x0014, PIN_INPUT | WKUP_EN, 0) /* MCU_UART0_RXD */
    		>;
    	};
    };
    
    &mcu_gpio0 {
    	status = "okay";
    };
    
    &mcu_gpio_intr {
    	status = "okay";
    };
    
    &mcu_mcan0 {
    	pinctrl-names = "default", "wakeup";
    	pinctrl-0 = <&mcu_mcan0_tx_pins_default>, <&mcu_mcan0_rx_pins_default>;
    	pinctrl-1 = <&mcu_mcan0_tx_pins_default>, <&mcu_mcan0_rx_pins_wakeup>;
    	status = "okay";
    };
    
    /*
    &mcu_mcan1 {
    	pinctrl-names = "default", "wakeup";
    	pinctrl-0 = <&mcu_mcan1_tx_pins_default>, <&mcu_mcan1_rx_pins_default>;
    	pinctrl-1 = <&mcu_mcan1_tx_pins_default>, <&mcu_mcan1_rx_pins_wakeup>;
    	status = "okay";
    };
    */
    
    &mcu_uart0 {
    	pinctrl-names = "default", "wakeup";
    	pinctrl-0 = <&mcu_uart0_pins_default>, <&mcu_uart0_rxd_pins_default>;
    	pinctrl-1 = <&mcu_uart0_pins_default>, <&mcu_uart0_rxd_pins_wakeup>;
    	status = "ok";
    };
    


    This is because I assumed that "mcu_mcan1_rx_pins" was overwriting the same I/O pad with a different functionality (see line 93 and 99).
    Still was not able to get that pin to wake up the device.

  • Hi Nathan,

    Can you share the PADCONFIG register value of the pin you are using to wakeup the device?

    Thanks,

    Anshu

  • Hi Anshu,


    Above is the register for the pin I am using to wakeup the device.

    Below is the register for the pin I was using for reference from line 62 above (from the AM62X datasheet):

  • MCU_PADCONFIG16 is address 0x04084040

    MCU_PADCONFIG4 (from AM62x datasheet) is address 0x04084010

  • Hi Nathan,

    I was looking for the value stored in those register. You can use something like devmem2 on the linux userspace.

    Thanks,

    Anshu

  • Hi Nathan,

    Also please share the output of 'cat /proc/interrupts' 

    Thanks,

    Anshu