s32k312 flexcan

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

s32k312 flexcan

Jump to solution
6,249 Views
fengba_360
Contributor III

您好,我在使用s32k312 配置flexcan过程中有以下问题:

1.中断设置 要不要配置handle 函数(附件图片标红处),如果需要配置,那么每一路flexcan 应该配置成什么?

2.FlexCAN0_0_IRQn,FlexCAN0_1_IRQn,分别代表什么中断?handle函数应该怎么设置?

2.如果中断已经设置好,是否在代码里面还需要使用IntCtrl_Ip_EnableIrq()IntCtrl_Ip_InstallHandler()安装和注册中断函数。

谢谢!微信图片_20240803184442.png

0 Kudos
Reply
1 Solution
6,193 Views
fengba_360
Contributor III
好的,谢谢 已经解决

View solution in original post

0 Kudos
Reply
3 Replies
6,207 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi fengba,

建议参考All Example S32K312 DS3.5 RTD-3.0.0里的CAN例程有配置这些。

需要配置与/RTD/src/FlexCAN_Ip_Irq.c里定义的handler名字,比如CAN0_ORED_IRQHandler、CAN0_ORED_0_31_MB_IRQHandler、CAN0_ORED_32_63_MB_IRQHandler。

/RTD/src/FlexCAN_Ip_Irq.c和参考手册附件里的S32K3xx_interrupt_map.xlsx都有介绍各个handler的含义。

如果你没使用IntCtrl_Ip_Init 和 IntCtrl_Ip_ConfigIrqRouting整体初始化IntCtrl_Ip里配置的,那么就需要单独使用IntCtrl_Ip_EnableIrq和IntCtrl_Ip_InstallHandler逐个实现。

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
4,383 Views
Florence100733
Contributor I

我看很多demo里面都是直接声明了

extern void CAN0_ORED_IRQHandler(void);
extern void CAN0_ORED_0_31_MB_IRQHandler(void);
extern void CAN0_ORED_32_63_MB_IRQHandler(void);

也有网上教程是在外设里面配置后更新源代码的,请问这两者有什么区别呀

Tags (1)
0 Kudos
Reply
6,194 Views
fengba_360
Contributor III
好的,谢谢 已经解决
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-1924371%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3Es32k312%20flexcan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1924371%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%20I%20have%20the%20following%20questions%20when%20configuring%20FlexCAN%20using%20S32K312%3A%3C%2FP%3E%3CP%3E1.%20Should%20the%20interrupt%20setting%20be%20configured%20with%20a%20handle%20function%20(marked%20in%20red%20in%20the%20attached%20picture)%3F%20If%20so%2C%20what%20should%20each%20flexcan%20be%20configured%20to%3F%3C%2FP%3E%3CP%3E2.%20What%20interrupts%20do%20FlexCAN0_0_IRQn%20and%20FlexCAN0_1_IRQn%20represent%3F%20How%20should%20the%20handle%20function%20be%20set%3F%3C%2FP%3E%3CP%3E2.%20If%20the%20interrupt%20has%20been%20set%2C%20is%20it%20necessary%20to%20use%20%3CSPAN%3EIntCtrl_Ip_EnableIrq()%3C%2FSPAN%3E%20%3CSPAN%3Eand%20IntCtrl_Ip_InstallHandler()%20in%20the%20code%20to%20install%20and%20register%20the%20interrupt%20function%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThanks!%20%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20240803184442.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20240803184442.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F291786i5927AC87EAC9B0E5%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20240803184442.png%22%20alt%3D%22%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20240803184442.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2087248%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3ERe%3A%20s32k312%20flexcan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2087248%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20have%20seen%20many%20demos%20that%20directly%20declare%3C%2FP%3E%3CP%3Eextern%20void%20CAN0_ORED_IRQHandler(void)%3B%3CBR%20%2F%3Eextern%20void%20CAN0_ORED_0_31_MB_IRQHandler(void)%3B%3CBR%20%2F%3Eextern%20void%20CAN0_ORED_32_63_MB_IRQHandler(void)%3B%3C%2FP%3E%3CP%3EThere%20are%20also%20online%20tutorials%20that%20update%20the%20source%20code%20after%20configuring%20it%20in%20the%20peripheral.%20What%20is%20the%20difference%20between%20the%20two%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1925963%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3ERe%3A%20s32k312%20flexcan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1925963%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3EOk%2C%20thanks%2C%20it's%20solved%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1925812%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3ERe%3A%20s32k312%20flexcan%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1925812%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3Bfengba%2C%3C%2FP%3E%0A%3CP%3EIt%20is%20recommended%20to%20refer%20to%20the%20CAN%20routines%20in%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FAll-Example-S32K312-DS3-5-RTD-3-0-0%2Fta-p%2F1790004%22%20target%3D%22_self%22%3EAll%20Example%20S32K312%20DS3.5%20RTD-3.0.0%3C%2FA%3E%20to%20configure%20these.%3C%2FP%3E%0A%3CP%3EIt%20is%20necessary%20to%20configure%20the%20handler%20name%20defined%20in%20%2FRTD%2Fsrc%2FFlexCAN_Ip_Irq.c%2C%20such%20as%20CAN0_ORED_IRQHandler%2C%20CAN0_ORED_0_31_MB_IRQHandler%2C%20CAN0_ORED_32_63_MB_IRQHandler.%3C%2FP%3E%0A%3CP%3E%2FRTD%2Fsrc%2FFlexCAN_Ip_Irq.c%20and%20S32K3xx_interrupt_map.xlsx%20in%20the%20reference%20manual%20both%20introduce%20the%20meaning%20of%20each%20handler.%3C%2FP%3E%0A%3CP%3EIf%20you%20do%20not%20use%20IntCtrl_Ip_Init%20and%20IntCtrl_Ip_ConfigIrqRouting%20to%20initialize%20the%20configuration%20in%20IntCtrl_Ip%2C%20you%20need%20to%20use%20%3CSPAN%3EIntCtrl_Ip_EnableIrq%20and%3C%2FSPAN%3E%20%3CSPAN%3EIntCtrl_Ip_InstallHandler%20separately%20to%20implement%20them%20one%20by%20one.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EBest%20Regards%2C%3CBR%20%2F%3ERobin%3CBR%20%2F%3E-------------------------------------------------------------------------------%3CBR%20%2F%3ENote%3A%3CBR%20%2F%3E-%20If%20this%20post%20answers%20your%20question%2C%20please%20click%20the%20%22Mark%20Correct%22%20button.%20Thank%20you!%3C%2FP%3E%0A%3CP%3E-%20We%20are%20following%20threads%20for%207%20weeks%20after%20the%20last%20post%2C%20later%20replies%20are%20ignored%3CBR%20%2F%3EPlease%20open%20a%20new%20thread%20and%20refer%20to%20the%20closed%20one%2C%20if%20you%20have%20a%20related%20question%20at%20a%20later%20point%20in%20time.%3CBR%20%2F%3E-------------------------------------------------------------------------------%3C%2FP%3E%3C%2FLINGO-BODY%3E