File tree Expand file tree Collapse file tree 2 files changed +30
-3
lines changed
libraries/mbed/targets/hal/TARGET_STM/TARGET_MOTE_L152RC Expand file tree Collapse file tree 2 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -86,8 +86,9 @@ void rtc_init(void)
86
86
__HAL_RCC_RTC_ENABLE ();
87
87
88
88
RtcHandle .Init .HourFormat = RTC_HOURFORMAT_24 ;
89
- RtcHandle .Init .AsynchPrediv = 127 ;
90
- RtcHandle .Init .SynchPrediv = (rtc_freq / 128 ) - 1 ;
89
+ /* SubSecond resolution of 16384Hz */
90
+ RtcHandle .Init .AsynchPrediv = /*127*/ 1 ;
91
+ RtcHandle .Init .SynchPrediv = (rtc_freq / /*128*/ 2 ) - 1 ;
91
92
RtcHandle .Init .OutPut = RTC_OUTPUT_DISABLE ;
92
93
RtcHandle .Init .OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH ;
93
94
RtcHandle .Init .OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN ;
Original file line number Diff line number Diff line change @@ -50,12 +50,38 @@ void sleep(void)
50
50
51
51
void deepsleep (void )
52
52
{
53
+ uint8_t STOPEntry = PWR_STOPENTRY_WFI ; /* PWR_STOPENTRY_WFE */
54
+
53
55
// Disable HAL tick interrupt
54
56
TimMasterHandle .Instance = TIM5 ;
55
57
__HAL_TIM_DISABLE_IT (& TimMasterHandle , TIM_IT_CC2 );
56
58
57
59
// Request to enter STOP mode with regulator in low power mode
58
- HAL_PWR_EnterSTOPMode (PWR_LOWPOWERREGULATOR_ON , PWR_STOPENTRY_WFI );
60
+ //HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
61
+ /* Select the regulator state in Stop mode: Set PDDS and LPSDSR bit according to PWR_Regulator value */
62
+ MODIFY_REG (PWR -> CR , (PWR_CR_PDDS | PWR_CR_LPSDSR ), PWR_LOWPOWERREGULATOR_ON );
63
+
64
+ /* Set SLEEPDEEP bit of Cortex System Control Register */
65
+ SET_BIT (SCB -> SCR , ((uint32_t )SCB_SCR_SLEEPDEEP_Msk ));
66
+
67
+ /* Select Stop mode entry --------------------------------------------------*/
68
+ if (STOPEntry == PWR_STOPENTRY_WFI )
69
+ {
70
+ /* Request Wait For Interrupt */
71
+ __WFI ();
72
+ }
73
+ else
74
+ {
75
+ /* Request Wait For Event */
76
+ __SEV ();
77
+ __WFE ();
78
+ __WFE ();
79
+ }
80
+ __NOP ();
81
+ __NOP ();
82
+ __NOP ();
83
+ /* Reset SLEEPDEEP bit of Cortex System Control Register */
84
+ CLEAR_BIT (SCB -> SCR , ((uint32_t )SCB_SCR_SLEEPDEEP_Msk ));
59
85
60
86
// After wake-up from STOP reconfigure the PLL
61
87
SetSysClock ();
You can’t perform that action at this time.
0 commit comments