Main Content

Programmatically Configure AUTOSAR Nonvolatile Communication

This example shows how to programmatically read and write AUTOSAR nonvolatile (NV) data using port-based NV data communication.

1. Open autosar_swc_expfcns and create the autosar.api.getAUTOSARProperties object.

hModel = 'autosar_swc_expfcns';
open_system(hModel);
nvProps = autosar.api.getAUTOSARProperties(hModel);

2. Add an AUTOSAR NV data interface, myNvInterface with NV data element DE3.

addPackageableElement(nvProps,'NvDataInterface','/pkg/if','myNvInterface');
add(nvProps,'myNvInterface','DataElements','DE3');

3. Add an AUTOSAR NV receiver port NvRPort and associate it with interface myNvInterface.

add(nvProps,'ASWC','NvReceiverPorts','NvRPort','Interface','myNvInterface');

4. Map Simulink® inport Rport_DE2 to AUTOSAR port NvRPort and element DE3.

slMap = autosar.api.getSimulinkMapping(hModel);
mapInport(slMap,'RPort_DE2','NvRPort','DE3','ImplicitReceive');

See Also

Objects

Functions

Properties

Related Topics