Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 5 > PWM Overflow Interrupt

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



PWM Overflow Interrupt
Moderator:
ANCY

Post Reply
Follow this topic



PWM Overflow Interrupt

kabhijit posted on 18 May 2011 4:34 AM PST
Top Contributor
31 Forum Posts

I have set up a PWM module running at 40khz, and wired the interrupt output to an ISR as shown in the attached file.

The problem is that execution nevert reaches the interrupt handler...

I have called the initialisation functions for the PWM module and I know that the PWM is up and running fine. I have also called <ISR>_Start() which internally calls <ISR>_Enable... Did a single step debug to ensure that these functions are indeed called. The PWM is working fine since I have checked it on a 'scope. Cant figure out what I'm missing... Also, what is to be expected if I tie the Interrupt output of the PWM Block to a digital output pin?

Thanks!

 




Re: PWM Overflow Interrupt

Gautam Das posted on 18 May 2011 05:45 AM PST
Cypress Employee
742 Forum Posts

Hey Abhijit,

 

Can you please tell us on what event you want an Interrupt to be triggered?

Whether you want Interrupt on Terminal Count or on Compare 1 Event? According to your requirement, you can choose any of these. It can be seen in the Advanced tab as shown below.

 

 

 

In main( ), don't forget to uncomment the CYGlobalIntEnable. Else Interrupt will never be triggered.

 

In the isr.c, include the PWM0.h and all other header files which you'll be using in the ISR vector. These should be written inside the #START and #END statements. Any other variables can also be declared here. If they are used in main too, then use the keyword "extern".

 

 

 

In the CY_ISR( ) function read the status register to clear the interrupt bit as it is sticky. Then you can set variables according to your logic.

 

 

 

 

This can get your Interrupt to working. Let us know if this helps.



Re: PWM Overflow Interrupt

kabhijit posted on 18 May 2011 07:54 AM PST
Top Contributor
31 Forum Posts

Oh dang! I was missing just the global interrupt enable statement... "CYGlobalIntEnable". Working now.

BTW It was not there in the default generated main(). It'd be a good idea if the datasheets for the components with interrupts mentioned this...

Thanks!

~Abhijit

 



Re: PWM Overflow Interrupt

kabhijit posted on 24 May 2011 03:30 AM PST
Top Contributor
31 Forum Posts

Hi

I feel that a lot of small things need to be added to the datasheet; for example NONE of the datasheets mention that PWM0_ReadStatusRegister(); must be called to get the PWM interrupt ready for the next time. In the datasheet for the ISR there is but one vague reference -

"Some interrupt sources will also need to be cleared with the appropriate block API (GPIO, UART, …) or they will just re-pend the interrupt. Entering the ISR will clear the pending bit for some interrupt sources."

@Cypress folks - I believe some effort is needed to make datasheets a bit more comprehensive in covering all these small nuggets of info!

Thanks,



Re: PWM Overflow Interrupt

Gautam Das posted on 25 May 2011 09:44 PM PST
Cypress Employee
742 Forum Posts

Hi Abhijit,

 

Thank you very much for the feedback.

The use of 'ReadStatus Register( )' to clear interrupts is mentioned in the Component datasheet rather than in device datasheet.

"The interrupt output is the logical OR of the group of possible interrupt sources. This
signal will go high while any of the enabled interrupt sources are true. The interrupt output
shall remain asserted until the Status Register is read out by the software. In order to
receive subsequent interrupts, the interrupt shall be cleared by reading the Status
Register using the PWM_ReadStatusRegister() API. The interrupt output is not visible if
the Use Interrupt parameter is not set. This allows the status register to be removed for
resource optimization as necessary."






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