RTA Knowledge Base

Skip to end of banner
Go to start of banner

OsekNm module for Direct Network Management

Module for Direct NM

The rba_NmOsek module is used inside RTA-CAR when a SW Platform based on Autosar is used inside a network with SW Platform based on Osek.
In a layered structure rba_NmOsek interacts with the Application layer and the Data Link Layer. Basically rba_NmOsek provides the data and services to the Application layer and interacts with the DLL-COM to monitor the bus and for message transmission/reception. 
The rba_NmOsek module can be consider as an NM Module inside the Autosar stack and it is used instead of the Bus NM module.
For example, the stack will be the following if we consider the CAN bus:

The NM Module, rba_NmOsek, communicates with its upper layer, NM, with the same Bus NM APIs and Callbacks notification used by the Autosar Bus NM Module (e.g. CanNM).
An example of NM API is the <Bus_Nm>_NetworkRequest where the <Bus_Nm> is rba_NmOsek.
The rba_NmOsek communicates with its lower layer, <Bus>If (e.g. CanIf), with the same Bus NM APIs and Callbacks notification used by the Autosar Bus NM Module (e.g. CanNM), as follow:

The basic functionalities of rba_NmOsek are the following: 

  1. Start-up of network management – Initialization routines 
  2. Ring formation and various message and timer handling 
  3. Operating modes of rba_NmOsek 
  4. Network configuration management 
  5. Providing service/data to the application layer 
  6. Error detection and handling 
  7. Network management for multiple networks

Note

The parameter values provided in the delivery package are merely for reference. Therefore, please review your requirements and adjust the parameters accordingly to ensure proper configuration.

RTA-CAR Workflow

For the RTA-CAR Workflow explanation we integrated the rba_NmOsek module inside the VRTA Standard SK for RTA-CAR 12.1.
The CAN Network configuration used for the example is the one shown below:

The Osek NM Pdu structure could change in function of the OEM specific requirement.
In the implementation of this example, the structure will be the following:

Step1: ASW configuration

The rba_NmOsek offers a periodic function that can be considered as the OsekNM main function (Dnm_Co_Proc) that runs every 20ms or 10ms, responsible for monitoring the timing requirements, as well as constructing and transmitting the response. This main function needs to be schedule periodically.
One way to do it is to assign it to a specific SWC, or a CDD SWC and schedule it in the RTE configuration.
In this example the SWC NmOsekSWC will be used to call Dnm_Co_Proc. 
Create a function and a Timing event in the SWC:


Map the SWC inside the TopLevelComposition:

Map the SWC also in the system:

Call the Dnm_Co_Proc() function inside the SWC code:

Step2: System Configuration

Step2.a: Import a dbc

The system configuration is needed only to add the NM Pdus.
So, it can be done by simply importing a dbc file with the required Pdus. 
For example in ours case we have two pdus:

  1. NmPdu_Rx_NetworkToNode0
  2. NmPdu_Tx_Node0ToNetwork

Pdu Name

The Pdu names used in this application notes are just examples and the user needs to use their specific Pdu Names.

After importing the dbc the system configuration will look like this:

  • Pdus configuration:

  • Frames configuration:

Step2.b: Generate the ConfGen

Now that the System is configured with the Pdus required for Network management the user can generate the ConfGen. 

Step3: BSW Configuration

Step3.a: Configure the CanIf

To register a callback for rba_NmOsek, the CanIf configuration needs to be adjusted. Three callbacks are available for registration:

  1. Dnm_CanAdaptRxIndication: The callback function for indicating the reception of rba_NmOsek message should be called by CanIf. To register this callback in the CanIf module the user has to configure:
    1. CanIfRxPduUserRxIndicationName -> Dnm_CanAdaptRxIndication
    2. anIfRxPduUserRxIndicationUL -> CDD
  2. Dnm_CanAdaptTxConfirmation: To indicate successful transmission, CanIf should call this callback function. In order to register this callback in the CanIf module the user has to configure:
    1. CanIfTxPduUserTxConfirmationName -> Dnm_CanAdaptTxConfirmation
    2. CanIfTxPduUserTxConfirmationUL -> CDD
  3. Dnm_ControllerBusOff: To indicate that a Bus Off has occurred, CanIf should call this callback function instead of the CanSm_ControllerBusOff() function:
    1. CanIfDispatchUserCtrlBusOffName -> Dnm_ControllerBusOff
    2. CnaIfDispatchUserCtrlBusOffUL -> CDD

Inside the project they have to be configured as follow:



Configure the CanIfPubblicCddHeaderFile and CanIfRbPubblicUserHeaderFile:

Step3.b: Configure the NM

Configure the NM module as follow:

Step3.c: Configure the ComM

Configure the ComMNmVariant to FULL:

Step3.d: Configure the CDD

A CDD module is used to represent the OsekNM module.
So, create a CDD module if it is not already present in the project.
Configure the CddComIfUpperLayerContribution as follow:

Configure the CddGenericNmLowerLayerContribution as follow:

Step3.e: Configure the BswM

To initialize rba_NmOsek, you need to register the initialization function of rba_NmOsek in BswM. Here are the steps to follow:

  • Configure BswMAction: In order to initialize rba_NmOsek through BswM, the callout function "Dnm_OsekInit" needs to be configured in BswMAction

  • Configure BswMActionListItems: The configured BswMAction must be referenced by the BswMActionListItem as shown below:

  • Configure BswMUserIncludeFiles: The header file for the initialization function of rba_NmOsek should also be configured in BswMUserIncludeFiles as shown below:

the file dnm_BswMUserInclude.h file look like this:

Step3.f: Generate the BSW

Run the BSW Generation selecting the NM module needed.

Step4: RTE and OS Generation

Step 4.a: Generate RTE and Os

Map the NmOsek event to a task:


No need of the CanNM main function in the RTE Mapping

As rba_NmOsek is configured, the cyclic function of rba_NmOsek is responsible for managing the network instead of CaNM. Therefore, the main function of CanNM becomes obsolete and should be not added or removed from the RTE mapping.

 
Run the RTE being sure to have selected all the files required and then run the Os.

Step5: rba_NmOsek configuration

Configuring rba_NmOsek is an essential step in setting up a reliable communication network in AUTOSAR-compliant automotive systems.

CanIf configuration

In order to establish a proper connection between CanIf and rba_NmOsek, it is necessary to adjust certain parameters related to CanIf, particularly the pdu id of NM rx and tx.

  • Configure the CDD Pdu for the Upper Layer inside the "CanIf_Integn.h" file:

  • As we have configured a CDD module after the CanIf, we have configured the CanIfPublicCddHeaderFile, so that file has to be added to the integration folder of CanIf and it can be empty:

  • Configure the file "rba_NmOsek\template\dnm_auto_conf.h" with the Pdu used:

Network configuration

rba_NmOsek provides a network configuration feature, which allows users to configure information for all networks. User has to adjust the parameters accordingly to ensure proper configuration.

  • Path of configuration file: rba_NmOsek\template\dnm_auto_conf.c



Timing parameter configuration

rba_NmOsek provides a configuration file that allows users to manually configure timing parameters as below.

  • Path of configuration file: rba_NmOsek\template\dnm_auto_conf.h


The timing parameters mentioned earlier are adjustable based on the customer project needs.

rba_NmOsek cyclic task

The DNM_PROC_CYCLE parameter shall match with the scheduling of the main function (Dnm_Co_Proc) configured on Step1 of this workflow. E.g. if the main function is scheduled every 10 ms, this parameter shall be defined as 10uL.

  • Path of configuration file: rba_NmOsek\template\dnm_auto_conf.h

Step6: Build the Project

Standard Starter Kit

In this example we used the Standard Starter Kit project, it uses virtual mcal and so it can be run by simply:

  1. Run the python script to remove the error messages.
  2. Run the 01_mcal.bat file
  3. Run the 02_Build.bat file

The User Guide of the Starter Kit can be used for more information on this part.

Customer Project

In case you are integrating the OsekNM component in your specific project, please review your build system and scripts to make sure all the new files of OsekNm are included in the build.

  • No labels