搜索
bottom↓
回复: 2

stm32f030单片机的定时器,调试时无法暂停,如何处理?

[复制链接]

出0入0汤圆

发表于 2019-4-22 17:04:37 | 显示全部楼层 |阅读模式
stm32f030单片机的定时器,调试时无法暂停,如何处理?

查了下资料,可以通过芯片复位状态下 写DBGMCU->APB1FZ 寄存器实现。
但是实际中如何操作未知。

库函数存在 DBGMCU_APB1PeriphConfig() 函数,程序运行时调用不起作用。



/**
  * @brief  Configures APB1 peripheral behavior when the MCU is in Debug mode.
  * @param  DBGMCU_Periph: specifies the APB1 peripheral.
  *          This parameter can be any combination of the following values:
  *             @arg DBGMCU_TIM2_STOP: TIM2 counter stopped when Core is halted,
  *                  not applicable for STM32F030 devices
  *             @arg DBGMCU_TIM3_STOP: TIM3 counter stopped when Core is halted
  *             @arg DBGMCU_TIM6_STOP: TIM6 counter stopped when Core is halted
  *             @arg DBGMCU_TIM7_STOP: TIM7 counter stopped when Core is halted,
  *                  applicable only for STM32F072 devices
  *             @arg DBGMCU_TIM14_STOP: TIM14 counter stopped when Core is halted
  *             @arg DBGMCU_RTC_STOP: RTC Calendar and Wakeup counter stopped
  *                                   when Core is halted.
  *             @arg DBGMCU_WWDG_STOP: Debug WWDG stopped when Core is halted
  *             @arg DBGMCU_IWDG_STOP: Debug IWDG stopped when Core is halted
  *             @arg DBGMCU_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped
  *                                             when Core is halted
  *             @arg DBGMCU_CAN1_STOP: Debug CAN1 stopped when Core is halted,
  *                  applicable only for STM32F042 and STM32F072 devices
  * @param  NewState: new state of the specified APB1 peripheral in Debug mode.
  *          This parameter can be: ENABLE or DISABLE.
  * @retval None
  */
void DBGMCU_APB1PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_DBGMCU_APB1PERIPH(DBGMCU_Periph));
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  if (NewState != DISABLE)
  {
    DBGMCU->APB1FZ |= DBGMCU_Periph;
  }
  else
  {
    DBGMCU->APB1FZ &= ~DBGMCU_Periph;
  }
}

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

出0入0汤圆

发表于 2019-4-22 17:04:38 | 显示全部楼层
RCC_APB2PeriphClockCmd(RCC_APB2Periph_DBGMCU, ENABLE)

出0入0汤圆

 楼主| 发表于 2019-4-24 09:06:18 | 显示全部楼层
huaxiling 发表于 2019-4-22 17:04
RCC_APB2PeriphClockCmd(RCC_APB2Periph_DBGMCU, ENABLE)

搞定,多谢
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-4-20 09:30

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表