cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

jota_1397291
New Contributor

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
LinglingG_46
Moderator
Moderator

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

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
jota_1397291
New Contributor

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
ScottA_91
Employee

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
LinglingG_46
Moderator
Moderator

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
New Contributor

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
ScottA_91
Employee

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

0 Likes
LinglingG_46
Moderator
Moderator

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