简体   繁体   中英

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. 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. We interpreted this as a flag for timer1's capture compare. 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?

We have tried stepping through the program and cannot follow the PC to the point where it gets stuck. We have run it, it passes through our main while loop, but on the second pass it gets lost. We then reset it and found that the PC is pointing to RESET_HANDLER. This happens in the printf() call; 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. I think you should get a compile or a linker error. I see a commented row //initTIM(); so I recommend to checking timer init methods (NVIC structure settings).

The delay while cycle runs only at once.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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