打印
[STM32F1]

STM32F103的虚拟串口,不能枚举成功,一直跳转到void Suspend(void)中

[复制链接]
1341|1
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
z1234zz|  楼主 | 2014-10-11 14:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
问题STM32F103RC系列,使用虚拟串口时,一直跳转到
void Suspend(void)
{
        uint32_t i =0;
        uint16_t wCNTR;
        uint32_t tmpreg = 0;
  __IO uint32_t savePWR_CR=0;
        /* suspend preparation */
        /* ... */
       
        /*Store CNTR value */
        wCNTR = _GetCNTR();  

    /* This a sequence to apply a force RESET to handle a robustness case */
   
        /*Store endpoints registers status */
    for (i=0;i<8;i++) EP[i] = _GetENDPOINT(i);
       
        /* unmask RESET flag */
        wCNTR|=CNTR_RESETM;
        _SetCNTR(wCNTR);
       
        /*apply FRES */
        wCNTR|=CNTR_FRES;
        _SetCNTR(wCNTR);
       
        /*clear FRES*/
        wCNTR&=~CNTR_FRES;
        _SetCNTR(wCNTR);
       
        /*poll for RESET flag in ISTR*/
        while((_GetISTR()&ISTR_RESET) == 0);
       
        /* clear RESET flag in ISTR */
        _SetISTR((uint16_t)CLR_RESET);
       
        /*restore Enpoints*/
        for (i=0;i<8;i++)
        _SetENDPOINT(i, EP[i]);
       
        /* Now it is safe to enter macrocell in suspend mode */
        wCNTR |= CNTR_FSUSP;
        _SetCNTR(wCNTR);
       
        /* force low-power mode in the macrocell */
        wCNTR = _GetCNTR();
        wCNTR |= CNTR_LPMODE;
        _SetCNTR(wCNTR);
       
        /*prepare entry in low power mode (STOP mode)*/
        /* Select the regulator state in STOP mode*/
        savePWR_CR = PWR->CR;
        tmpreg = PWR->CR;
        /* Clear PDDS and LPDS bits */
        tmpreg &= ((uint32_t)0xFFFFFFFC);
        /* Set LPDS bit according to PWR_Regulator value */
        tmpreg |= PWR_Regulator_LowPower;
        /* Store the new value */
        PWR->CR = tmpreg;
        /* Set SLEEPDEEP bit of Cortex System Control Register */
#if defined (STM32F30X) || defined (STM32F37X)
        SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
#else
        SCB->SCR |= SCB_SCR_SLEEPDEEP;      
#endif
       
        /* enter system in STOP mode, only when wakeup flag in not set */
        if((_GetISTR()&ISTR_WKUP)==0)
        {
                __WFI();
                /* Reset SLEEPDEEP bit of Cortex System Control Register */
#if defined (STM32F30X) || defined (STM32F37X)
                SCB->SCR &= (uint32_t)~((uint32_t)SCB_SCR_SLEEPDEEP_Msk);
#else
                SCB->SCR &= (uint32_t)~((uint32_t)SCB_SCR_SLEEPDEEP);
#endif


我停止全速跑时,就会停止在
SCB->SCR &= (uint32_t)~((uint32_t)SCB_SCR_SLEEPDEEP); 这里,使用系统休眠了,我没有让系统休眠!!!谢谢,那位能帮助解决一下。
沙发
mmuuss586| | 2014-10-12 14:05 | 只看该作者
你程序没有用到休眠的话,把这几句注释掉看看;

顺便问下,USB部分硬件怎么连接的,截个图看看;
不要忘记加上拉;

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

5

主题

27

帖子

1

粉丝