i.MX8MP: cortex M stops working when cortex A enters deep sleep

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX8MP: cortex M stops working when cortex A enters deep sleep

592 Views
LBlackStar
Contributor I

Hello,

 

I am develloping an application for the iMX8MP, where I need to put the cortex A to sleep, while keeping cortex M awake.

 

Right now, when I put the cortex A to sleep, the cortex M stops working.

 

Do you know a solution to this problem?

 

Thanks in advance for your help !

 

Regards,

Fabien

Tags (1)
0 Kudos
Reply
3 Replies

564 Views
Manuel_Salas
NXP TechSupport
NXP TechSupport

Hello @LBlackStar 

I hope you are doing very well.

 

You can take a look to the low_power_wakeword example of the SDK. Please check the clock_config.c:

/* The purpose to enable the following modules clock is to make sure the M7 core could work normally when A53 core
     * enters the low power status.*/
    CLOCK_EnableClock(kCLOCK_Sim_m);
    CLOCK_EnableClock(kCLOCK_Sim_main);
    CLOCK_EnableClock(kCLOCK_Sim_s);
    CLOCK_EnableClock(kCLOCK_Sim_wakeup);
    CLOCK_EnableClock(kCLOCK_Debug);
    CLOCK_EnableClock(kCLOCK_Dram);
    CLOCK_EnableClock(kCLOCK_Sec_Debug);

 

You can see on function BOARD_BootClockRUN is configured to still running when cortex A is suspend.

 

I hope this can helps to you.

 

Best regards,

Salas.

 

 

 

0 Kudos
Reply

537 Views
LBlackStar
Contributor I

Hey @Manuel_Salas,

 

I have tried to use the low_power_wakeword example from the SDK, but that one does not seem to work.

 

I get the following output with dmesg activated:

root@ucm-imx8m-plus-sbev:/lib/firmware# echo -n "low_power_wakeword_cm7.elf" > /sys/class/remoteproc/remoteproc0/firmware
root@ucm-imx8m-plus-sbev:/lib/firmware# echo start >  /sys/class/remoteproc/remoteproc0/state
[  182.026523] remoteproc remoteproc0: powering up imx-rproc
[  182.045124] remoteproc remoteproc0: Booting fw image low_power_wakeword_cm7.elf, size 215260
[  182.054789] imx-rproc imx8mp-cm7: Translation failed: da = 0x20000 len = 0x1fd70
[  182.062285] remoteproc remoteproc0: bad phdr da 0x20000 mem 0x1fd70
[  182.068602] remoteproc remoteproc0: Failed to load program segments: -22
[  182.075547] remoteproc remoteproc0: Boot failed: -22
-sh: echo: write error: Invalid argument

 

Also, after looking into the other examples from the SDK, like the hello_world example, the clock configuration you mentionned is also available, but the cortex M still stops working.

 

Could it have something to do with a device tree parameter I am missing?

 

Thank you for your help,

Fabien

0 Kudos
Reply

511 Views
Manuel_Salas
NXP TechSupport
NXP TechSupport

Hello @LBlackStar 

 

Did you follow the instructions of readme.md in the example?

To run the low_power_wakeword you must tu use other external board called 8MIC (that has microphones):

1.  wm8960 codec is used for audio playback and PDM microphones from "8MIC" add-on board are used for audio recording through imx8MM MICFIL hardware.
2.  Make sure the FDT file is correctly set before booting the linux kernel. The following command can be used to set FDT file in uboot console:
    u-boot=>setenv fdtfile imx8mp-evk-rpmsg-lpv.dtb
    Set the "snd_pcm.max_alloc_per_card" in bootargs, use the following command to print default mmcargs and add "snd_pcm.max_alloc_per_card=134217728" to the end. 
    u-boot=>printenv mmcargs
        For example, "mmcargs=setenv bootargs ${jh_clk} ${mcore_clk} console=${console} root=${mmcroot}" is printed, then set the mmcargs using the following command. 
    u-boot=>setenv mmcargs 'setenv bootargs ${jh_clk} ${mcore_clk} console=${console} root=${mmcroot} snd_pcm.max_alloc_per_card=134217728'
    u-boot=>saveenv
    u-boot=>run prepare_mcore
3.  After M core running, please boot the linux kernel to create the rpmsg channel between A core and M core.

******************
Audio record command (no specific audio processing on Linux)
******************
Note:
1. Please use the command "cat /proc/asound/cards" to check the wm8960 sound card number.
E.g: Type command:
        ~# cat /proc/asound/cards
 0 [btscoaudio     ]: simple-card - bt-sco-audio
                      bt-sco-audio
 1 [imxaudioxcvr   ]: imx-audio-xcvr - imx-audio-xcvr
                      imx-audio-xcvr
 2 [audiohdmi      ]: audio-hdmi - audio-hdmi
                      audio-hdmi
 3 [wm8960audio    ]: wm8960-audio - wm8960-audio
                      wm8960-audio
 4 [micfilaudio    ]: micfil-audio - micfil-audio
                      micfil-audio

2. micfil has ID: 4. Then start audio recording with command (-c option can be tuned to select number of microphones):
    "arecord -Dhw:4,0 -r16000 --buffer-time=10000000 -fS32_LE -c2 test.wav &"

3. Make Linux on A core enter suspend:
    "echo mem > /sys/power/state"

4. When a wakeword ("Hey NXP") is detected by M core, Linux will resume and audio record will continue on Linux.

5. Following command can be used to playback an audio file:
      "aplay -Dplughw:3,0 xxx.wav"
   Note that playback will be automatically paused when Linux suspends and restarted after Linux has resumed.

******************
usage with NXP-AFE and advanced audio processing on Linux
******************
See NXP-AFE documentation (https://source.codeaurora.org/external/imx/nxp-afe/) to properly configure Linux ALSA paths and enable advanced audio processing applications.
Then Linux can be suspended by "echo mem > /sys/power/state"
It will be resumed when Cortex-M detects the wakeword.

 

You can find that information on readme.md.

 

About the device tree, you can take a look to the imx8mp-evk-rpmsg-lpv.dts and imx8mp-evk-rpmsg.dts.

 

Bees regards,

Salas.

 

0 Kudos
Reply