简体   繁体   English

STM32F0发现TIM1_CC_IRQHandler问题

[英]STM32F0Discovery TIM1_CC_IRQHandler issue

I am currently trying to debug my project and am having a small issue. 我目前正在尝试调试我的项目,并且遇到了一个小问题。 We are running the debugger using Ride7 with an RLink connected to our board on the SWD pins. 我们正在使用Ride7运行调试器,并在SWD引脚上将RLink连接到我们的板上。 When we run the code we get stuck at one point where the device gets stuck at one point. 当我们运行代码时,我们只能停留在一点,而设备只能停留在一点。 We paused it and found that the program counter is point to TIM1_CC_IRQHandler. 我们将其暂停,发现程序计数器指向TIM1_CC_IRQHandler。 We interpreted this as a flag for timer1's capture compare. 我们将其解释为timer1的捕获比较的标志。 However, we are not even using capture compare mode. 但是,我们甚至没有使用捕获比较模式。 We never even initialize timer 1. What is the microcontroller trying to do and how can we get past it? 我们甚至从未初始化计时器1。微控制器试图做什么?如何克服它?

We have tried stepping through the program and cannot follow the PC to the point where it gets stuck. 我们尝试逐步执行该程序,但无法跟上PC进入停滞状态。 We have run it, it passes through our main while loop, but on the second pass it gets lost. 我们已经运行了它,它通过了我们的主while循环,但是在第二遍时,它丢失了。 We then reset it and found that the PC is pointing to RESET_HANDLER. 然后,我们将其重置,发现PC指向RESET_HANDLER。 This happens in the printf() call; 这发生在printf()调用中; I don't know what it is trying to do. 我不知道它要做什么。

Code if it helps: 代码是否有帮助:

#include <stdio.h>
#include "device_initialization.h"



void main(void)
{
    uint32_t time = 0;
    //initTIM();
    //initADC();
    USART_Config();
    initGPIO();

    while(1)
    {
        time++;
        printf("\n\rUSART Printf Example: retarget the C library printf function to the USART\n\r");

        /* Loop until the end of transmission */
        /* The software must wait until TC=1. The TC flag remains cleared during all data
        transfers and it is set by hardware at the last frame’s end of transmission*/
        while (USART_GetFlagStatus(EVAL_COM1, USART_FLAG_TC) == RESET)
        {
        }
        while(time<1000000)
            {
            time++;  
            }
    }

}

Using printf() in microcontroller is new for me. 在微控制器中使用printf()对我来说是新的。 I think you should get a compile or a linker error. 我认为您应该得到一个编译或链接器错误。 I see a commented row //initTIM(); 我看到注释行//initTIM(); so I recommend to checking timer init methods (NVIC structure settings). 因此,我建议您检查计时器初始化方法(NVIC结构设置)。

The delay while cycle runs only at once. 循环延迟仅一次运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM