LPComp PSoC4 Interruption

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

cross mob
jota_1397291
Level 1
Level 1

Im using the LPComparator PSoC4 Example and i feed a Square wave on Vplus of 200Khz, the interruption seen to make the program crash but when its a signal of 20Khz the interuption seen too be running perfectly.

There is anyway to avoid crash of the PSOC4 when using higher frequency ?

0 Likes
1 Solution

Remember interrupts should be kept very, very short, such as updating a variable for the main loop to handle.

If you use the LED, maybe we can't recognize the blinking in high frequency.

View solution in original post

7 Replies
ScottA_91
Employee
Employee
10 solutions authored 100 replies posted 50 replies posted

What do you mean by crash?  Have you attached the debugger?  Is it always in the interrupt?

It is possible you're spending all your time in your interrupt at the higher speed.  Remember interrupts should be kept very, very short, such as updating a variable for the main loop to handle.

0 Likes

you are right, its stay in the interrupt and never leave it or clear it. the only thing inside the interrupt is a led switching from on/off.

0 Likes

Well, I'm not sure you'd be able to see the LED switching at that speed.

The LED will be on/off for all of 0.0000050 seconds.  I'm pretty sure that's beyond the ability of the human eye to see.  Even 20KHz should be too fast to see.

Are you doing a read/modify/write?  Are you clearing the interrupt?  What is your hfclock set to?

0 Likes

Have you used the Oscilloscope to test the pin voltage to determine whether in and out of the interrupt?

Or could you tell us which way do you use to debug the status of the interrupt?

0 Likes
jota_1397291
Level 1
Level 1

So, i use the scope and the debugger, to test all the input/output with break point and probing.

Depending of the hfclock, the frequency limit increase. I move the " GSR_ISR_ClearPending() " out of the interrupt and put it inside the main loop, add a delay, and now the program still not work at some higher frequency but it resume is action once the frequency going bellow 200Khz.

that a improvement.

0 Likes

At this point I think it would be helpful if you posted your design (or a simplified example showing your problem.)

0 Likes

Remember interrupts should be kept very, very short, such as updating a variable for the main loop to handle.

If you use the LED, maybe we can't recognize the blinking in high frequency.