3 Replies Latest reply on Jul 26, 2018 6:03 AM by TeMa_1467596

    Timer + ISR hangs M4

    TeMa_1467596

      I created a project for the CY8CKIT-062-BLE evaluation board.  I want to get a timer running that generates interrupts at 43.2 kHz on the M4 core.  The attached project has a simple main for loop that flashes the Red LED at 1 Hz but it hangs (the red LED does not blink so it's maybe stuck in the ISR) when I run it - the M0+ is running just fine.

       

      I tried to debug but the debugger crashed.

       

      Project attached

       

      Can anyone see what's wrong?

       

      Ted

        • 1. Re: Timer + ISR hangs M4
          ShipingW_81

          Ted,

          It is just because you do not clear current active interrupt in timer ISR. Please add below line at beginning of Timer1_Isr():

          Cy_TCPWM_ClearInterrupt(Timer1_HW, Timer1_CNT_NUM,CY_TCPWM_INT_ON_TC);

           

          In addition, the indicating LED used in Timer1_Isr() is not hard-wired on 062-kit board, you can use RED_LED (p0_3) instead;

          SMIF function reports building error, so you need configure the SMIF with referring SMIF code example or using SMIF configuration tool.

          • 2. Re: Timer + ISR hangs M4
            JoMe_264151

            I could not find a reference to Cy_TCPWM_ClearInterrupt() API in the PDL description for TCPWM. What am I missing?

             

            Bob

            1 of 1 people found this helpful
            • 3. Re: Timer + ISR hangs M4
              TeMa_1467596

              Thanks so much - that was the issue, I was forgetting that it was Timer1 that was causing the interrupt and I needed to clear the Timer1 interrupt flag or I'd be stuck in the ISR forever - one thing that was throwing me was that I didn't see P7.7 going high but that was because it isn't connected on the eval PCB.

               

              As you can see, I haven't got into setting up the SMIF yet but I have tested another project that runs SMIF on the same pins to talk to the on-board flash memory chip and it seems to work fine (I get no compile errors).

               

              I have designed and am making up, a PCB that the CY8CKIT-062-BLE board plugs into and P7.7 is wired to drive an LED on that external PCB - now I see that you're right that my signal doesn't actually come out of J18 pin 1 as R87 isn't populated on the 062-BLE board - given I don't want to use the CAPSENSE stuff I will populate R87 and move on but where is the documentation that tells me what other pins are not connected on the headers?