Skip to main content
Visitor II
July 15, 2019
Solved

Error --"-sh: echo: write error: Device or resource busy" while running app 'OpenAMP_TTY_echo_wakeup' on board STM32MP157C-DK2

  • July 15, 2019
  • 6 replies
  • 4767 views

I'd like to test the standby mode on the board ​STM32MP157C-DK2,so I run the application 'OpenAMP_TTY_echo_wakeup' by following the doc -- readme.txt  in STM32Cube MP1 package. However ,once I run the command 

$ echo mem > /sys/power/state

  to move CA7 in CStop mode , it will report such error:

[ 281.518965] PM: Syncing filesystems ... done.
 
[ 281.546418] Freezing user space processes ... (elapsed 0.001 seconds) done.
 
[ 281.553742] OOM killer disabled.
 
[ 281.557176] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
 
[ 281.564607] Suspending console(s) (use no_console_suspend to debug)
 
[ 281.629016] dwc2 49000000.usb-otg: suspending usb gadget configfs-gadget
 
[ 281.629035] dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0
 
[ 281.629045] dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0
 
[ 281.694403] stm32-dma 48001000.dma: Suspend is prevented by Chan 1
 
[ 281.694436] dpm_run_callback(): platform_pm_suspend+0x0/0x48 returns -16
 
[ 281.694447] PM: Device 48001000.dma failed to suspend: error -16
 
[ 281.694458] PM: Some devices failed to suspend, or early wake event detected
 
[ 281.705449] dwmac4: Master AXI performs any burst length
 
[ 281.705484] stm32-dwmac 5800a000.ethernet eth0: No Safety Features support found
 
[ 281.747812] dwc2 49000000.usb-otg: resuming usb gadget configfs-gadget
 
[ 282.290600] OOM killer enabled.
 
[ 282.293712] Restarting tasks ... done.
 
[ 282.344351] PM: suspend exit
 
-sh: echo: write error: Device or resource busy
 

Do you know the reason for this problem?

    This topic has been closed for replies.
    Best answer by SElle

    ​Thanks! I've found the reason from this link: https://wiki.st.com/stm32mpu/wiki/STM32CubeMP1_Package .I use the Starter Package, but I run the app "OpenAMP_TTY_echo_wakeup" by loading its firmware by IDE at Engineering boot mode. This link points out:

    Most of the examples can be used in Engineering boot mode (except those that require firmware running on a Cortex-A7, such as the OpenAMP examples)

    So I switch to Production boot mode , the app works.

    6 replies

    Technical Moderator
    July 15, 2019

    Hello,

    please refer to https://wiki.st.com/stm32mpu/wiki/Power_overview#How_to_enter_and_exit_low-power_modes

    Note that if you use the Starter Package, i.e Weston/Wayland configuration, the low-power mode is entered upon a 'systemctl suspend' command.

    SElleAuthor
    Visitor II
    July 16, 2019

    ​Thx! I've found the reason.

    But there is still a question, I use the Starter Package, Weston/Wayland configuration. I tested the standby mode according to the fifth step of the app's README  firstly as follows:

    echo disabled > /sys/devices/platform/soc/4c001000.mailbox/power/wakeup
     
    echo "*standby" >/dev/ttyRPMSG0
     
    echo mem > /sys/power/state
     

     Then I wakeup it using Wake up button WKUP1 pin, it will reboot. However, when I replace "$echo mem > /sys/power/state" with the command :

     systemctl suspend 

      as you said, it will not reboot.

    What is the difference in detail between the two commands? 

    Should I always use command 'sysytemctl suspend'  in my Weston board?

    Technical Moderator
    July 15, 2019

    Moreover: If you don't set a wakeup source before entering low power mode, the A7 will go to Cstandby and not in Cstop (see above article).

    See also: "/usr/local/Cube-M4-examples/STM32MP157C-DK2/Applications/OpenAMP/OpenAMP_TTY_echo_wakeup/README" file on the board for also a complete set of power use case example.

    SElleAuthorAnswer
    Visitor II
    July 16, 2019

    ​Thanks! I've found the reason from this link: https://wiki.st.com/stm32mpu/wiki/STM32CubeMP1_Package .I use the Starter Package, but I run the app "OpenAMP_TTY_echo_wakeup" by loading its firmware by IDE at Engineering boot mode. This link points out:

    Most of the examples can be used in Engineering boot mode (except those that require firmware running on a Cortex-A7, such as the OpenAMP examples)

    So I switch to Production boot mode , the app works.

    Visitor II
    September 18, 2019

    I got the same error like you but I couldn't solve the problem so far. How did you switch between engineering boot mode and production boot mode ? Do you mean the eclipse debug configuration tab in the attachment ?

    other question : Our scenario is the second scenario in the readme file. There it says "Set Exti line 61 (IPCC interrupt CPU1) as source of wakeup". So I modified the code and changed 62 to 61 and some other lines related. Did you modify your code as well ? If yes, could you please send me modified codes if possible.

    I will appricate a possible answer very muc, thanks a lot !

    Technical Moderator
    September 19, 2019

    Engineering mode set in SW4STM32 should be also set on the board using BOOT[2:0] = 0b100

    Technical Moderator
    July 16, 2019
    1. "systemctl suspend" command will help to suspend Weston the right way then to call "echo mem > /sys/power/state" to really go to standby. If you dont do that Weston will fail to awake and the platform will finally reboot.
    2. You can also stop Weston, go to standby, wakeup and then start again weston following these steps:
      1. systemctl stop weston
      2. echo disabled > /sys/devices/platform/soc/4c001000.mailbox/power/wakeup
      3. echo "*standby" >/dev/ttyRPMSG0
      4. echo mem > /sys/power/state
      5. "press Wakeup key"
      6. systemctl start weston

    SElleAuthor
    Visitor II
    July 18, 2019

    Although the question I raised is already over, I still have some questions:

    1.Do you mean that on my Weston board, all the places that use command “echo mem > /sys/power/state�? should be replaced with "systemctl suspend" command ?

    For example, the third example of this "OpenAMP_TTY_echo_wakeup" demo to enter System Stop Mode  following these steps:

    echo "*stop" >/dev/ttyRPMSG0
    echo mem > /sys/power/state

    so should I change to

    echo "*stop" >/dev/ttyRPMSG0
    systemctl suspend

    to enter System Stop Mode  in the right way ?

    The results show that both operations can wake up A7 and M4 finally , but the log information is a little different, the wakeup time of "systemctl suspend" is longer.So which command is correct?

    2.According to your second suggestion,do you mean that I can ignore the influence of Weston and and use the "echo mem > /sys/power/state" command to enter System Standby Mode in the right way ?But when I try it by following your steps, the board will still reboot.

    3.Is it only the Weston configuration to use the "echo mem > /sys/power/state" command to enter System Standby Mode and then wakeup with rebooting? Will other configurations use this command to enter System Standby Mode the right way and wakeup without rebooting?

    Technical Moderator
    July 18, 2019

    I will try to answer my best but some questions are not clear for me, please react if you need clarifications.

    1/ Yes. Either you keep Weston up and running and then, you will need to replace any "echo mem > /sys/power/state" command with "systemctl suspend" OR if you don't mind weston, you can also stop weston with "systemctl stop weston" and play only with "echo mem > /sys/power/state" command.

    2/ See 1. On my side following previous suggestion 2, the board is not rebooting, only Weston will start from scratch:

    root@stm32mp1:/usr/local/Cube-M4-examples/STM32MP157C-DK2/Applications/OpenAMP/OpenAMP_TTY_echo_wakeup# echo mem > /sys/power/state
     
    [2019-07-18 09:25:59
     
    [ 1181.285058] PM: suspend entry (deep)
     
    [ 1181.287183] PM: Syncing filesystems ... done.
     
    [ 1181.294530] Freezing user space processes ... (elapsed 0.002 seconds) done.
     
    [ 1181.302112] OOM killer disabled.
     
    [ 1181.305495] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
     
    [ 1181.312817] Suspending console(s) (use no_console_suspend to debug)
     
    [2019-07-18 09:26:09
     
    [ 1181.376234] dwc2 49000000.usb-otg: suspending usb gadget configfs-gadget
     
    [ 1181.376925] dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0
     
    [ 1181.376938] dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0
     
    [ 1181.441448] Disabling non-boot CPUs ...
     
    [ 1181.485377] CPU1 killed.
     
    [ 1181.488768] Enabling non-boot CPUs ...
     
    [ 1181.489731] CPU1 is up
     
    [ 1181.507012] dwmac4: Master AXI performs any burst length
     
    [ 1181.507045] stm32-dwmac 5800a000.ethernet eth0: No Safety Features support found
     
    [ 1181.547034] dwc2 49000000.usb-otg: resuming usb gadget configfs-gadget
     
    [ 1181.701710] dwc2 49000000.usb-otg: new device is high-speed
     
    [ 1181.773611] dwc2 49000000.usb-otg: new device is high-speed
     
    [ 1181.834458] dwc2 49000000.usb-otg: new address 56
     
    [ 1181.856444] configfs-gadget gadget: high-speed config #1: c
     
    [ 1182.096111] OOM killer enabled.
     
    [ 1182.099142] Restarting tasks ... done.
     
    [ 1182.107776] PM: suspend exit

    3/ "echo mem > /sys/power/state" is the standard sysfs interface offered by the suspend framework. So it is to be used whatever the application is running on top of this. The way the system will go low power will depend on the Wakeup source set by the system (can be set in device tree or depending of the case, can be done also with sysfs (see mailbox or uart console examples)).

    See: https://wiki.st.com/stm32mpu/wiki/Power_overview for more dedails.

    Note: in the "OpenAMP_TTY_echo_wakeup" sample application, RPMSG offers the facility to set M4 power state with specific linux commands:

    • Sending message “*stop�? will set M4 into CStop running HAL_PWR_Enter_StopMode()
    • Sending message “*standby�? will set M4 into CStop with PDDS=1 running HAL_PWR_Enter_StandbyMode()

    It is a way to do it but it is not standard.

    SElleAuthor
    Visitor II
    July 18, 2019

    Thank you very much for your answer. I'm still a beginner for low power mode and linux kernel, so I'm sorry that I have so many questions to ask.

    1.The Table 33 in doc STM32MP157xxx reference manual RM0436.pdf mentions that DDR is off in System Standby Mode:

    0690X000009YscqQAC.png

    However, if DDR is off, the platform must be reboot after wakeup. But in the doc  AN5109 low power application note , Figure 7 shows that DDR isn't off, the Table 6 shows that the DDR status is off or self refresh:

    0690X000009Ysd0QAC.png

    0690X000009Ysc7QAC.png

    So what is the true state of DDR?

    2.How do you define the Wakeup Time after exiting from System Standby Mode? The ppt STM32MP1 Microprocessor - Continuing the STM32 Success Story mentions the wakeup time is around 1 second,

    0690X000009YsbdQAC.png

    But if I count all the log time after pressing the wakeup button, it's more than 2s.

    NOTICE: CPU: STM32MP157CAC Rev.B
    NOTICE: Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
    NOTICE: Board: MB1272 Var2 Rev.C-01
    INFO: Reset reason (0x810):
    INFO: System exits from STANDBY
    INFO: Using SDMMC
    INFO: Instance 1
    INFO: Boot used partition fsbl1
    INFO: Product_below_2v5=1: HSLVEN update is
    INFO: destructive, no update as VDD>2.7V
    NOTICE: BL2: v2.0(debug):
    NOTICE: BL2: Built : 13:13:37, Oct 2 2018
    INFO: BL2: Doing platform setup
    INFO: PMIC version = 0x10
    INFO: RAM: DDR3-1066/888 bin G 1x4Gb 533MHz v1.41
    INFO: BL2 runs SP_MIN setup
    INFO: BL2: Loading image id 4
    INFO: Loading image id=4 at address 0x2fff0000
    INFO: Image id=4 loaded: 0x2fff0000 - 0x30000000
    INFO: BL2: Skip loading image id 5
    INFO: read version 0 current version 0
    NOTICE: BL2: Booting BL32
    INFO: Entry point address = 0x2fff0000
    INFO: SPSR = 0x1d3
    INFO: PMIC version = 0x10
    NOTICE: SP_MIN: v2.0(debug):
    NOTICE: SP_MIN: Built : 13:13:37, Oct 2 2018
    INFO: ARM GICv2 driver initialized
    INFO: stm32mp HSI (18): Secure only
    INFO: stm32mp HSE (20): Secure only
    INFO: stm32mp PLL2 (27): Secure only
    INFO: stm32mp PLL2_R (30): Secure only
    INFO: SP_MIN: Initializing runtime services
    INFO: SP_MIN: Preparing exit to normal world
    [ 86.448084] dwc2 49000000.usb-otg: suspending usb gadget configfs-gadget
    [ 86.448103] dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0
    [ 86.448113] dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0
    [ 86.511324] Disabling non-boot CPUs ...
    [ 86.565569] CPU1 killed.
    [ 86.573631] Enabling non-boot CPUs ...
    [ 86.574591] CPU1 is up
    [ 86.579126] usb usb1: root hub lost power or was reset
    [ 86.590644] dwmac4: Master AXI performs any burst length
    [ 86.590675] stm32-dwmac 5800a000.ethernet eth0: No Safety Features support found
    [ 86.635805] dwc2 49000000.usb-otg: resuming usb gadget configfs-gadget
    [ 86.974792] usb 1-1: reset high-speed USB device number 2 using ehci-platform
    [ 87.360361] OOM killer enabled.
    [ 87.363467] Restarting tasks ... done.
    [ 87.404366] PM: suspend exit
    [ 87.505037] bind driver brcmfmac/sdmmc
    [ 87.508756] mmci-pl18x 58007000.sdmmc: allocated mmc-pwrseq
    [ 87.513317] mmci-pl18x 58007000.sdmmc: Linked as a consumer to regulator.8
    [ 87.526341] mmci-pl18x 58007000.sdmmc: mmc1: PL180 manf 53 rev1 at 0x58007000 irq 49,0 (pio)
    [ 87.594891] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
    [ 87.600579] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
    [ 87.617166] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
    [ 87.634126] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
    [ 87.642405] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
    [ 87.657533] mmc1: queuing unknown CIS tuple 0x80 (6 bytes)
    [ 87.749313] mmc1: new high speed SDIO card at address 0001
    [ 87.778086] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
    [ 87.945098] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
    [ 88.035330] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Sep 11 2018 09:22:09 version 7.45.98.65 (r707797 CY) FWID 01-b54727f

    So how do you define the time from Standby to linux console?

    3.My log info and reboot phenomenon is different from your second suggestion -- stop weston,go to standby ,wakeup and start weston , so I’m confusing that whether I did enter the System Standby Mode actually by using the "systemctl suspend" command.

    Is there any way to judge it? The log information in the log of my question 2 shows as follows:

    INFO: Reset reason (0x810):
    INFO: System exits from STANDBY

    can it prove that I did enter the standby mode? Or can I judge by testing the value of Vddcore ? Do you have any suggestions?

    Thanks a lot!

    Technical Moderator
    July 18, 2019

    1/ in Standby mode, you have the choice to switch off the ddr or to keep it in self refresh "SR" (both are supported).

    • The advantage of going in DDR SR is that you will wake up more rapidely (Linux running context is saved then you have to switch on the devices, the clocks and jump into where you were in linux before going to run state (TF-A is mainly doing this jog).
    • The drawback of going in DDR SR is the power consumption of this DDR mode (typically 10mW for a lpddr2).
    • The drawback of going in DDR off is that you will need a complete reboot (so you lose your system context (if not saved in backup RAM) and your wake up time will be longer.

    2/ 1 sec for standby wake up is what is achievable for a final product. We already confirmed this value customizing a bit the SW on DK2. DK2 standard delivery is a development platform so not optimized for power (even if all the power mechanisms are present and can be experienced). For example, full debug is activated and almost all the peripherals.

    A wiki page is under construction to show how to reach better power results with ST boards.

    3/ If you have an EV1 board (MB1263C):

    Some 0Ω shunt resistors (R80, R81, R82) on the back side of the board are present on power supplies and can be replaced by 0.1Ω resistors on VDDCORE, VDD, VVDQ_DDR to measure the voltage and deduce current.