よくある質問

常見問答

如何使用 Software Reset 或 CPU reset,得到比硬體重置更短的復位時間?  日期:2021-09-01

Nuvoton 的 8051 系列 MCU 備有 Software Reset 功能,其復位所需時間可比其他硬體重置方式更短。

使用者可設置 SWRST 位元 (CHPCON.7)  來執行 Software Reset 功能,範例程式如下:

TA = 0xAA; TA = 0x55;          //enable Time Access Protection (TA)

CHPCON = 0x80;                     //write 1 to SWRST to trigger a Software Reset

/* Trap the CPU */

while(1); 

使用者可以透過 SWRF 位元 (AUXR0.7) 確認 Software Reset 是否為上一次的復位來源。

 

而在 Nuvoton 的 M0/M23/M4 系列 MCU 則稱為 CPU Reset 功能。

使用者可設置 CPURST 位元 (SYS_IPRST0[1]) 來執行 CPU Reset 功能,其範例程式如下:

SYS_REGLCTL = 0x59; SYS_REGLCTL = 0x16; SYS_REGLCTL = 0x88;          //enable Register Lock Control

SYS_IPRST0 = 0x02;                                                                                                    //write 1 to CPURST to trigger a CPU Reset

/* Trap the CPU */

while(1); 

使用者可透過 System Reset Status 暫存器 (SYS_RSTSTS) 確認上一次的復位來源。
舉例來說,若上一次的復位來源為 CPU Reset,則 CPU Reset Flag,也就是 CPURF (SYS_RSTSTS[7]) 將會被設為 1。

 

以 MS51 當主控為例,硬體復位需要做 RC 充電約耗費 50 毫秒,而從 SWRST 的設置到下一次的 Main 入口約需 800 微秒,此即為 Software Reset 復位時間。

產品: 微控制器 ,8 位元 8051 微控制器 ,Arm Cortex-M0 微控制器 ,Arm Cortex-M23 微控制器 ,Arm Cortex-M4 微控制器
應用:
功能: Peripherals,System Operation,Reset,Software and Tools,Development-Environment,IAR,Keil
This website uses cookies to ensure you get the best experience on our website. Learn more