Autosar - Setting acceptance code and mask at runtime

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Autosar - Setting acceptance code and mask at runtime

跳至解决方案
3,989 次查看
BeCy
Contributor II

Hi,

I'm using AUTOSAR and I trying to find a way to change some parameters which are defined in AUTOSAR configurator, but at runtime (during init phase), according to "project parameters" passed by compilation -D option.

At best I want to change Can_Config_BOARD_InitPeripherals variable before initializing the CAN using Can_Init, but this variable is located in flash and defined as const. For exemple, I want to change the CAN filter code/ filter mask for some of the CAN received objects.

Do you have a suggestion ?

Best regards,

Cyrille

0 项奖励
回复
1 解答
3,926 次查看
namnguyenviet
NXP Employee
NXP Employee

Hello @BeCy,

If you just want to change the acceptance code and mask filter during run-time, you can use these two following functions:

1. FlexCAN_Ip_SetRxIndividualMask: to set the individual mask for each MB

2. FlexCAN_Ip_ConfigRxMb: to set the acceptance code for each MB

Also, you can use FlexCAN_Ip_SetRxMbGlobalMask to set the global mask.

Best Regards,

Nam

 

在原帖中查看解决方案

0 项奖励
回复
7 回复数
3,969 次查看
cuongnguyenphu
NXP Employee
NXP Employee

Hi @BeCy ,

In your case, I think you should use Functional Group option in S32DS

  1. Update your latest S32DS.
    Help > S32DS Extensions and Updates > Install available updates
  2. S32Configuration Tools > Peripherals/Pins/Clocks
    From here you can add more than 1 configure in Functional groups:
    cuongnguyenphu_0-1648031297141.png

     

  3. For each functional configure, you can configure it as you want:
    Remember to choose Config Variant as VARIANT-POST-BUILD
     
    cuongnguyenphu_1-1648031297253.png

     

cuongnguyenphu_2-1648031297345.png

  1. Click on Update Code button
  2. After update code, you will have more than 1 configure of CAN config:

cuongnguyenphu_3-1648031297475.png

  1. You can use one of these config in you main application by Can_Init:

Can_Init(&Can_Config_VS_0);

OR  Can_Init(&Can_Config_VS_1);

 

0 项奖励
回复
3,957 次查看
BeCy
Contributor II

Hi @cuongnguyenphu !

Thanks for your feedback. I understand your answer. You suggest to create 2 or more variants to have the choice of the CAN parameter.

Today,  I just need to change the acceptance code and mask filter. Does it mean creating a complete configuration just for this 2 parameters ? My SW manages 30 or more acceptance code/ mask filter configuration, so I'll need 30+ functionnal groups. And what happen if I need to change 1 commun parameter ? do I have to update all 30+ configurations ?

 

0 项奖励
回复
3,927 次查看
namnguyenviet
NXP Employee
NXP Employee

Hello @BeCy,

If you just want to change the acceptance code and mask filter during run-time, you can use these two following functions:

1. FlexCAN_Ip_SetRxIndividualMask: to set the individual mask for each MB

2. FlexCAN_Ip_ConfigRxMb: to set the acceptance code for each MB

Also, you can use FlexCAN_Ip_SetRxMbGlobalMask to set the global mask.

Best Regards,

Nam

 

0 项奖励
回复
3,896 次查看
BeCy
Contributor II

Hi @namnguyenviet 

For acceptance code and mask filter this solution is ok. The best would be using AUTOSAR functions, but I think it's not existing.

For other parameters without RTD or AUTOSAR api, the solution from @cuongnguyenphu is good too.

Thank you both !

0 项奖励
回复
3,953 次查看
BeCy
Contributor II

@cuongnguyenphu I just tried to test it but I don't know why, I can't add a new groups, it's disabled

 

BeCy_0-1648045626773.png

 

0 项奖励
回复
3,946 次查看
cuongnguyenphu
NXP Employee
NXP Employee

May be your S32DS tool hasn't up-to-date yet, could you try to update it as my suggest in step#1?
Btw, which is chip series you are going to use?

0 项奖励
回复
3,932 次查看
BeCy
Contributor II

Hi @cuongnguyenphu !

I think I'm already on the last version of S32DS :

BeCy_0-1648103176858.png

 

I'm using S32K144W.

0 项奖励
回复