S32K396 CAN Interrupt

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

S32K396 CAN Interrupt

Jump to solution
541 Views
Jason88619
Contributor II
Hello everyone, I'm currently using the S32K396-BGA-DC1 development board and want to receive CAN messages via interrupts. My configuration is as shown in the attached image. However, this configuration fails to receive CAN messages successfully.
I would greatly appreciate it if anyone could point out my mistakes, provide a CAN + interrupt reception method, or a CAN + Rx FIFO reception method. Thank you in advance!
Jason88619_0-1761823260194.pngJason88619_1-1761823273826.pngJason88619_2-1761823536747.png

 

Jason88619_0-1761823489078.pngJason88619_1-1761823512446.png

 

 

 

Tags (1)
0 Kudos
Reply
1 Solution
508 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Jason88619,

From your main.c routine, I can see you are not initializing the interrupt controller driver. If you are using latest RTD, simply call the following function:

/* Initialize Interrupt */

IntCtrl_Ip_Init(&IntCtrlConfig_0);

There is no need to call IntCtrl_Ip_EnableIrq()IntCtrl_Ip_InstallHandler(), as IntCtrl_Ip_Init() does call both of these functions.

There are some examples for FlexCAN implementation in community. Please see them below:

They are not based on S32K396 derivative, but configuration and main routine should be the same.

Best regards,
Julián

View solution in original post

0 Kudos
Reply
2 Replies
509 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Jason88619,

From your main.c routine, I can see you are not initializing the interrupt controller driver. If you are using latest RTD, simply call the following function:

/* Initialize Interrupt */

IntCtrl_Ip_Init(&IntCtrlConfig_0);

There is no need to call IntCtrl_Ip_EnableIrq()IntCtrl_Ip_InstallHandler(), as IntCtrl_Ip_Init() does call both of these functions.

There are some examples for FlexCAN implementation in community. Please see them below:

They are not based on S32K396 derivative, but configuration and main routine should be the same.

Best regards,
Julián

0 Kudos
Reply
500 Views
Jason88619
Contributor II

Thank you so much!

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2195788%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ES32K396%20CAN%20Interrupt%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2195788%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CDIV%20class%3D%22%22%3EHello%20everyone%2C%20I'm%20currently%20using%20the%20S32K396-BGA-DC1%20development%20board%20and%20want%20to%20receive%20CAN%20messages%20via%20interrupts.%20My%20configuration%20is%20as%20shown%20in%20the%20attached%20image.%20However%2C%20this%20configuration%20fails%20to%20receive%20CAN%20messages%20successfully.%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3EI%20would%20greatly%20appreciate%20it%20if%20anyone%20could%20point%20out%20my%20mistakes%2C%20provide%20a%20CAN%20%2B%20interrupt%20reception%20method%2C%20or%20a%20CAN%20%2B%20Rx%20FIFO%20reception%20method.%20Thank%20you%20in%20advance!%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Jason88619_0-1761823260194.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jason88619_0-1761823260194.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F363253i70D5A74C2EF9B4C3%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Jason88619_0-1761823260194.png%22%20alt%3D%22Jason88619_0-1761823260194.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Jason88619_1-1761823273826.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jason88619_1-1761823273826.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F363255i760EB24676B54C60%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Jason88619_1-1761823273826.png%22%20alt%3D%22Jason88619_1-1761823273826.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Jason88619_2-1761823536747.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jason88619_2-1761823536747.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F363258i0E040F0A8CD93BC9%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Jason88619_2-1761823536747.png%22%20alt%3D%22Jason88619_2-1761823536747.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Jason88619_0-1761823489078.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jason88619_0-1761823489078.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F363256i90F2B8F378677BFF%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Jason88619_0-1761823489078.png%22%20alt%3D%22Jason88619_0-1761823489078.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Jason88619_1-1761823512446.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jason88619_1-1761823512446.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F363257iCF56D4FD31A961EF%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Jason88619_1-1761823512446.png%22%20alt%3D%22Jason88619_1-1761823512446.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2196193%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K396%20CAN%20Interrupt%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2196193%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSPAN%3EThank%20you%20so%20much!%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2196120%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K396%20CAN%20Interrupt%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2196120%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F252822%22%20target%3D%22_blank%22%3E%40Jason88619%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EFrom%20your%20main.c%20routine%2C%20I%20can%20see%20you%20are%20not%20initializing%20the%20interrupt%20controller%20driver.%20If%20you%20are%20using%20latest%20RTD%2C%20simply%20call%20the%20following%20function%3A%3C%2FP%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%20padding%3A%200px%200px%200px%202px%3B%22%3E%0A%3CDIV%20style%3D%22color%3A%20%23000000%3B%20background-color%3A%20%23ffffff%3B%20font-family%3A%20'Courier%20New'%3B%20font-size%3A%2010pt%3B%20white-space%3A%20pre%3B%22%3E%0A%3CP%20style%3D%22margin%3A%200%3B%22%3E%3CSPAN%3E%2F*%20Initialize%20Interrupt%20*%2F%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200%3B%22%3E%3CSPAN%3EIntCtrl_Ip_Init%3C%2FSPAN%3E%3CSPAN%3E(%26amp%3BIntCtrlConfig_0)%3B%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3EThere%20is%20no%20need%20to%20call%26nbsp%3B%3CSPAN%3EIntCtrl_Ip_EnableIrq()%3C%2FSPAN%3E%20%26amp%3B%26nbsp%3B%3CSPAN%3EIntCtrl_Ip_InstallHandler()%2C%20as%26nbsp%3BIntCtrl_Ip_Init()%20does%20call%20both%20of%20these%20functions.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EThere%20are%20some%20examples%20for%20FlexCAN%20implementation%20in%20community.%20Please%20see%20them%20below%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FExample-S32K344-FlexCAN-Ip-TX-RX-EnhanceRXFIFO-DMA-test-S32DS3-5%2Fta-p%2F2015832%22%20target%3D%22_blank%22%3EExample%20S32K344%20FlexCAN_Ip%20TX%2FRX%2FEnhanceRXFIFO%20DMA%20test%20S32DS3.5%20RTD400%20-%20NXP%20Community%3C%2FA%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FRTD600-MCAL-amp-IP-S32K3X4EVB-T172-FlexCAN-Example-Interrupt%2Fta-p%2F2142069%22%20target%3D%22_blank%22%3E%5BRTD600%20MCAL%20%26amp%3B%20IP%5D%20S32K3X4EVB-T172%20FlexCAN%20Example%20Interrupt%2FPolling%20-%20NXP%20Community%3C%2FA%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FExample-S32K312-CAN-Transmit-amp-Receive-Using-MB-amp-FIFO-DMA%2Fta-p%2F1789196%22%20target%3D%22_self%22%3ES32K312%20CAN%20Transmit%20%26amp%3B%20Receive%20Using%20MB%20%26amp%3B%20FIFO%20DMA.%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThey%20are%20not%20based%20on%20S32K396%20derivative%2C%20but%20configuration%20and%20main%20routine%20should%20be%20the%20same.%3C%2FP%3E%0A%3CP%3EBest%20regards%2C%3CBR%20%2F%3EJuli%C3%A1n%3C%2FP%3E%3C%2FLINGO-BODY%3E