本帖最后由 huhu2009 于 2010-5-13 19:28 编辑
[回香版]不debug也是这样,PC不提示发现新硬件。香版的意思是让我好好看看《UM0424 USB-FS-Device development kit》?
[回viqia]是while(1);呀,没有那一句,和4楼香版贴的代码几乎一样,只是多了几句,多一个if判断。有问题?
int main(void)
{
GPIO_Configuration();
if(!GPIO_ReadInputDataBit(GPIOA,USB_DET))
{
if (((*(vu32*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000)
{ /* Jump to user application */
JumpAddress = *(vu32*) (ApplicationAddress + 4);
Jump_To_Application = (pFunction) JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*) ApplicationAddress);
Jump_To_Application();
}
}
if (DFU_Button_Read() != 0x00)
{
if (((*(vu32*)USBMSC_AppAddress) & 0x2FFE0000 ) == 0x20000000)
{ /* Jump to USB MSC */
JumpAddress = *(vu32*) (USBMSC_AppAddress + 4);
Jump_To_Application = (pFunction) JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*) USBMSC_AppAddress);
Jump_To_Application();
}
}
/* Otherwise enters DFU mode to allow user to program his application */
/* Enter DFU mode */
DeviceState = STATE_dfuERROR;
DeviceStatus[0] = STATUS_ERRFIRMWARE;
DeviceStatus[4] = DeviceState;
Set_System();
LEDFillUSBCode(0);
Set_USBClock();
USB_Init();
/* Main loop */
while (1)
{}
}
|