Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 5 > Interruptions on PSOC5

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Interruptions on PSOC5
Moderator:
ANCY

Post Reply
Follow this topic



Interruptions on PSOC5

odesus posted on 24 Sep 2011 1:43 PM PST
Member
4 Forum Posts

Dear comunity:

I'm working with Psoc5 specifically interrupts in a single pin. When I define falling edge on input as interrupt event and I use ISR 1.50 with derived option, I realized interruption ISR_1 works on falling and rising edges. Is this normal or should work only on falling edge as I defined?

Thanks in advance.




Re: Interruptions on PSOC5

David Ron posted on 26 Sep 2011 01:38 AM PST
Top Contributor
24 Forum Posts

odesus,

 

i tested a project with interrupt on "falling edge" on the pin and "derived" on interrupt.

As per my observation, the interrupt was obtained (LED Toggle) upon falling edge. Sometimes (like 1 in 10 times), i observed that the LED toggled upon rising edge. i strongly suspect that this may be due to switch debounce.

Make sure that the resistive pull up is enabled when using falling edge as interrupt source.

i have uploaded the project.

 

 



Re: Interruptions on PSOC5

odesus posted on 26 Sep 2011 09:59 PM PST
Member
4 Forum Posts

Dear David:

Thanks for your answer. Yes I have notice this, interruption serves on falling and rising edges. In fact to avoid this I have used a

code like this:

 

isr_1_Disable();

if(Cy_ReadPin()==0)

{

  main code of interruption

}

Cy_Pin_ClearInterrupt();

isr_1_Enable();

}// end of interrupt

 

Unfortunately interrupt  WORKS on both edges, so when you stop of pressing the button and goes high considering the code above the main code of interruption will never executed if button is not pressed. That I was wondering if this is a kind of error on API's or something like that. Lets see what a cypress engineer tell us about it. Thanks



Re: Interruptions on PSOC5

Gautam Das posted on 28 Sep 2011 03:39 AM PST
Cypress Employee
742 Forum Posts

Hi Odesus,

 

The PICU Interrupt can be set to Rising edge, Falling edge or on Both edge.

 

The project attached by David is configured for interrupt on Falling edge. The LED toggles on the Falling edge. Interrupt is not generated on the rising edge.

As mentioned by David, the Switch Debounce might result in the input pin going high > low > high instead of going high directly (The resistive pull up is enabled, hence the pin is pulled up by default).

This will inevitably result in the PICU interrupt getting triggered because of a high > low transition (falling edge).

 

In order to overcome the ambiguity introduced by the switch debounce, I tested the project by giving a square wave at the Pin input. The output pin was supposed to toggle on falling edge of the input signal.

The oscilloscope snap-shot is attached below:

 

 

 

Yellow waveform = Input signal to PICU

Blue waveform = Output pin toggle.

 

It can be seen that the output pin toggles only on the falling edge of the PICU input pin.

 



Re: Interruptions on PSOC5

Gautam Das posted on 28 Sep 2011 03:46 AM PST
Cypress Employee
742 Forum Posts

On similar grounds, the PICU was changed to Interrupt on "Rising Edge".

The snapshot below shows that output pin toggles on every rising edge of the input signal.

 



Re: Interruptions on PSOC5

Gautam Das posted on 28 Sep 2011 03:52 AM PST
Cypress Employee
742 Forum Posts

As a third case, when the PICU was configured for interrupt on "Both Edges", the output pin toggled on every edge of the input signal.

The oscilloscope snapshot is as shown below:

 



Re: Interruptions on PSOC5

odesus posted on 04 Oct 2011 04:12 PM PST
Member
4 Forum Posts

Many thanks for your answers!!

Yes, I have understood what is the matter with interruptions, specially using pushbuttons which can be very noisy. I've observed there are some registers which are related to interrupt flags like primask, xPSR,etc.

When I enter to my interruption I have notice despite use PIN_ClearInterrupt() function, the flag seems to be still activated so this interruption is served 2 times.

1.-Is there any way to read the status of this interrupt and clear the flag directly using ASM to remove this mask interrupt? 2.-Where is the address of this interrupt register to access directly? I mean to clear all possible interrupts associated to this pin.

On technical datasheets I have observed PIN_ClearInterupt() must clear all interrupts, but I don't know why in my case is not working.

Thanks in advance for all your comments.

 

 






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20