牛卧堂MCU技术交流
标题:
关于NUC123从LDROM切换到APROM启动问题
[打印本页]
作者:
sandou2013
时间:
2013-12-21 15:44
标题:
关于NUC123从LDROM切换到APROM启动问题
请大家指教一下,要做的是,当程序检测到USB没有插入,则从APROM中启动。下面这样写怎么跳不进去?
//======================================================
// USB Floating Detect
//======================================================
void UsbFdt(void)
{
uint8_t u8FLODET = USBD->FLDET.FLDET;
_DRVUSB_SET_EVF(EVF_FLD);
if (u8FLODET)
{
/* USB Plug In */
if (g_u8UsbState & USB_STATE_ATTACHED)
{
/* Do nothing if it is already attached */
return;
}
/* Update USB state */
g_u8UsbState = USB_STATE_ATTACHED;
/* Init the end points */
UsbCfg();
/* Enable USB and enable PHY */
_DRVUSB_ENABLE_USB();
}
else
{
/* USB Un-plug */
/* Update USB state */
g_u8UsbState = USB_STATE_DETACHED;
udcOnLine = 0;
/* Disable USB, Disable remote weak up, and disable PHY */
_DRVUSB_DISABLE_USB();
/* Boot from AP */
RoughDelay(0x200000);
RESET_TO_AP();//CPU复位,从AP启动,此函数放于主函数的最前面是有用的
while(1)
continue;
}
作者:
a_ziliu
时间:
2013-12-23 09:41
SYS_UnlockReg(); //en:Unlock protected register bits for user to access
outpw(&FMC->ISPCON, inpw(&FMC->ISPCON) & 0xFFFFFFFC); //boot in aprom
outpw(&SCB->AIRCR, (V6M_AIRCR_VECTKEY_DATA | V6M_AIRCR_SYSRESETREQ));//SYSRESETREQ
while(1);
欢迎光临 牛卧堂MCU技术交流 (http://nuvoton-mcu.com/)
Powered by Discuz! X3.2