This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] TM4C123AE6PM:SysTick 中断未触发。

Guru**** 2430620 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1545453/tm4c123ae6pm-systick-interrupt-not-firing

器件型号:TM4C123AE6PM


工具/软件:

以下是我的初始化代码:

  SysTickIntRegister (SysTickISR);
  SysTickPeriodSet (8000000/100);  //每 10ms 中断一次。 (将 NS 转换为 MS)、保持(系统在 80MHz 下运行)
  SysTickIntEnable();         //与 tick.h 中的 tick_time_ms 同步
  SysTickEnable();

  IntMasterEnable();      //主器件使能中断。

SysTickISR() 永远不会被调用。

谢谢、

Doug

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我也没有在 UART 上获得中断、如果轮询、该 UART 可正常工作。  我从 TM4C129xxx 复制了工作代码、在 TM4C123xxx 中是否需要执行其他操作?  使用 TivaWare 库。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    如果两个系列之间确实没有差异、我可能会因之前的过流而损坏 CPU。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Doug:

     您能否先在 LaunchPad 上尝试以下 SysTick 示例、然后再尝试定制电路板? 如果它在 LaunchPad 上工作、但在定制电路板上无法正常工作、则表明电路板存在问题。 如果有另一个定制板、则可以再次尝试相同的代码。 结果是什么?

    //*****************************************************************************
    //
    // Counter to count the number of interrupts that have been called.
    //
    //*****************************************************************************
    volatile uint32_t g_ui32Counter = 0;
    
    //*****************************************************************************
    //
    // This function sets up UART0 to be used for a console to display information
    // as the example is running.
    //
    //*****************************************************************************
    void
    InitConsole(void)
    {
        //
        // Enable GPIO port A which is used for UART0 pins.
        // TODO: change this to whichever GPIO port you are using.
        //
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    
        //
        // Configure the pin muxing for UART0 functions on port A0 and A1.
        // This step is not necessary if your part does not support pin muxing.
        // TODO: change this to select the port/pin you are using.
        //
        GPIOPinConfigure(GPIO_PA0_U0RX);
        GPIOPinConfigure(GPIO_PA1_U0TX);
    
        //
        // Enable UART0 so that we can configure the clock.
        //
        SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    
        //
        // Use the internal 16MHz oscillator as the UART clock source.
        //
        UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);
    
        //
        // Select the alternate (UART) function for these pins.
        // TODO: change this to select the port/pin you are using.
        //
        GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    
        //
        // Initialize the UART for console I/O.
        //
        UARTStdioConfig(0, 115200, 16000000);
    }
    
    //*****************************************************************************
    //
    // The interrupt handler for the for Systick interrupt.
    //
    //*****************************************************************************
    void
    SysTickIntHandler(void)
    {
        //
        // Update the Systick interrupt counter.
        //
        g_ui32Counter++;
    }
    
    uint32_t i=0;
    
    //*****************************************************************************
    //
    // Configure the SysTick and SysTick interrupt with a period of 1 second.
    //
    //*****************************************************************************
    int
    main(void)
    {
    #if defined(TARGET_IS_TM4C129_RA0) ||                                         \
        defined(TARGET_IS_TM4C129_RA1) ||                                         \
        defined(TARGET_IS_TM4C129_RA2)
        uint32_t ui32SysClock;
    #endif
    
        uint32_t ui32PrevCount = 0;
    
        //
        // Set the clocking to run directly from the external crystal/oscillator.
        // TODO: The SYSCTL_XTAL_ value must be changed to match the value of the
        // crystal on your board.
        //
    #if defined(TARGET_IS_TM4C129_RA0) ||                                         \
        defined(TARGET_IS_TM4C129_RA1) ||                                         \
        defined(TARGET_IS_TM4C129_RA2)
        ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                           SYSCTL_OSC_MAIN |
                                           SYSCTL_USE_OSC), 25000000);
    #else
        //SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
        //               SYSCTL_XTAL_16MHZ);
        SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
    
    #endif
    
        //
        // Set up the serial console to use for displaying messages.  This is
        // just for this example program and is not needed for Systick operation.
        //
        InitConsole();
    
        //
        // Display the setup on the console.
        //
        UARTprintf("SysTick Firing Interrupt ->");
        UARTprintf("\n   Rate = 1sec\n\n");
    
        //
        // Initialize the interrupt counter.
        //
        g_ui32Counter = 0;
    
        i = SysCtlClockGet();
    
        //
        // Set up the period for the SysTick timer.  The SysTick timer period will
        // be equal to the system clock, resulting in a period of 1 second.
        //
    #if defined(TARGET_IS_TM4C129_RA0) ||                                         \
        defined(TARGET_IS_TM4C129_RA1) ||                                         \
        defined(TARGET_IS_TM4C129_RA2)
        SysTickPeriodSet(ui32SysClock);
    #else
        SysTickPeriodSet(SysCtlClockGet());
    #endif
    
        //
        // Enable interrupts to the processor.
        //
        IntMasterEnable();
    
        //
        // Enable the SysTick Interrupt.
        //
        SysTickIntEnable();
    
        //
        // Enable SysTick.
        //
        SysTickEnable();
    
        //
        // Loop forever while the SysTick runs.
        //
        while(1)
        {
            //
            // Check to see if systick interrupt count changed, and if so then
            // print a message with the count.
            //
            if(ui32PrevCount != g_ui32Counter)
            {
                //
                // Print the interrupt counter.
                //
                UARTprintf("Number of interrupts: %d\r", g_ui32Counter);
                ui32PrevCount = g_ui32Counter;
            }
        }
    }

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Charles:

    我的假设是正确的、我更换了两个 CPU、现在中断工作正常。

    谢谢、Doug