[STM32F1] cannot access target

[复制链接]
 楼主| Cjy_JDxy 发表于 2017-8-21 13:27 | 显示全部楼层 |阅读模式
我用STLINK调试STM32程序,点击DEBUG,运行以后,出现以下提示。
3.jpg

请问高手,如何解决?谢谢


戈卫东 发表于 2017-8-21 13:32 | 显示全部楼层
重新买个仿真器试试?
 楼主| Cjy_JDxy 发表于 2017-8-21 13:40 | 显示全部楼层
戈卫东 发表于 2017-8-21 13:32
重新买个仿真器试试?

你是说仿真器出问题了吗?
 楼主| Cjy_JDxy 发表于 2017-8-21 13:43 | 显示全部楼层
换了一个,还是不行。
 楼主| Cjy_JDxy 发表于 2017-8-21 13:55 | 显示全部楼层
单步调试,发现
/*----进入停止模式等待RTC的自动唤醒----*/
                               
                                        PWR_EnterSTOPMode(PWR_Regulator_LowPower , PWR_STOPEntry_WFI);

执行到这句出现那个对话框。
 楼主| Cjy_JDxy 发表于 2017-8-21 14:11 | 显示全部楼层
void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry)
{
  uint32_t tmpreg = 0;
  /* Check the parameters */
  assert_param(IS_PWR_REGULATOR(PWR_Regulator));
  assert_param(IS_PWR_STOP_ENTRY(PWR_STOPEntry));

  /* Select the regulator state in STOP mode ---------------------------------*/
  tmpreg = PWR->CR;
  /* Clear PDDS and LPDS bits */
  tmpreg &= CR_DS_MASK;
  /* Set LPDS bit according to PWR_Regulator value */
  tmpreg |= PWR_Regulator;
  /* Store the new value */
  PWR->CR = tmpreg;
  /* Set SLEEPDEEP bit of Cortex System Control Register */
  SCB->SCR |= SCB_SCR_SLEEPDEEP;

  /* Select STOP mode entry --------------------------------------------------*/
  if(PWR_STOPEntry == PWR_STOPEntry_WFI)
  {   
    /* Request Wait For Interrupt */
    __WFI();
  }
  else
  {
    /* Request Wait For Event */
    __WFE();
  }

  /* Reset SLEEPDEEP bit of Cortex System Control Register */
  SCB->SCR &= (uint32_t)~((uint32_t)SCB_SCR_SLEEPDEEP);  
}
上面这段程序也不知道有什么问题,单步执行可以,一全速运行就出那个对话框。

戈卫东 发表于 2017-8-21 14:12 | 显示全部楼层
那是正常的。
进入Stop,所有时钟都停掉了,Debugger也会断掉。
 楼主| Cjy_JDxy 发表于 2017-8-21 15:26 | 显示全部楼层
戈卫东 发表于 2017-8-21 14:12
那是正常的。
进入Stop,所有时钟都停掉了,Debugger也会断掉。

谢谢,我明白了。
mmuuss586 发表于 2017-8-21 16:31 | 显示全部楼层

明白了就好
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:绿水本无忧因风皱面,青山原不老为雪白头。

553

主题

3530

帖子

20

粉丝
快速回复 在线客服 返回列表 返回顶部