MCXA153VLH LPUART INTERRUPT

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

MCXA153VLH LPUART INTERRUPT

Jump to solution
1,659 Views
_Ferrari_
Contributor V

I'm developing a project based on the MCXA153VLH microprocessor.

It needs to receive data serially using the LPUART1 peripheral in interrupt mode.

_Ferrari__0-1754062818351.png

 

Upon receiving data, a dedicated interrupt routine named Rs485Interrupt should be called.

_Ferrari__1-1754062881026.png

 

I've debugged the code, and the interrupt handler is called correctly,

_Ferrari__2-1754062913014.png

 

but the s_lpuartIsr array is not initialized, and the program crashes.

_Ferrari__4-1754063033454.png

 

Have you experienced a similar issue? How did you solve it?

Thank you very much for your help and cooperation

regards

Tags (3)
0 Kudos
Reply
1 Solution
1,618 Views
_Ferrari_
Contributor V

Thanks for your help, Habib_MS. I found the solution to the problem. It was because my interrupt handling routine was in a .cpp file.

Changing the file extension from .cpp to .c solved the issue.

View solution in original post

0 Kudos
Reply
2 Replies
1,631 Views
Habib_MS
NXP Employee
NXP Employee

Hello @_Ferrari_,

You need to redefine the IRQ, as explained in the tooltip that appears when you hover over the option:

Habib_MS_0-1754339824589.png

To help with this, you can use the name that you assign to the IRQ handler. for example, the default name "LPUART1_SERIAL_RX_TX_IRQHANDLER", which can be found in peripherals.h:

Habib_MS_1-1754339834965.png

Additionally, I recommend see the SDK (version 25.6) example titled "lpuart_interrupt". It demonstrates how to properly configure an interrupt and provides a good reference for understanding how it works.

BR
Habib.

0 Kudos
Reply
1,619 Views
_Ferrari_
Contributor V

Thanks for your help, Habib_MS. I found the solution to the problem. It was because my interrupt handling routine was in a .cpp file.

Changing the file extension from .cpp to .c solved the issue.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2145272%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EMCXA153VLH%20LPUART%20INTERRUPT%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2145272%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI'm%20developing%20a%20project%20based%20on%20the%20MCXA153VLH%20microprocessor.%3C%2FP%3E%3CP%3EIt%20needs%20to%20receive%20data%20serially%20using%20the%20LPUART1%20peripheral%20in%20interrupt%20mode.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22_Ferrari__0-1754062818351.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22_Ferrari__0-1754062818351.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F350648i88588A56F2340CA9%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22_Ferrari__0-1754062818351.png%22%20alt%3D%22_Ferrari__0-1754062818351.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EUpon%20receiving%20data%2C%20a%20dedicated%20interrupt%20routine%20named%20Rs485Interrupt%20should%20be%20called.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22_Ferrari__1-1754062881026.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22_Ferrari__1-1754062881026.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F350650iC293C7AABCBDF89B%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22_Ferrari__1-1754062881026.png%22%20alt%3D%22_Ferrari__1-1754062881026.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EI've%20debugged%20the%20code%2C%20and%20the%20interrupt%20handler%20is%20called%20correctly%2C%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22_Ferrari__2-1754062913014.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22_Ferrari__2-1754062913014.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F350652i3121224BFA571435%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22_Ferrari__2-1754062913014.png%22%20alt%3D%22_Ferrari__2-1754062913014.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Ebut%20the%20s_lpuartIsr%20array%20is%20not%20initialized%2C%20and%20the%20program%20crashes.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22_Ferrari__4-1754063033454.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22_Ferrari__4-1754063033454.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F350655iB76CF58C56F4E5A3%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22_Ferrari__4-1754063033454.png%22%20alt%3D%22_Ferrari__4-1754063033454.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EHave%20you%20experienced%20a%20similar%20issue%3F%20How%20did%20you%20solve%20it%3F%3C%2FP%3E%3CP%3EThank%20you%20very%20much%20for%20your%20help%20and%20cooperation%3C%2FP%3E%3CP%3Eregards%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2147095%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MCXA153VLH%20LPUART%20INTERRUPT%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2147095%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThanks%20for%20your%20help%2C%20Habib_MS.%20I%20found%20the%20solution%20to%20the%20problem.%20It%20was%20because%20my%20interrupt%20handling%20routine%20was%20in%20a%20%3CSTRONG%3E.cpp%3C%2FSTRONG%3E%20file.%3C%2FP%3E%3CP%3EChanging%20the%20file%20extension%20from%20%3CSTRONG%3E.cpp%3C%2FSTRONG%3E%20to%20%3CSTRONG%3E.c%3C%2FSTRONG%3E%20solved%20the%20issue.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2146387%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MCXA153VLH%20LPUART%20INTERRUPT%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2146387%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F202847%22%20target%3D%22_blank%22%3E%40_Ferrari_%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EYou%20need%20to%20redefine%20the%20IRQ%2C%20as%20explained%20in%20the%20tooltip%20that%20appears%20when%20you%20hover%20over%20the%20option%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Habib_MS_0-1754339824589.png%22%20style%3D%22width%3A%20611px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Habib_MS_0-1754339824589.png%22%20style%3D%22width%3A%20611px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F350853i36D97FD1AC32568C%2Fimage-dimensions%2F611x224%3Fv%3Dv2%22%20width%3D%22611%22%20height%3D%22224%22%20role%3D%22button%22%20title%3D%22Habib_MS_0-1754339824589.png%22%20alt%3D%22Habib_MS_0-1754339824589.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ETo%20help%20with%20this%2C%20you%20can%20use%20the%20name%20that%20you%20assign%20to%20the%20IRQ%20handler.%20for%20example%2C%20the%20default%20name%20%22LPUART1_SERIAL_RX_TX_IRQHANDLER%22%2C%20which%20can%20be%20found%20in%20peripherals.h%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Habib_MS_1-1754339834965.png%22%20style%3D%22width%3A%20621px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Habib_MS_1-1754339834965.png%22%20style%3D%22width%3A%20621px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F350854i43CE8840CB502C5F%2Fimage-dimensions%2F621x381%3Fv%3Dv2%22%20width%3D%22621%22%20height%3D%22381%22%20role%3D%22button%22%20title%3D%22Habib_MS_1-1754339834965.png%22%20alt%3D%22Habib_MS_1-1754339834965.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAdditionally%2C%20I%20recommend%20see%20the%20SDK%20(version%2025.6)%20example%20titled%20%22lpuart_interrupt%22.%20It%20demonstrates%20how%20to%20properly%20configure%20an%20interrupt%20and%20provides%20a%20good%20reference%20for%20understanding%20how%20it%20works.%3C%2FP%3E%0A%3CP%3EBR%3CBR%20%2F%3EHabib.%3C%2FP%3E%3C%2FLINGO-BODY%3E