iMX8QXP: Use RPMSG to wake up M4 and A35

cancel
Showing results for 
Search instead for 
Did you mean: 

iMX8QXP: Use RPMSG to wake up M4 and A35

iMX8QXP: Use RPMSG to wake up M4 and A35

The reference code is based on L4.14.78 GA1.0.0 BSP and M4 SDK 2.5.1. 

It is tested on iMX8QXP MEK board, and it should also work for iMX8QM board.

In L4.14.78 GA1.0.0 BSP, MU_5 is used for RPMSG between M4 FreeRTOS and A35 Linux, SC_R_MU_5B is M4 side and SC_R_MU_5A is A35 side. In linux side, we used the "imx_rpmsg_tty.ko" for this test, this driver is built as module in default BSP.

Case 1: M4 wake up A35.

Apply "L4.14.78_rpmsg_wakeup.patch" to linux kernel, this patch will enable the RPMSG wake up feature.

"rpmsg_lite_pingpong_rtos.tar.bz2" is the M4 side test code. After booted the board with Linux + M4 rpmsg software, run followed test commands:

1. In A35 UART side, run followed commands:

    # echo enabled > /sys/bus/platform/devices/90000000.rpmsg/power/wakeup

    # insmod ./imx_rpmsg_tty.ko

    # /unit_tests/Remote_Processor_Messaging/mxc_mcc_tty_test.out /dev/ttyRPMSG30 115200 R 100 1000 &

    # echo deadbeaf > /dev/ttyRPMSG30

    # echo mem > /sys/power/state

2. M4 UART side:

   After run "echo deadbeaf > /dev/ttyRPMSG30" from Linux side, it will show "Got ping..." and wait there, after run A35 suspend commane "echo mem > /sys/power/state", Linux suspends. Then from M4 UART side, press "c" key, it will send RPMSG to A35 and wake up A35 Linux.

Case 2: A35 wake up M4.

"power_mode_switch_rpmsg_wakeup.tar.bz2" is the M4 side test code, After booted the board with Linux + M4 rpmsg software, the M4 UART will wait for A35 RPMSG driver ready. Test commands:

1. In A35 UART side, run followed commands to make RPMSG driver ready:

    # insmod ./imx_rpmsg_tty.ko

    # /unit_tests/Remote_Processor_Messaging/mxc_mcc_tty_test.out /dev/ttyRPMSG30 115200 R 100 1000 &

    # echo deadbeaf > /dev/ttyRPMSG30

2. Now M4 UART shows ping pong messages to make sure RPMSG is ready. Now M4 is in power switch menu, select VLLS power mode in M4 UART:

     Press  H for enter: VLLS     - Very Low Leakage Stop mode

    ... ...

     Press R for RPMSG.

After press "R" key in M4 UART, M4 will print "Send a RPMSG message to wake up" and goto suspend mode.

3. Wake up M4 from A35 side, send any data to RPMSG:

    # echo deadbeaf > /dev/ttyRPMSG30

M4 resumed and goto power switch menu again.

SDK folder to compile the two M4 sample code:

SDK/boards/mekmimx8qx/multicore_examples/rpmsg_lite_pingpong_rtos

SDK/boards/mekmimx8qx/demo_apps/power_mode_switch

Tags (2)
Attachments
Comments

Hi Sir,

I follow your Case 1 step and can go through test command , when I press "c" key  , my imx8qxp mek A35 not wake up .

I need re-config kernel or u-boot ?

123.png

Sorry, I missed followed line to enable RPMSG as wakeup source for case 1, now it is updated.

echo enabled > /sys/bus/platform/devices/90000000.rpmsg/power/wakeup

Hi Sir,

Thanks~ It's work.

Hi,

Will you please tell me how to add unit test (/unit_tests/Remote_Processor_Messaging) ?

and also How to build this demo application with SDK ?

Thanks & Regards,

VInothS,

When you build NXP released BSP as the user guider, the unit test applications are builtin as default.

For M4 SDK, after you downloaded the SDK, there is user guider document in it, you can follow it to build.

Thank you Qiang Li - Mpu Se

I am working on IMX8QM-MEK with Android 9 Automotive (android_p9.0.0_2.1.1-auto).

Kernel version - 4.14.98

SDK Version - 2.5.1

I unable to find unit test , Will you please provide some information to add unit test in my source.

If it possible, will you please share the CAN/GPIO wakeup from MCU M4 to A35.

Currently, I am following the this vehicle document for Power Management,

   https://source.android.com/devices/automotive/power/power

Thanks & Regards,

VinothS,

Basically when Linux/Android kernel goto suspend mode, it can set wake up source (keep some wakeup interrupt enabled), then M4 can use these interrupt to wake up Linux/Android.

Thank you Qiang Li - Mpu Se for the reply.

> Basically when Linux/Android kernel goto suspend mode, it can set wake up source (keep some wakeup interrupt enabled), then M4 can use these interrupt to wake up Linux/Android.

Will you please give some more information ?

Will you please tell me how to add this unit test ?

Thanks & Regards,

VinothS,

You don't need add the linux unit test, the Android Auto already used RPMSG to comunicate between A35 and M4. You can check the "EVS/HVAC Function" from Android User Guider document.

And the M4 side application is also included in Android BSP, it is "android_build/vendor/nxp/mcu-sdk-auto" folder.

Thank you Qiang Li - Mpu Se

Yes, I am using RVC. By default M4 load the Rear View Camera demo application.

For wake up A35, Do I needs run power_mode_switch application from M4 right ?

So, I needs to flash power_mode_switch in board, am I right ?

Thanks & Regards,

Vinoth S,

I think you need merge the power_mode_switch into the RVC M4 code. It is not the simple thing.

Thank you Qiang Li - Mpu Se

Yes, you are right, I am also doing the same thing.

Will you please tell me is there any possible to disable auto wakeup.

==> echo mem > /sys/power/state

system going to deep sleep after 30 to 40 sec system wakeup.

Is it possible to disable autowake up in Application processor side ?

Regards,

VinothS,

Hi vinothkumar s

You can get the wake up reason with followed command then to check if it can be disabled or not?

cat /sys/power/pm_wakeup_irq

Thank you Qiang Li for the quick reply

Regards,

VinothS,

Hi Qiang Li - Mpu Se ,

After wake-up I got the result like that,

mek_8q:/ $ cat /sys/power/pm_wakeup_irq
cat: /sys/power/pm_wakeup_irq: No data available

Regards,

VinothS,

I am attempting to apply this application to our i.MX8MQ board. Using:

   Kernel version - 4.14.78

   SDK Version - 2.7.0

RPMSG Share Base Addr is 0xb8000000.

Problem I have is that there is no wake-up option. The following does not exist:

   /sys/bus/platform/devices/b8000000.rpmsg/power/wakeup

Any idea why there is no wake-up option? Is this a device tree option that needs to be added?

This document can't be used for iMX8MQ, it doesn't have the SCU and hardware partition.

All I am trying to do is execute Case 1: M4 wake up A35 from the top of this page. It appears that everything works as expected, but I cannot enable the wake-up feature. Back to my original question - should I expect to see the /sys/bus/platform/devices/b8000000.rpmsg/power/wakeup option? If so, what could cause it to be absent?

Hi Qiang_FSL,

Are there some power consumption measurements available? I am more interested in the case where Cortex A is in DSM and M4 wakes it.

Currently working on a similar app for mini. We noticed that the power consumption is very high for VDD_GPU_VPU_DRAM(8MMini: How to cut GPU/VPU/DDR_PHY power when Cortex A is in Deep Sleep and Cortex M is active ).

I was wondering if you've analyzed power consumption, it would be helpful to know some conclusions for this.

Thanks!

Raluca

Hi Raluca Popa,

Sorry, there is no such power consumption data. But I think it is close to run M4 only on MEK board.

Hi Qiang Li - Mpu Se

Deep Sleep is working in Android 9 Automotive with IMX8QM-MEK board. But, I don't how to wake up from M4. Currently, wake by power key (SW1) present in MEK board.

I unable to proceed your following procedure. Will you please help me to find out the wake up ?

Thanks,

Vinoth S

For released BSP, both ACore and M4 core will goto sleep and wakeup together.

To test M4 work but ACore suspend, you can use Linux released BSP with RPMSG device tree, such as "fsl-imx8qxp-mek-rpmsg.dtb", and M4 side, you can use "MEK-MIMX8QX-SDK\boards\mekmimx8qx\demo_apps\power_mode_switch", then if you suspend Linux, the M4 will keep wakeup.

Thank you Qiang Li - Mpu Se for the quick reply.

from your point I come to know power_mode_switch application will able to wake-up the system.

Am I right ?

Regards,

Vinoth S

The power_mode_switch application will not suspend the M4 with Linux together, so when M4 keeps on running, you can wake up Linux by ON/OFF button, and you can also suspend the linux alone with command "echo mem > /sys/power/state" in linux side.

Thank you Qiang Li - Mpu Se

will you please tell me is there any Flex CAN wake-up from VMCU instead of ON/OFF button.

Regards,

Vinoth S,

in normal case, when linux suspend, if you keep the interrupt enabled, then that interrupt can be used to wake up the linux.

You can add the followed string in flex can devie tree and have a try:

&flexcan1 {

  wakeup-source;

};

Hi Qiang Li - Mpu Se,

I am following the same patches.

 

The M4 MCU stopped here (GETCHAR), I unable to provide the input

 

//qiang_debug add start
        PRINTF("Got ping...\r\n");

        while (1)
        {
             ch = GETCHAR();
             if(ch == 'c')
             break;
        }   

//qiang_debug add end

 

while (msg.DATA <= 100)
 {
       PRINTF("Waiting for ping...\r\n");
       rpmsg_queue_recv(my_rpmsg, my_queue, (unsigned long *)&remote_addr, (char *)&msg,  sizeof(THE_MESSAGE), NULL, RL_BLOCK);
       msg.DATA++;
     

//qiang_debug add start
        PRINTF("Got ping...\r\n");

        while (1)
        {
             ch = GETCHAR();
             if(ch == 'c')
             break;
        }   

//qiang_debug add end
        PRINTF("Sending pong...\r\n");
        rpmsg_lite_send(my_rpmsg, my_ept, remote_addr, (char *)&msg, sizeof(THE_MESSAGE), RL_BLOCK);
    }

4.14.98 BSP had added the hardware partition, so you can't run the 2.5.1 SDK code on it directly, I think you need run SDK2.5.2 code, after it works, then porting the related test code into it.

Hi,

I followed the Case 1,

Normally I able to send and receive the messages. But, after system suspend I unable to wake-up.

# cat ./sys/devices/platform/imx_rpmsg/90100000.rpmsg1/power/wakeup

enabled

# cat /proc/interrupts

105:         49          0          0          0          0          0     GICv3 217 Level     imx-mu-rpmsg

I applied the patches properly. in my Case rpmsg1 is used.

Linux Version: 4.14.98

OS: Android 9

Thanks & Regards,

Vinoth S,

Hi Qiang Li - Mpu Se

Will you please provide your Linux source (imx_rpmsg.c & required files) patch applied

Thanks,

Vinoth S,

Hi Qiang Li - Mpu Se,

I have power key. Is it possible to register power key wake-up (instead of press, hard coded in code) in Arm Cortex M4 code side ?

Thanks & Regards,

Vinoth S

Yes, use one pin as the wake up source is the best way, for example, if you assign this PIN to M4 partition, and call sc_pad_set_wakeup() to make it as a wake up source, then this PIN can be used to wake up M4; and if you assigned it to ACore partition, and set wake up source with sc_pad_set_wakeup(), then this PIN can wake up ACore.

Hi Qiang Li - Mpu Se

Thank you for the reply. If it possible will you please give some example code by using sc_pad_set_wakeup to wakeup ACore from M4.

Regards,

Vinoth S

In M4 side, you can just call BOARD_EnablePadWakeup(sc_pad_t pad, bool enable, sc_pad_wakeup_t pad_wakeup_config) to set the PIN wakeup.

Note, you should make sure that PIN is assigned to M4 partition.

Hi Qiang Li - Mpu Se

Thank you for the reply.

BOARD_EnablePadWakeup(sc_pad_t pad, bool enable, sc_pad_wakeup_t pad_wakeup_config) is only for IMX8QX and I am looking for IMX8QM

Thanks & Regards,

Vinoth S

The SCFW APIs are almost same, so you can copy it from 8QXP to 8QM.

Thank you Qiang Li - Mpu Se

I will check

Thanks,

Vinoth S,

any help regarding my previous question about iMX8MM is appreciated. Also is pathc L4.14.78_rpmsg_wakeup.patch needed for 5.4.24 kernel? 

Hi Siva Prabhakara ,

iMX8MM is different with iMX8QXP, there is SCU in iMX8QXP which will manage all wakeup event, but iMX8MM hasn't it.

But I think the wakeup source is same, if you enable the MU wakeup interrupt before Linux goto suspend mode, then M4 can use this interrupt to wake up A Core.

Qiang_FSL Thanks for the info, could you please provide some details to enable the MU interrupt since SCU isn't available and the patch may not be applicable too, right?

Hi Siva Prabhakara,

I think you still can apply the patch except the modification in file "arch/arm64/boot/dts/freescale/fsl-imx8qxp-mek.dts". The RPMSG driver is same for iMX8MM and iMX8QXP.

But for M4 side, I have no code to generate MU interrupt for iMX8MM. You need implement it by yourself.

actually, i am currently on 5.4.24 kernel. The driver looks very different, i dont see the MU ISR codes there. Do you have any update about this kernel?

Version history
Revision #:
1 of 1
Last update:
‎04-08-2019 02:21 AM
Updated by: