我參考 USBD_Mass_Storage_Sram 的 Project 把 HID 的範例修改成 DMA mode 就不會動了. 
修改如下 
#if 0 是原先的 HID 使用 FIFO 部份 
#if 1 是參考 MSDC 使用 DMA 
求解啊 ~~~~ 
 
int32_t HID_CmdReadPages(CMD_T *pCmd) 
{ 
    uint32_t u32StartPage; 
    uint32_t u32Pages; 
    uint32_t len; 
    int32_t i; 
 
    u32StartPage = pCmd->u32Arg1; 
    u32Pages     = pCmd->u32Arg2; 
 
    printf("Read command - Start page: %d    Pages Numbers: %d\n", u32StartPage, u32Pages); 
 
    if(u32Pages) { 
        /* Update data to page buffer to upload */ 
        /* TODO: We need to update the page data if got a page read command. (0xFF is used in this sample code) */ 
        for(i=0; i<PAGE_SIZE; i++) 
            g_u8PageBuff[i] = 0xFF; 
        g_u32BytesInPageBuf = PAGE_SIZE; 
 
        /* The signature word is used as page counter */ 
        pCmd->u32Signature = 1; 
 
        /* Trigger HID IN */ 
        len = Minimum(g_u32EpAMaxPacketSize, g_u32BytesInPageBuf); 
 
#if 0 //FIFO mode 
        for (i=0; i<len; i++) 
            USBD->EPADAT_BYTE = g_u8PageBuff[i]; 
        USBD->EPATXCNT = len; 
        USBD_ENABLE_EP_INT(EPA, USBD_EPINTEN_INTKIEN_Msk); 
#endif                         
                         
#if 1 //DMA mode 
                                printf("DMA Begin\n"); 
                                USBD_SET_DMA_READ(INT_IN_EP_NUM); 
        USBD_ENABLE_EP_INT(EPA, USBD_EPINTEN_TXPKIEN_Msk); 
                                g_usbd_ShortPacket = 0; 
        while(1) { 
            if (USBD_GET_EP_INT_FLAG(EPA) & USBD_EPINTSTS_BUFEMPTYIF_Msk) { 
                MSC_ActiveDMA((uint32_t)g_u8PageBuff, PAGE_SIZE); 
                break; 
            } 
        } 
                                printf("DMA End\n"); 
#endif                         
        g_u32BytesInPageBuf -= len; 
    } 
 
    return 0; 
} 
 |