Timer + ISR hangs M4

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
TeMa_1467596
Level 5
Level 5
5 sign-ins 5 likes given First like received

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

0 Likes
1 Solution
ShipingW_81
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 replies posted

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.

View solution in original post

0 Likes
3 Replies
ShipingW_81
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 replies posted

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.

0 Likes

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

Bob

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?

0 Likes