Skip to content
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

STM32 LPTICKER : RTC wake up timer is reset before setting a new one #7790

Merged
merged 3 commits into from Aug 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions targets/TARGET_STM/lp_ticker.c
Expand Up @@ -263,6 +263,7 @@ uint32_t lp_ticker_read(void)

void lp_ticker_set_interrupt(timestamp_t timestamp)
{
lp_ticker_disable_interrupt();
rtc_set_wake_up_timer(timestamp);
}

Expand Down
2 changes: 1 addition & 1 deletion targets/TARGET_STM/rtc_api.c
Expand Up @@ -270,7 +270,7 @@ void rtc_write(time_t t)

#if DEVICE_LPTICKER && !MBED_CONF_TARGET_LPTICKER_LPTIM
/* Need to update LP_continuous_time value before new RTC time */
uint32_t current_lp_time = rtc_read_lp();
rtc_read_lp();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be nice to (void) the return of this function to show that you are purposefully ignoring the return value ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this very specific case, we don't need to get the return value.
Function is called because global variable LP_continuous_time is updated there.


/* LP_last_RTC_time value is updated with the new RTC time */
LP_last_RTC_time = timeStruct.Seconds + timeStruct.Minutes * 60 + timeStruct.Hours * 60 * 60;
Expand Down
142 changes: 136 additions & 6 deletions targets/targets.json
Expand Up @@ -724,7 +724,7 @@
"public": false,
"extra_labels": ["STM"],
"supported_toolchains": ["ARM", "uARM", "IAR", "GCC_ARM"],
"macros": ["TRANSACTION_QUEUE_SIZE_SPI=2", "LPTICKER_DELAY_TICKS=3"],
"macros": ["TRANSACTION_QUEUE_SIZE_SPI=2"],
"config": {
"lse_available": {
"help": "Define if a Low Speed External xtal (LSE) is available on the board (0 = No, 1 = Yes). If Yes, the LSE will be used to clock the RTC, LPUART, ... otherwise the Low Speed Internal clock (LSI) will be used",
Expand Down Expand Up @@ -868,6 +868,11 @@
"help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI",
"value": "USE_PLL_HSE_EXTC|USE_PLL_HSI",
"macro_name": "CLOCK_SOURCE"
},
"lpticker_delay_ticks": {
"help": "For targets with low frequency system clock, set lpticker_delay_ticks value to 1",
"value": 1,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0755"],
Expand All @@ -886,6 +891,11 @@
"help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI",
"value": "USE_PLL_HSE_EXTC|USE_PLL_HSI",
"macro_name": "CLOCK_SOURCE"
},
"lpticker_delay_ticks": {
"help": "For targets with low frequency system clock, set lpticker_delay_ticks value to 1",
"value": 1,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0730"],
Expand All @@ -904,6 +914,11 @@
"help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI",
"value": "USE_PLL_HSE_EXTC|USE_PLL_HSI",
"macro_name": "CLOCK_SOURCE"
},
"lpticker_delay_ticks": {
"help": "For targets with low frequency system clock, set lpticker_delay_ticks value to 1",
"value": 1,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0750"],
Expand Down Expand Up @@ -1100,6 +1115,11 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0744"],
Expand Down Expand Up @@ -1224,6 +1244,11 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0743"],
Expand All @@ -1246,6 +1271,11 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0743"],
Expand Down Expand Up @@ -1396,12 +1426,17 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"macros_add": ["USBHOST_OTHER"],
"supported_form_factors": ["ARDUINO"],
"detect_code": ["0816"],
"device_has_add": ["LPTICKER", "ANALOGOUT", "CAN", "CRC", "EMAC", "SERIAL_ASYNCH", "TRNG", "FLASH"],
"device_has_add": ["ANALOGOUT", "CAN", "CRC", "EMAC", "SERIAL_ASYNCH", "TRNG", "FLASH"],
"release_versions": ["2", "5"],
"device_name": "STM32F746ZG",
"bootloader_supported": true,
Expand All @@ -1427,12 +1462,17 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"macros_add": ["TRANSACTION_QUEUE_SIZE_SPI=2", "USBHOST_OTHER", "MBEDTLS_CONFIG_HW_SUPPORT"],
"supported_form_factors": ["ARDUINO"],
"detect_code": ["0819"],
"device_has_add": ["LPTICKER", "ANALOGOUT", "CAN", "CRC", "EMAC", "SERIAL_ASYNCH", "TRNG", "FLASH"],
"device_has_add": ["ANALOGOUT", "CAN", "CRC", "EMAC", "SERIAL_ASYNCH", "TRNG", "FLASH"],
"release_versions": ["2", "5"],
"device_name": "STM32F756ZG",
"overrides": {
Expand Down Expand Up @@ -1461,12 +1501,17 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"supported_form_factors": ["ARDUINO"],
"macros_add": ["USBHOST_OTHER"],
"detect_code": ["0818"],
"device_has_add": ["LPTICKER", "ANALOGOUT", "CAN", "CRC", "EMAC", "SERIAL_ASYNCH", "TRNG", "FLASH"],
"device_has_add": ["ANALOGOUT", "CAN", "CRC", "EMAC", "SERIAL_ASYNCH", "TRNG", "FLASH"],
"release_versions": ["2", "5"],
"device_name": "STM32F767ZI",
"bootloader_supported": true,
Expand All @@ -1490,6 +1535,11 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0780"],
Expand All @@ -1513,6 +1563,11 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0790"],
Expand All @@ -1535,6 +1590,11 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0715"],
Expand All @@ -1557,6 +1617,11 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0760"],
Expand All @@ -1574,6 +1639,11 @@
"help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI",
"value": "USE_PLL_HSE_EXTC|USE_PLL_HSI",
"macro_name": "CLOCK_SOURCE"
},
"lpticker_delay_ticks": {
"help": "For targets with low frequency system clock, set lpticker_delay_ticks value to 1",
"value": 1,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0710"],
Expand All @@ -1595,6 +1665,11 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0770"],
Expand All @@ -1617,6 +1692,11 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0779"],
Expand Down Expand Up @@ -1660,6 +1740,11 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0765"],
Expand Down Expand Up @@ -1701,6 +1786,11 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0827"],
Expand Down Expand Up @@ -1908,6 +1998,11 @@
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1

},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"overrides": {"lse_available": 0},
Expand All @@ -1930,6 +2025,11 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0833"],
Expand Down Expand Up @@ -1965,11 +2065,16 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0815"],
"macros_add": ["USB_STM_HAL", "USBHOST_OTHER"],
"device_has_add": ["LPTICKER", "ANALOGOUT", "CAN", "EMAC", "SERIAL_ASYNCH", "TRNG", "FLASH"],
"device_has_add": ["ANALOGOUT", "CAN", "EMAC", "SERIAL_ASYNCH", "TRNG", "FLASH"],
"release_versions": ["2", "5"],
"device_name": "STM32F746NG",
"overrides": {
Expand All @@ -1994,11 +2099,16 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0817"],
"macros_add": ["USB_STM_HAL", "USBHOST_OTHER"],
"device_has_add": ["LPTICKER", "ANALOGOUT", "CAN", "EMAC", "SERIAL_ASYNCH", "TRNG", "FLASH"],
"device_has_add": ["ANALOGOUT", "CAN", "EMAC", "SERIAL_ASYNCH", "TRNG", "FLASH"],
"release_versions": ["2", "5"],
"device_name": "STM32F769NI",
"overrides": {
Expand All @@ -2018,6 +2128,11 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"supported_form_factors": ["ARDUINO"],
Expand All @@ -2041,6 +2156,11 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0820"],
Expand Down Expand Up @@ -4100,6 +4220,11 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0822"],
Expand All @@ -4121,6 +4246,11 @@
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
},
"lpticker_delay_ticks": {
"help": "In case of lpticker_lptim=1, set lpticker_delay_ticks=3",
"value": 3,
"macro_name": "LPTICKER_DELAY_TICKS"
}
},
"detect_code": ["0823"],
Expand Down