Hi,
I can wake Linux up using UART by enabling its wakeup capability:
$ echo enabled > /sys/class/tty/ttymxc0/power/wakeup
I have put Linux into sleep using the following command:
$ echo mem > /sys/power/state
then sending a character over UART when the Linux is in sleep to wake it up... This scenario works well.
I want to do the same with CAN, so I enable its wakeup capability:
$ echo enabled > /sys/class/net/can0/device/power/wakeup
Then put Linux into sleep. It shows that Linux goes into sleep, but it immediately wakes up. I want Linux to be woken up upon the reception of a frame over CAN, just like the UART scenario
Hardware: apalis imx6D ixora v1.2
OS: Linux 5.4.91-33088-g8c05b31a44c3
Question: What could be the problem? How can I do that?
Thanks in advance
Solved! Go to Solution.
I used NXP Linux kernel from https://source.codeaurora.org/external/imx/linux-imx and the problem fixed
$ git clone https://source.codeaurora.org/external/imx/linux-imx/
$ git checkout -b 4.19 remotes/origin/imx_4.19.35_1.1.0
$ make imx_v7_defconfig
$ make -j$(nproc) zImage
$ make imx6q-apalis-ixora-v1.1.dtb
$ make -j$(nproc) modules
Now I can put Linux into sleep and wake it up by sending a CAN frame to it:
Enable CAN wakeup feature:
$ cd /sys/devices/soc0/soc/2000000.aips-bus/2094000.flexcan/power
$ echo enabled > wakeup
Put Linux into sleep:
$ echo mem > /sys/power/state
Now, by using another board to send a CAN frame, I can wake up Linux
Hi Asghar
one can try below procedure:
Connect two boards CAN port.
On one board A,
Listen to CAN port.
Enable CAN wakeup:
find /sys -name "wakeup" | grep -i can
e.g.
find /sys -name "wakeup"|grep -i can
/sys/devices/platform/soc/30800000.aips-bus/30a10000.can/power/wakeup
Get all CAN wakeup control points and enable wakeup:
e.g.
echo enabled > /sys/devices/platform/soc/30800000.aips-bus/30a10000.can/power/wakeup
<enable remaining CAN ports too>
Suspend the board:
echo mem > /sys/power/state
On the other board, send data to CAN port.
Then board A will wake up.
Best regards
igor
I guess there might be some problem with driver
I tested two different Linux kernel versions available in Toradex Linux built with apalis_imx6_defconfig :
5.4: Linux goes to sleep and immediately wake up
4.9: Linux goes to sleep and does not wake up upon receiving a CAN frame
What kernel version do you use?
may be suggested to try with NXP Sabre SD reference boards.
>What kernel version do you use?
nxp supports only official linux releases from source.codeaurora.org/external/imx/linux-imx repository
https://source.codeaurora.org/external/imx/linux-imx/tree/?h=imx_5.4.70_2.3.0
Documentation
Best regards
igor
I used NXP Linux kernel from https://source.codeaurora.org/external/imx/linux-imx and the problem fixed
$ git clone https://source.codeaurora.org/external/imx/linux-imx/
$ git checkout -b 4.19 remotes/origin/imx_4.19.35_1.1.0
$ make imx_v7_defconfig
$ make -j$(nproc) zImage
$ make imx6q-apalis-ixora-v1.1.dtb
$ make -j$(nproc) modules
Now I can put Linux into sleep and wake it up by sending a CAN frame to it:
Enable CAN wakeup feature:
$ cd /sys/devices/soc0/soc/2000000.aips-bus/2094000.flexcan/power
$ echo enabled > wakeup
Put Linux into sleep:
$ echo mem > /sys/power/state
Now, by using another board to send a CAN frame, I can wake up Linux
It has the same result. Linux will go into sleep, BUT it immediately wakes up.
I expect that upon the reception of a CAN frame, It wakes up... But I see something else in practice
this may depend on used hardware, apalis boards are developed and supported
by third party toradex and issue may be posted on community
https://www.toradex.com/community
Best regards
igor