Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


ZU+ Example - Deep Sleep with Periodic Wake-up


  • Zynq UltraScale+ MPSoC Design Example - Deep Sleep with Periodic Wake-up

Table of Contents

Requirements

  1. ZCU102 development board (This design example has been tested on silicon 3.0 revD board).
  2. SDK (2017.1 or later release)
  3. Petalinux (2017.1 or later release)

ZU+ Example - Deep Sleep with Periodic Wake-up

The RPU can be configured to service regular real-time events while the APU remains suspended most of the time. A typical example would be an automotive engine management unit, where the RPU would perform typical engine management functions at regular interval of 2 seconds. The APU would only wake up for passenger entertainment functions, software upgrade and to service other non-realtime events.

Basic Flow
  1. Linux/baremetal application boots on the APU.
  2. Real-time application runs on the RPU.
  3. RPU requests the APU to suspend.
  4. APU suspends itself.
  5. RPU sets the RTC to expire in 2 second, in auto-rearm mode.
  6. RPU sets the RTC as the wake-up source.
  7. RPU suspends itself.
  8. RPU wakes up and perform real-time service. In this example, the RPU toggles the DS50 LED.
  9. RPU suspends itself, and the same repeats.

Steps to build demo example standalone applications
  • APU Application (APU can run either standalone application or Linux.):
    1. APU running standalone application.
      • Start with an empty APU application (like the Hello World example here).
      • Replace main.c with this file (apu_application.c)
      • Build application elf.
  • RPU Application:
    1. Start with an empty RPU application (like the Hello World example here).
    2. Configure the RPU to run from TCM (see bellow image.)
    3. (Default HDF has split mode, So RPU will run in split mode. If application doesn't fit into default memory region, user may need to divide the sections for ATCM and BTCM memory regions in lscript.ld file. For more information please see Table 4-5: TCM Address Map in TRM. When running in split mode, each R5 processor has 64KB ATCM and 64KB BTCM. So, user has to divide sections across ATCM and BTCM. As per below snapshot vectors and text sections are in ATCM and other
      sections are in BTCM)
    4. Replace the main.c with this file (rpu_deep_sleep_with_periodic_wakeup.c)
    5. Build application elf.


Steps to run demo example (APU running Linux) using SD boot mode
  1. Create RPU application rpu.elf from SDK as described in above section.
  2. Create a new folder and copy pmufw.elf, zynqmp_fsbl.elf, bl31.elf and u-boot.elf from Petalinux 2017.1 pre-built images. Also copy rpu.elf into same folder.
  3. Create demo-example.bif file in same folder as shown below.

    Code Block
    themeMidnight
    the_ROM_image:
    {
         [fsbl_config] a53_x64
         [pmufw_image] pmufw.elf
         [bootloader,destination_cpu=a53-0] zynqmp_fsbl.elf
         [bootloader,destination_cpu=r5-0] rpu.elf
         [destination_cpu=a53-0, exception_level=el-3,trustzone] bl31.elf
         [destination_cpu=a53-0, exception_level=el-2] u-boot.elf
    }


  4. Create BOOT.bin file using following command.

    Code Block
    themeMidnight
    bootgen -arch zynqmp -image demo-example.bif -w -o BOOT.bin


  5. Create a boot and root partition in SD card and copy BOOT.bin file to boot partition.
  6. Copy image.ub and system.dtb from Petalinux 2017.1 pre-built images to boot partition of the SD card.
  7. Boot the ZCU102 board in SD boot mode.
  8. After booting linux write following lines on linux console.
    (In petalinux prebuilt image by default RTC wakeup source is enabled. So you need to disable RTC wakeup source otherwise Linux can wakeup from RTC)(In petalinux prebuilt image by default split mode config object is present, So if RPU is running in split mode, RPU1 needs to be powered down, else PMU would consider it PM disabled PU and would not released all unused nodes causing FPD on during APU suspend)

    Code Block
    themeMidnight
    echo disabled > /sys/devices/platform/amba/ffa60000.rtc/power/wakeup
    echo request_wakeup 8 1 0 1 > /sys/kernel/debug/zynqmp_pm/power
    echo force_powerdown 8 >  /sys/kernel/debug/zynqmp_pm/power
    echo release_node 69 > /sys/kernel/debug/zynqmp_pm/power
    echo MMIO_WRITE 0xFFD80064 1 1 > /sys/kernel/debug/zynqmp_pm/power

    (For v2018.2)

    Code Block
    themeMidnight
    echo disabled > /sys/devices/platform/amba/ffa60000.rtc/power/wakeup
    echo pm_request_wakeup 8 1 0 1 > /sys/kernel/debug/zynqmp-firmware/pm
    echo pm_force_powerdown 8 >  /sys/kernel/debug/zynqmp-firmware/pm
    echo pm_release_node 69 > /sys/kernel/debug/zynqmp-firmware/pm
    echo 0 > /sys/module/printk/parameters/console_suspend
    echo 0x1 0x1 > /sys/firmware/zynqmp/pggs3

    (For v2018.3)

    Code Block
    themeMidnight
    echo disabled > /sys/devices/platform/amba/ffa60000.rtc/power/wakeup
    echo disabled > /sys/devices/platform/amba/ff000000.serial/power/wakeup
    echo disabled > /sys/devices/platform/amba/ff010000.serial/power/wakeup
    echo pm_release_node 69 > /sys/kernel/debug/zynqmp-firmware/pm
    echo 0 > /sys/module/printk/parameters/console_suspend
    echo 0x1 0x1 > /sys/firmware/zynqmp/pggs3

    (For v2019.1 - Later)

    Code Block
    themeMidnight
    echo disabled > /sys/devices/platform/amba/ffa60000.rtc/power/wakeup
    echo disabled > /sys/devices/platform/amba/ff000000.serial/power/wakeup
    echo disabled > /sys/devices/platform/amba/ff010000.serial/power/wakeup
    echo disabled > /sys/devices/platform/amba/ff0a0000.gpio/power/wakeup
    echo pm_release_node 69 > /sys/kernel/debug/zynqmp-firmware/pm
    echo 0 > /sys/module/printk/parameters/console_suspend
    echo 0x1 0x1 > /sys/firmware/zynqmp/pggs3



The DS50 LED will on for 2 seconds when RPU wakes up, after that RPU goes down to sleep for 2 seconds. RPU wakes up again and same cycle repeats every time. One can change LED on time (or do another task instead of LED on/off) and RPU sleep time according to requirement.

...