-
Notifications
You must be signed in to change notification settings - Fork 3k
Sleep: Disallow sleep for targets turning off the systick clock at sleep entry #5086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ep entry. When the RTOS is present and the tickless mode is not implemented, it is expected that the next tick issued by the Systick timer will wake up the MCU. However nothing prevents an implementation of the ARM architecture to gate the systick clock signal upon sleep entry. Therefore on those targets sleep shall be prohibited if the RTOS is present and the tickless mode is not implemented. To ease life of porters , a new option has been added in the device add list: STCLK_OF_DURING_SLEEP. This option expose that the target turn of the systick clock during sleep. Targets which exhibit such behavior shall add this define in their device_has list.
targets/targets.json
Outdated
"release_versions": ["2", "5"], | ||
"device_name": "nRF52832_xxAA" | ||
}, | ||
"DELTA_DFBM_NQ620": { | ||
"supported_form_factors": ["ARDUINO"], | ||
"inherits": ["MCU_NRF52"], | ||
"macros_add": ["BOARD_PCA10040", "NRF52_PAN_12", "NRF52_PAN_15", "NRF52_PAN_58", "NRF52_PAN_55", "NRF52_PAN_54", "NRF52_PAN_31", "NRF52_PAN_30", "NRF52_PAN_51", "NRF52_PAN_36", "NRF52_PAN_53", "S132", "CONFIG_GPIO_AS_PINRESET", "BLE_STACK_SUPPORT_REQD", "SWI_DISABLE0", "NRF52_PAN_20", "NRF52_PAN_64", "NRF52_PAN_62", "NRF52_PAN_63"], | ||
"device_has": ["ANALOGIN", "I2C", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPI_ASYNCH", "SPISLAVE"], | ||
"device_has_had": ["ANALOGIN", "I2C", "I2C_ASYNCH", "INTERRUPTIN", "LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPI_ASYNCH", "SPISLAVE"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: add ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These targets in this change-set , they extend the parent right? If we do this, add, should we clean? I assume most of them are already defined as device_has in the parent ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at the diff the parent was not defining any device_has
. Now it has one which define STCLK_OFF_DURING_SLEEP
hence the use of device_has_add
in children,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed that one, then just typo :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you fix that type on 3065 line? or device_has_had
is correct?
@@ -123,7 +127,9 @@ __INLINE static void sleep(void) | |||
{ | |||
#if !(defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED)) | |||
#if DEVICE_SLEEP | |||
#if (MBED_CONF_RTOS_PRESENT == 0) || (DEVICE_STCLK_OFF_DURING_SLEEP == 0) || defined(MBED_TICKLESS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Should this be more descriptive
DEVICE_SYSTICKCLK.....
orDEVICE_SYSTCLK....
? If I did not read the above comment, I would be guessing what ST clk stands for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
STCLK is used in the ARM architecture manuals. I choose to stick with it in the sake of consistency but I can change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the target.json changes needed for the nrf52 since tickless is now turned on for this target with #4991?
@pan- could you comment? |
Replace `device_has_had` by `device_has_add`
I believe changes in target.json are still required even if the tickless mode is turned on on NRF52 targets because those targets stop the Systick clock during sleep and this information might be valuable latter. @theotherjimmy I've addressed Martin remarks on the typo in targets.json. |
@pan- I want to confirm that nRF52840 behaves similar to nRF52832 so It turn off clock for SysTick while is sleeping as well. |
@nvlsianpu I've updated the PR so NRF52840 behavior during sleep is taken into account. Do you think the tickless mode as defined for the NRF52832 would work on NRF52840 ? |
@pan- I think yes - it Should work out of the box. nRF52840 in many areas is just a nRF52832 on steroids :D |
@@ -82,7 +82,7 @@ def check_inherits(dict): | |||
"LOWPOWERTIMER", "PORTIN", "PORTINOUT", "PORTOUT", | |||
"PWMOUT", "RTC", "TRNG","SERIAL", "SERIAL_ASYNCH", | |||
"SERIAL_FC", "SLEEP", "SPI", "SPI_ASYNCH", "SPISLAVE", | |||
"STORAGE"] | |||
"STORAGE", "STCLK_OFF_DURING_SLEEP"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking at this again, is this a proper placement for this? Is it device_
? Wouldnt this be rather a targets config? MBED_CONF_TARGET_STCLK.....
- better place/definition for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a device characteristic not a config.
@0xc0170 What is gating this PR? |
/morph test-nightly |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
Build : SUCCESSBuild number : 26 Triggering tests/test mbed-os |
Will this be part of 5.6.3 ? |
Yes, it should be |
Build : ABORTEDBuild number : 61 |
This actually had passed nightly test, So build was aborted and marked the status as passed. |
Build : FAILUREBuild number : 130 |
Description
When the RTOS is present and the tickless mode is not implemented, it is
expected that the next tick issued by the Systick timer will wake up the MCU.
However nothing prevents an implementation of the ARM architecture to gate the
systick clock signal upon sleep entry.
Therefore on those targets sleep shall be prohibited if the RTOS is present and the
tickless mode is not implemented.
To ease life of porters , a new option has been added in the device add list:
STCLK_OF_DURING_SLEEP. This option expose that the target turn of the systick
clock during sleep.
Targets which exhibit such behavior shall add this define in their device_has list.
Status
READY
Migrations
Silicon vendor has to be informed of this change and add
STCLK_OF_DURING_SLEEP
to thedevice_has
list of their targets which turn of (or alter) the Systick clock at sleep entry.YES
Related issues
#4927 and #4893