File tree Expand file tree Collapse file tree 3 files changed +21
-15
lines changed
targets/TARGET_NUVOTON/TARGET_M480 Expand file tree Collapse file tree 3 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -392,10 +392,7 @@ void Reset_Handler_1(void)
392
392
{
393
393
/* Disable register write-protection function */
394
394
SYS_UnlockReg ();
395
-
396
- /* Disable Power-on Reset function */
397
- SYS_DISABLE_POR ();
398
-
395
+
399
396
/**
400
397
* NOTE 1: Some register accesses require unlock.
401
398
* NOTE 2: Because EBI (external SRAM) init is done in SystemInit(), SystemInit() must be called at the very start.
Original file line number Diff line number Diff line change @@ -72,29 +72,22 @@ void mbed_sdk_init(void)
72
72
/* Lock protected registers */
73
73
SYS_LockReg ();
74
74
75
- /* Get around h/w issue with reset from deep power-down mode
76
- *
77
- * When UART interrupt enabled and WDT reset from power-down mode, in the next
78
- * cycle, UART interrupt keeps breaking in and cannot block unless via NVIC. To
79
- * get around it, we make up a signal of wake-up from deep power-down mode in the
80
- * start of boot process on detecting WDT reset.
81
- */
75
+ /* Get around h/w limit with WDT reset from PD */
82
76
if (SYS_IS_WDT_RST ()) {
83
77
/* Re-unlock protected clock setting */
84
78
SYS_UnlockReg ();
85
79
86
80
/* Set up DPD power down mode */
87
81
CLK -> PMUSTS |= CLK_PMUSTS_CLRWK_Msk ;
88
- CLK -> PMUSTS |= CLK_PMUSTS_TMRWK_Msk ;
82
+ CLK -> PMUSTS |= CLK_PMUSTS_TMRWK_Msk ;
89
83
CLK_SetPowerDownMode (CLK_PMUCTL_PDMSEL_DPD );
90
84
91
- /* Set up PMU wakeup timer, wakeup interval must be WKTMRIS_256 25.6 ms at least */
92
85
CLK_SET_WKTMR_INTERVAL (CLK_PMUCTL_WKTMRIS_256 );
93
86
CLK_ENABLE_WKTMR ();
94
87
95
88
CLK_PowerDown ();
96
89
90
+ /* Lock protected registers */
97
91
SYS_LockReg ();
98
92
}
99
-
100
93
}
Original file line number Diff line number Diff line change @@ -39,6 +39,12 @@ reset_reason_t hal_reset_reason_get(void)
39
39
reset_reason_t reset_reason_cast ;
40
40
uint32_t reset_reason_count = 0 ;
41
41
42
+ /* Get around h/w limit with WDT reset from PD */
43
+ if (CLK -> PMUSTS & CLK_PMUSTS_TMRWK_Msk ) {
44
+ /* Per test, these reset reason flags will set with WKT reset. Clear them for this resolution. */
45
+ SYS_CLEAR_RST_SOURCE (SYS_RSTSTS_PINRF_Msk | SYS_RSTSTS_PORF_Msk );
46
+ }
47
+
42
48
if (SYS_IS_POR_RST ()) {
43
49
reset_reason_cast = RESET_REASON_POWER_ON ;
44
50
reset_reason_count ++ ;
@@ -49,7 +55,8 @@ reset_reason_t hal_reset_reason_get(void)
49
55
reset_reason_count ++ ;
50
56
}
51
57
52
- if (SYS_IS_WDT_RST ()) {
58
+ /* Get around h/w limit with WDT reset from PD */
59
+ if (SYS_IS_WDT_RST () || (CLK -> PMUSTS & CLK_PMUSTS_TMRWK_Msk )) {
53
60
reset_reason_cast = RESET_REASON_WATCHDOG ;
54
61
reset_reason_count ++ ;
55
62
}
@@ -103,6 +110,15 @@ uint32_t hal_reset_reason_get_raw(void)
103
110
void hal_reset_reason_clear (void )
104
111
{
105
112
SYS_CLEAR_RST_SOURCE (SYS -> RSTSTS );
113
+
114
+ /* Re-unlock protected clock setting */
115
+ SYS_UnlockReg ();
116
+
117
+ /* Get around h/w limit with WDT reset from PD */
118
+ CLK -> PMUSTS |= (CLK_PMUSTS_CLRWK_Msk | CLK_PMUSTS_TMRWK_Msk );
119
+
120
+ /* Lock protected registers */
121
+ SYS_LockReg ();
106
122
}
107
123
108
124
#endif
You can’t perform that action at this time.
0 commit comments