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.

EK-TM4C1294XL: TivaWare_C_Series Example (enet_tcpecho_server) doesn't work with TIMER0

Part Number: EK-TM4C1294XL

I compiled one of the TivaWare_C_Series-2.2.0.295 board examples for the EK-TM4C1294XL board.  The example is: enet_tcpecho_server.  It works fine as a server but when I try to add code to use TIMER0 I am not able to use the TivaWare example code found in the timers folder.  The enet_tcp_server application works fine when I lower the priority of the TIMER0 interrupt to 0xE0 but then I never hit a breakpoint the TIMER0 ISR.  I am configuring TIMER0 to run at 400Hz.

Is there anything special about using lwIP and TIMER0?

Thanks for all your help.

Jorge

  • Hi,

    The enet_tcp_server application works fine when I lower the priority of the TIMER0 interrupt to 0xE0 but then I never hit a breakpoint the TIMER0 ISR.

      If you lower the priority for TIMER0 then SysTick and Ethernet interrupts will preempt Timer0 interrupt as they have higher priority. 

    //*****************************************************************************
    //
    // Defines for setting up the system clock.
    //
    //*****************************************************************************
    #define SYSTICKHZ 100
    #define SYSTICKMS (1000 / SYSTICKHZ)

    //*****************************************************************************
    //
    // Interrupt priority definitions. The top 3 bits of these values are
    // significant with lower values indicating higher priority interrupts.
    //
    //*****************************************************************************
    #define SYSTICK_INT_PRIORITY 0x80
    #define ETHERNET_INT_PRIORITY 0xC0

  • Thanks for your response Charles.  My problem is that I can only get the Systick and Ethernet interrupts to work when I set the priority of TIMER0 to 0xE0 but then TIMER0 does't generate an interrupt since I never hit the breakpoint I placed in the TIMER0 interrupt service routine.

    How can I get any timer to work with the Systick and Ethernet interrupts?

  • Hi,

      - if you set TIMER0 higher priority than systick and Ethernet then does TIMER0 work?

      - How do you know TIMER0 is not working after you set the priority to 0xE0? Can you do an experiment? In the TIMER0 ISR, can you toggle some GPIO and don't place the breakpoint in the ISR.  Do you see the GPIO toggles?

  • Charles,

    Even when the TIMER0 is at a higher priority than systick and Ethernet, TIMER0 doesn't work.  In my application, the purpose of TIMER0 is to toggle a GPIO to generate a 200 Hz signal, so I was running it with and without the breakpoint and never saw activity on the GPIO line.

    I also noticed that my program was hitting the IntDefaultHandler() which happens when the processor receives an unexpected interrupt.  Is it possible that I am  enabling interrups I have no ISR for?

    Right now, my quickest solution is to either add ethernet code to the timer project and see if it works or add the timer code to the ethernet project.  I chose to add the timer code to the ethernet project since I was running into "undefined references errors" and it seemed like maybe I had to link an extra library to the timer project and since I did not know how to do that I chose the path of least resistance.

    Do you have an example anywhere of an ethernet echo server that uses timers where I could toggle a GPIO line?

    Thanks for all your help.

    Jorge

  • Charles,

    My problem ended up being that since I had started with the ethernet echo server project, the ISR for TIMER0 in the interrupt vector table was the IntDefaultHandler().  Once I set the correct name on the table and included the function prototype the TIMER0 interrupt now works.

    Thanks for all your help.

    Jorge