PWM module does not want to access the custom interrupt routine but always jumps to the default rout

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PWM module does not want to access the custom interrupt routine but always jumps to the default rout

Jump to solution
882 Views
fi_schi_
Contributor I

Hi there,

I am working with the FRDM-MCXA153 board.
I´m trying to get an interruot on every rising edge using the standart PWM example portet to c++.
So far so simpe, bit unfortunately the interrupt always wants to jump tot the standart interrupt routine (declared as WEAK) and ignores my self-written one.

The PWM module is configured via ConfigTools -> Peripherals -> FLEXPWM0 and should generate an interrupt at VAL2.

Thanks in advance for your help.

Labels (1)
0 Kudos
Reply
1 Solution
872 Views
snech99
Contributor I

Hi,

if your main-file is written in c++, you need to add extern "C" before your ISR.

Following is a short text I found in the startup file:

 

//*****************************************************************************

// Forward declaration of the core exception handlers.

// When the application defines a handler (with the same name), this will

// automatically take precedence over these weak definitions.

// If your application is a C++ one, then any interrupt handlers defined

// in C++ files within in your main application will need to have C linkage

// rather than C++ linkage. To do this, make sure that you are using extern "C"

// { .... } around the interrupt handler within your main application code.

//*****************************************************************************

 

View solution in original post

0 Kudos
Reply
1 Reply
873 Views
snech99
Contributor I

Hi,

if your main-file is written in c++, you need to add extern "C" before your ISR.

Following is a short text I found in the startup file:

 

//*****************************************************************************

// Forward declaration of the core exception handlers.

// When the application defines a handler (with the same name), this will

// automatically take precedence over these weak definitions.

// If your application is a C++ one, then any interrupt handlers defined

// in C++ files within in your main application will need to have C linkage

// rather than C++ linkage. To do this, make sure that you are using extern "C"

// { .... } around the interrupt handler within your main application code.

//*****************************************************************************

 

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-1885121%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EPWM%20module%20does%20not%20want%20to%20access%20the%20custom%20interrupt%20routine%20but%20always%20jumps%20to%20the%20default%20rout%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1885121%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3EHi%20there%2C%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3EI%20am%20working%20with%20the%20FRDM-MCXA153%20board.%3CBR%20%2F%3EI%C2%B4m%20trying%20to%20get%20an%20interruot%20on%20every%20rising%20edge%20using%20the%20standart%20PWM%20example%20portet%20to%20c%2B%2B.%3CBR%20%2F%3ESo%20far%20so%20simpe%2C%20bit%20unfortunately%20the%20interrupt%20always%20wants%20to%20jump%20tot%20the%20standart%20interrupt%20routine%20(declared%20as%20WEAK)%20and%20ignores%20my%20self-written%20one.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3EThe%20PWM%20module%20is%20configured%20via%20ConfigTools%20-%26gt%3B%20Peripherals%20-%26gt%3B%20FLEXPWM0%20and%20should%20generate%20an%20interrupt%20at%20VAL2.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3EThanks%20in%20advance%20for%20your%20help.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1885121%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EMCXA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1885175%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20PWM%20module%20does%20not%20want%20to%20access%20the%20custom%20interrupt%20routine%20but%20always%20jumps%20to%20the%20default%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1885175%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3Eif%20your%20main-file%20is%20written%20in%20c%2B%2B%2C%20you%20need%20to%20add%20extern%20%22C%22%20before%20your%20ISR.%3C%2FP%3E%3CP%3EFollowing%20is%20a%20short%20text%20I%20found%20in%20the%20startup%20file%3A%3C%2FP%3E%3CBR%20%2F%3E%3CDIV%3E%3CDIV%3E%3CP%3E%3CSPAN%3E%2F%2F*****************************************************************************%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%2F%2F%20Forward%20declaration%20of%20the%20core%20exception%20handlers.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%2F%2F%20When%20the%20application%20defines%20a%20handler%20(with%20the%20same%20name)%2C%20this%20will%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%2F%2F%20automatically%20take%20precedence%20over%20these%20weak%20definitions.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%2F%2F%20If%20your%20application%20is%20a%20C%2B%2B%20one%2C%20then%20any%20interrupt%20handlers%20defined%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%2F%2F%20in%20C%2B%2B%20files%20within%20in%20your%20main%20application%20will%20need%20to%20have%20C%20linkage%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%2F%2F%20rather%20than%20C%2B%2B%20linkage.%20To%20do%20this%2C%20make%20sure%20that%20you%20are%20using%20%3C%2FSPAN%3E%3CSPAN%3Eextern%3C%2FSPAN%3E%3CSPAN%3E%20%22C%22%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%2F%2F%20%7B%20....%20%7D%20around%20the%20interrupt%20handler%20within%20your%20main%20application%20code.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%2F%2F*****************************************************************************%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E