I am using the simple trx example in Simplicity studio v5 and i want to add sleep functionality.
Specifically i want the application to run for 3 seconds and then go to sleep (and this runs over and over again) .
I tried to use the example " Sleep without timer synchronization" (without Power Manager) in https://docs.silabs.com/rail/latest/group-sleep but CORE_ENTER_CRITICAL(), CORE_EXIT_CRITICAL(), CORE_EXIT_CRITICAL() are not defined.
So, how can i setup this sleep configuration and select energy mode (EM1/EM2/EM3/EM4) ?
I think the only appropriate energy mode for my application is EM2 because the timer wakes up the device and there are not external interrupts.
I moved this thread from the 32 bit MCU forum to the proprietary forum which is more relevant to your topic.
The routine like CORE_ENTER_CRITICAL/CORE_EXIT_CRITICAL/CORE_EXIT_CRITICAL was in file em_core.c/h.
Power Manager is definitely a Platform component, from this point of view it does not really matter that the customer started from Simple TRX (which is a RAIL example).
So, I'm moving the case back to the 32 bit MCU forum.
Could you please support the customer regarding Power Manager?
Here you said you are working on Simplicity Studio v5 (which use flex 126.96.36.199), in the meantime you are trying to rail sleep in flex version 2.10.
I started with the simple trx example in SS v5 and try to call API
I did not see the error ( you mentioned) showed up.
Could you upload the project which include all the change you have made. You can keep only the part that could reproduce the issue.
Thank you for answering.
Yes im using flex 3.1.1 and im trying to rail sleep in flex 2.10 because i couldn't find any latest documentation.
Im attaching the project.
First, it's recommended to use the power-manager component in the latest SDK 3.1.1. You can find more info about it in https://docs.silabs.com/gecko-platform/latest/service/power_manager/overview
In the sample SimpleTrx, you might need to make some changes to make it sleepy.
1. Please install the component "power manager" and "RAIL - Power manager sleep".
2. In the sample, by default the console is enabled. In this case, the device would only enter EM1 as USART won't work in EM2. If you don't care about the console, you can add the following statements in function app_init to allow the device to enter EM2.
3. In the sample, by default, it's in Rx state. If you want to enter sleep mode, you must let the device in idle mode.
I've attached an example. In the example, the device is sleeping by default. If you press button0, the device will wake up and send a packet out, then fall asleep again.
@Jim Lin Thank you very much. If i understand it correctly, you comment the section where it starts the receiver in app_init(), so the device starts
in idle. When a button-press event occurs then the transmitter is enabled and begins to transmit the packet. When the transmission is finished,
the device goes to the S_PACKET_SENT state of the fsm, where the device goes to idle with your modification. So every time the program exits the app_process()
and the device is in idle, the power manager would take care of going the device into sleep.
The fact is that the S_IDLE state is the initial state of the fsm and not the idle mode of the device. Am I right ?
Your answer was very useful.