EB: How to add CAN bus off interrupt callback function?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

EB: How to add CAN bus off interrupt callback function?

1,223件の閲覧回数
temp_user
Contributor I

1. I want to add CAN bus off interrupt callback function in EB. I found in CANIf module, there is CanIfDispatchCfg, and if I set callback function name in CanIfDispatchUserCtrlBusOffName, and set "CDD" in CanIfDispatchUserCtrlBusOffUL, then can I set a callback function for bus off interrupt?

2. If not, can I set CAN bus interrupt callback function in EB? Here I use S32K344 and RTD 4.0.0.0. 

Actually, when I follow the point 1 to set the bus off interrupt callback function, then after I build the project, some error reported, "CAN bus off callback function is not declared here".

0 件の賞賛
返信
4 返答(返信)

1,179件の閲覧回数
temp_user
Contributor I

Any one can support?

0 件の賞賛
返信

1,138件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

it would be enough to select interrupt processing in FlexCAN setting and add interrupt handler in Platform setting

PetrS_0-1732783259956.pngPetrS_1-1732783266738.png

Then CanIf_ControllerBusOff callback is called when Bus off happens.

BR, Petr

0 件の賞賛
返信

1,128件の閲覧回数
temp_user
Contributor I

Hi PetrS,

Thank you for your reply.

But we can not modify function CanIf_ControllerBusOff() as it is provided by RTD. Actually I want to perform some action when bus off occured. So I want to know whether there is a bus off interrupt callback function that I can use.

0 件の賞賛
返信

1,064件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

below is feedback from RTD team...

This way just applied in ASR context. Please follow steps:

1. Create 1 callback function for Bus off in main.c. User defines this function by themselves.

PetrS_0-1733310461173.png

2. Create 1 header file to extern this callback function and this file will be included in Can_Cfg.c. In my case, I created CanIf_Header.h

PetrS_1-1733310461451.png

In this file, extern the function Bus Off Callback.

PetrS_2-1733310461448.png

3. In CanIf configuration, fill header file and Call back function name.

PetrS_3-1733310461087.png

 

PetrS_4-1733310461415.png

 

BR, Petr

 

0 件の賞賛
返信