ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide...

71
ETAS Virtual ECU V2.0 VRTA Device User Guide

Transcript of ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide...

Page 1: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS Virtual ECU V2.0

VRTA Device User Guide

Page 2: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

2

Copyright

The data in this document may not be altered or amended without special notification

from ETAS GmbH. ETAS GmbH undertakes no further obligation in relation to this docu-ment. The software described in it can only be used if the customer is in possession of a

general license agreement or single license. Using and copying is only allowed in concur-

rence with the specifications stipulated in the contract.

Under no circumstances may any part of this document be copied, reproduced, transmit-

ted, stored in a retrieval system or translated into another language without the express

written permission of ETAS GmbH.

© Copyright 2011 ETAS GmbH, Stuttgart

The names and designations used in this document are trademarks or brands belonging to the respective owners.

Document V1.1 R03 EN – 06.2013

Page 3: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS Contents

ETAS Virtual ECU V2.0 VRTA Device User Guide 3

Contents

1 Introduction ............................................................................................................................ 8

1.1 Definitions and Abbreviations ............................................................................................ 8

1.2 Conventions..................................................................................................................... 9

2 Sending / Receiving the values through VRTA Monitor ............................................................. 10

2.1 Connecting the VRTA Monitor ......................................................................................... 10

2.2 Running the Virtual ECU using ISOLAR-EVE ..................................................................... 13

2.3 Sending the Values (Actions) .......................................................................................... 15

2.4 Receiving the values through polling / hooking (Events) ................................................... 16

3 VRTA PORT Device ................................................................................................................ 18

3.1 VRTA Port Overview ....................................................................................................... 18

3.2 Access Synchronizable VRTA Port Using C++ Methods ..................................................... 18

3.3 Actions .......................................................................................................................... 19

3.3.1 InjectedPortpinDirection ................................................................................... 20 3.3.3 InjectedSetPinMode ........................................................................................... 20 3.4 Events ........................................................................................................................... 20

3.4.1 CurrentJob .......................................................................................................... 21 3.4.2 DETErrors ............................................................................................................ 21

4 VRTA DIO Device .................................................................................................................. 22

4.1 VRTA DIO Overview ................................................................................................... 22

4.2 Actions ........................................................................................................................ 22

4.2.1 Write Channel ..................................................................................................... 22 4.2.2 Flip Channel ........................................................................................................ 23 4.2.3 Write Port ............................................................................................................ 23 4.2.4 Write Channel Group .......................................................................................... 23 4.3 Events ........................................................................................................................... 23

4.3.1 Read Channel ...................................................................................................... 24 4.3.2 Channel Written.................................................................................................. 24 4.3.3 DET Errors ........................................................................................................... 24 4.3.4 Port Written ........................................................................................................ 24 4.3.5 Channel Group Written ...................................................................................... 24

5 VRTA PWM Device ................................................................................................................. 25

5.1 VRTA Pwm Overview ...................................................................................................... 25

5.2 Access Synchronizable VRTA Pwm Using C++ Methods .................................................... 25

5.3 Actions .......................................................................................................................... 27

Page 4: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS Contents

ETAS Virtual ECU V2.0 VRTA Device User Guide 4

5.3.1 InjectedDutyCycle .............................................................................................. 27 5.3.2 InjectedOutputToIdle ........................................................................................ 28 5.3.3 InjectedOutputState .......................................................................................... 28 5.3.4 InjectedEnableNotification ................................................................................ 28 5.3.5 InjectedDisableNotification ............................................................................... 28 5.4 Events ........................................................................................................................... 28

5.4.1 Result .................................................................................................................. 29 5.4.2 CurrentJob .......................................................................................................... 29 5.4.3 DETErrors ............................................................................................................ 29 5.4.4 InjectedResult .................................................................................................... 29

6 VRTA ICU Device ................................................................................................................... 30

6.1 VRTA ICU Overview ....................................................................................................... 30

6.2 Access Synchronizable VRTA ICU Using C++ Methods ...................................................... 30

6.3 Actions .......................................................................................................................... 32

6.3.1 Init ....................................................................................................................... 32 6.3.2 De-Init ................................................................................................................. 32 6.3.3 SetMode .............................................................................................................. 32 6.3.4 DisableWakeup ................................................................................................... 33 6.3.5 EnableWakeup .................................................................................................... 33 6.3.6 SetActivationCondition ...................................................................................... 33 6.3.7 DisableNotification ............................................................................................. 33 6.3.8 EnableNotification .............................................................................................. 33 6.3.9 ResetEdgeCount ................................................................................................. 33 6.3.10 EnableEdgeCount ............................................................................................... 34 6.3.11 EnableEdgeDetection ......................................................................................... 34 6.3.12 DisableEdgeDetection ........................................................................................ 34 6.3.13 DisableEdgeCount .............................................................................................. 34 6.3.14 StartSignalMeasurement ................................................................................... 34 6.3.15 StopSignalMeasurement .................................................................................... 34 6.4 Events ........................................................................................................................... 35

6.4.1 DETErrors ............................................................................................................ 35 6.4.2 InputState ........................................................................................................... 35 6.4.3 Mode .................................................................................................................... 35 6.4.4 EdgeNumbers...................................................................................................... 35 6.4.5 TimeElapsed ........................................................................................................ 35 6.4.6 DutyCycleValues ................................................................................................. 36 6.4.7 CheckWakeupStatus .......................................................................................... 36

7 VRTA ADC Device .................................................................................................................. 37

7.1 VRTA ADC Overview....................................................................................................... 37

7.2 Access Synchronizable VRTA Adc Using C++ Methods ...................................................... 37

7.3 Actions .......................................................................................................................... 41

7.3.1 InjectedSetupResultBuffer ................................................................................ 41 7.3.2 InjectedStartGroupConversion ......................................................................... 41 7.3.3 InjectedStopGroupConversion .......................................................................... 42 7.3.4 InjectedEnableHardwareTrigger ....................................................................... 42 7.3.5 InjectedDisableHardwareTrigger ...................................................................... 42 7.3.6 InjectedEnableGroupNotification ...................................................................... 42 7.3.7 InjectedDisableGroupNotification..................................................................... 42 7.3.8 InjectedReadGroup ............................................................................................ 42 7.3.9 InjectedGetStreamLastPointer .......................................................................... 42 7.3.10 InjectedGetGroupStatus .................................................................................... 43 7.4 Events ........................................................................................................................... 43

Page 5: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS Contents

ETAS Virtual ECU V2.0 VRTA Device User Guide 5

7.4.1 Result .................................................................................................................. 43 7.4.2 ValidSample ........................................................................................................ 43 7.4.3 Status .................................................................................................................. 43 7.4.4 CurrentJob .......................................................................................................... 44 7.4.5 DETErrors ............................................................................................................ 44 7.4.6 InjectedResult .................................................................................................... 44 7.4.7 InjectedValidSample .......................................................................................... 44 7.4.8 InjectedStatus .................................................................................................... 44

8 VRTA CAN Device .................................................................................................................. 45

8.1 VRTA Can Overview ....................................................................................................... 45

8.2 Actions .......................................................................................................................... 45

8.2.1 CanInit ................................................................................................................ 45 8.2.2 Can_InitController.............................................................................................. 45 8.2.3 Can_SetControllerMode ..................................................................................... 46 8.2.4 CanDisableControllerInterrupts ........................................................................ 46 8.2.5 CanEnableControllerInterrupts ......................................................................... 46 8.2.6 CanCheckWakeup ............................................................................................... 46 8.2.7 CanWrite ............................................................................................................. 46 8.2.8 CanMainFunction_Write..................................................................................... 46 8.2.9 CanMainFunction_Read ..................................................................................... 47 8.2.10 CanMainFunction_BusOff .................................................................................. 47 8.2.11 CanMainFunction_Wakeup ................................................................................ 47 8.2.12 CanMainFunction_Mode ..................................................................................... 47 8.3 Events ........................................................................................................................... 48

8.3.1 CanControllerStatus ........................................................................................... 48 8.3.2 CanWriteStatus ................................................................................................... 48 8.3.3 Status .................................................................................................................. 48 8.3.4 CurrentJob .......................................................................................................... 49 8.3.5 DETErrors ............................................................................................................ 49 8.3.6 DriverState .......................................................................................................... 49

9 VRTA CanTrcv Device ............................................................................................................ 50

9.1 VRTA CanTrcv Overview ................................................................................................. 50

9.2 Actions .......................................................................................................................... 52

9.2.1 SetOpMode .......................................................................................................... 53 9.2.2 GetOpMode ......................................................................................................... 53 9.2.3 GetBusWuReason ............................................................................................... 53 9.2.4 SetWakeupMode ................................................................................................. 53 9.2.5 CheckWakeup ..................................................................................................... 53 9.3 Events ........................................................................................................................... 54

9.3.1 Result .................................................................................................................. 54 9.3.2 CurrentJob .......................................................................................................... 54 9.3.3 DETErrors ............................................................................................................ 54 9.3.4 CurrentStatus ..................................................................................................... 55 9.3.5 WakeupMode ...................................................................................................... 55

10 VRTA FLASH Device .............................................................................................................. 56

10.1 VRTA Flash Overview ..................................................................................................... 56

10.2 Access VRTA Flash Using C++ Methods .......................................................................... 56

10.3 Actions .......................................................................................................................... 60

10.3.1 Inject Write ......................................................................................................... 60 10.3.2 Inject Read ......................................................................................................... 60

Page 6: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS Contents

ETAS Virtual ECU V2.0 VRTA Device User Guide 6

10.3.3 Inject Erase ......................................................................................................... 60 10.3.4 Inject Compare ................................................................................................... 60 10.3.5 Inject Cancel ....................................................................................................... 61 10.3.6 Inject Set Mode .................................................................................................. 61 10.4 Events ........................................................................................................................... 61

10.4.1 Result .................................................................................................................. 62 10.4.2 Status .................................................................................................................. 62 10.4.3 DETErrors ............................................................................................................ 63 10.4.4 CurrentJob .......................................................................................................... 63 10.4.5 InjectedRead ...................................................................................................... 63 10.4.6 InjectedResult .................................................................................................... 63 10.4.7 InjectedStatus .................................................................................................... 63

11 Synchronization Clock Device(vrtaSyncClock) .......................................................................... 64

11.1 VrtaSynchClock Overview ............................................................................................... 64

11.2 Timer Hierarchy ............................................................................................................. 65

11.3 Access Synchronizable Clock Features Using C++ Methods ............................................... 66

11.4 Actions .......................................................................................................................... 68

11.4.1 Interval ............................................................................................................... 68 11.4.2 Scale .................................................................................................................... 69 11.4.3 Start ..................................................................................................................... 69 11.4.4 Stop ..................................................................................................................... 69 11.4.5 Adaptive .............................................................................................................. 69 11.4.6 FreeRunning ....................................................................................................... 69 11.4.7 TickLimit .............................................................................................................. 69 11.5 Events ........................................................................................................................... 70

11.5.1 Interval ............................................................................................................... 70 11.5.2 Scale .................................................................................................................... 70 11.5.3 Running ............................................................................................................... 70 11.5.4 TicksRemaining .................................................................................................. 70

12 ETAS Contact Addresses ........................................................................................................ 71

Page 7: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS Figures

ETAS Virtual ECU V2.0 VRTA Device User Guide 7

Figures

Fig 1 Virtual Device / Actions / Events.

Fig 2 Snapshot showing that VECU is running successfully.

Fig 3 Showing the sys log that VECU is running successfully

Fig 4 General snapshot of VRTA Monitor

Fig 5 VRTA Monitor to add the host name.

Fig 6 VRTA Monitor about where to add the host name.

Fig 7 VRTA Monitor showing the VECU name

Fig 8 VRTA Monitor displaying the devices inside the VECU

Fig 9 VRTA CAN Driver Device in VECU

Fig 10 Sending the values through VRTA Monitor

Fig 11 Receiving the values through VRTA Monitor Polling

Fig 12 Receiving the values through VRTA Monitor Hooking

Page 8: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 8

1 Introduction

This Document will guide the user to use VRTA devices in the VECU. The VRTA devices explained here are ADC, FLASH, ICU, PORT, PWM, CAN, CANTrcv, DIO,

SynchronizableClock. It will also provide information on connecting the device with external

applications and send/receive messages with the VRTA virtual device. This feature will also allow monitoring the behavior of the MCAL from an external world.

Targeted Users:

It is intended to those who want to develop Virtual Devices for EVE MCAL Modules. It is also

intended to those who want to monitor the behavior of the MCAL in the VECU using external

Applications like VRTA Monitor.

Reference Manual:

Detailed Information on VRTA Virtual ECU is provided in the RTA-OS VRTA Virtual ECU User Guide.

For a default installation of VRTA, this will be found in C:\ETAS\RTA-OS\Targets\VRTA.

This guide does not tell you how to configure and use RTA-OS. That information is provided

in the RTA-OS User Guide. A complete technical reference to RTA-OS can be found in the RTA-OS Reference Guide. Both of these documents can be found in the Documents

folder of your RTA-OS installation. For a default installation, this will be found in

C:\ETAS\RTA-OS\Documents.

Pre-requisites:

Users should be aware of how to create a VECU, compile and run in ISOLAR-EVE.

Users should aware of some basic VRTA APIs like OnAction, AsyncGetState etc.

Good Knowledge of C, C++ is required.

1.2 Definitions and Abbreviations

API Application Programming Interface

AUTOSAR Automotive Open System Architecture

BSW Basic Software

VECU Virtual Electronic Control Unit VRTA Virtual RTA

MCAL Microcontroller Abstraction Layer ADC Analogue Digital Converter

CAN Controller Area Network

CANTrcv CAN Transceiver DIO Digital Input Output

ICU Input Capture Unit PWM Pulse Width Modulation

RTA-OS

It is a statically configurable, preemptive, real-time operating system

(RTOS) for use in high-performance, resource-constrained applications.

VRTA

It is nothing but Virtual RTA-OS. It does not need any real hardware, other than the host PC

that you run it on. Instead, you create a Virtual ECU (VECU) in software that simulates the real-life devices such as switches or sensors that will be present in your physical ECU.

Page 9: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 9

Vitual Devices, Actions and Events

VECUs use “virtual devices” to get things done. Virtual Devices have actions and events.

One can pass values to the virtual device from an external application like vrtaMonitor or a 3rd party application to the VECU using Actions and get values from the VECU to an external

application using Events.

Fig 1 Virtual Device / Actions / Events

1.3 Conventions

The following typographical conventions are used in this document:

OCI_CANTxMessage msg0 = Code snippets are presented on a gray background and in

the Courier font.

Meaning and usage of each command are explained by means of comments. The comments are enclosed by the

usual syntax for comments.

Choose File Open. Menu commands are shown in boldface.

Click OK. Buttons are shown in boldface.

Press <ENTER>. Keyboard commands are shown in angled brackets.

The "Open File" dialog box is

displayed.

Names of program windows, dialog boxes, fields, etc. are

shown in quotation marks.

Select the file setup.exe Text in drop-down lists on the screen, program code, as well as path- and file names are shown in the Courier font.

A distribution is always a one-dimensional table of sample

points.

General emphasis and new terms are set in italics.

Page 10: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 10

2 Sending / Receiving the values through VRTA Monitor

Fig 9 VRTA CAN Driver device in VECU

The above diagram shows the available actions and events in the device “CAN Device”. The actions and events were explained before in section 2.3 and 2.4.

2.1 Connecting the VRTA Monitor

Assume that, Your VECU is compiled and running successfully.

By clicking the VrtaMonitor.exe, you will see the VRTA Monitor window as shown below.

Page 11: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 11

Fig 4 General snapshot of VRTA Monitor

Add a new host name/IP address by clicking the File->Add New Host option as shown below.

Fig 5 VRTA Monitor to add the host name.

Then add the new host / IP Address by clicking the host option as shown in the below snapshot.

Page 12: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 12

Fig 6 VRTA Monitor about where to add the host name.

Right click on the host name appears at the left side and connect it. Then it will automatically request the VRTA server in the background and displays the available VECU’s

in the host machine assuming that VECU must be running in order for the VRTA Monitor to detect the VECU. You should be seeing the VECU name in the VRTA Monitor as shown

below.

Page 13: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 13

Fig 7 VRTA Monitor showing the VECU name

Expand the VECU listed to view the available devices in it as shown below.

Fig 8 VRTA Monitor displaying the devices inside the VECU

2.2 Running the Virtual ECU using ISOLAR-EVE

It is like a normal VECU Build where we can debug the VRTA code as well.

Before Connecting to the Vrta, make sure that the VECU is built, deployed and running

successfully. If you are running through the ISOLAR, You will see the ISOLAR Window as shown below.

Page 14: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 14

Fig 2 Snapshot showing that VECU is running successfully.

Below, Internal Web Browser window of ISOLAR-EVE shows that the VECU is started and running successfully.

Page 15: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 15

Fig 3 log showing that VECU is running successfully

Note: CAN Device is used here as an example. The procedure shall be the same across all

other virtual devices.

2.3 Sending the Values (Actions)

User can send values from the VECU to an external Application like vrtaMonitor or a 3rd party

Page 16: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 16

Fig 10 Sending values through VrtaMonitor

Right click on the each action available below the CAN DriverDevice device to enter the

parameters and use Send option to send the values through VrtaMonitor.

2.4 Receiving the values through polling / hooking (Events)

User can get values from the VECU to an external Application like vrtaMonitor or a 3rd party

Event Polling

Right click on an event available below the CAN DriverDevice device, enter the parameters

(if available) and use Read option for receiving the values through VRTA.

Page 17: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 17

Fig 11 Receiving the values through VrtaMonitor Polling

Event Hooking

Right click on event available below the CAN DriverDevice device and enable the Monitor

option. Once enabled you can switch to Monitor option on the bottom of the Screen. While executing the CAN DriverIdlehandler, it will raise the RaiseInjectedEvents () method. In that,

you can see the Event being raised through hooking to update result and status. That would be displayed on the Monitor screen.

Page 18: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 18

3 VRTA PORT Device

3.1 VRTA Port Overview

The VRTA Port is a virtual device that can be used for setting the Port Pin Direction, Port Pin Mode, and to refresh the Port pins. It will support mainly AUTOSAR functionalities as

mentioned below.

Port_SetPinDirection

Port_SetPinMode

Port_RefreshPortDirection

3.2 Access Synchronizable VRTA Port Using C++ Methods

In the VRTA Port, Each channel is linked to virtual pins available. The current request status

(like SetPinDirection, SetPinMode) can be displayed in the vrta Monitor by hooking the proxy APIs in the MCAL. Error notification can be identified by hooking the proxy APIs in the MCAL.

Method: eveVrtaPort ()

The constructor.

Method declaration:

eveVrtaPort::eveVrtaPort(const vrtaTextPtr name,vrtaUInt MaxPins)

Parameters:

Parameter Input/Output Description

Name Input The name of the virtual

device.

MaxPins Input Total Number of Port Pins.

Description:

This is the constructor used to create an instance of a VRTA Port device.

Return values:

Value Description

<none>

Method: UpdateportDetErrors ()

Update the DET Errors , if any.

Method declaration:

Void UpdateportDetErrors(uint8 det)

Parameters:

Parameter Input/Output Description

det Input It will update the DET Errors , if any.

Description:

This method is used to update the DET Errors by raising an event, if any.

Page 19: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 19

Return values:

Value Description

<none>

Method: UpdateportCurrentJob ()

Update the current job like Set Pin Direction / Mode / Refresh Port.

Method declaration:

Void UpdateportCurrentJob(uint8 job)

Parameters:

Parameter Input/Output Description

job Input Update the Current job information

Description:

This method will update the current job information.

Return values:

Value Description

<none>

Method: UpdateCurrentJob ()

It is used to call the AUTOSAR APIs when the Os is in Idle.

Method declaration:

Void PortIdleHandler()

Parameters:

Parameter Input/Output Description

<None>

Description:

This method will raise the AUTOSAR APIs when the Os is in Idle.

Return values:

Value Description

<none>

3.3 Actions

User can pass values to the VRTA Port device from an external application like vrtaMonitor or

a 3rd party application to the VECU using Actions.

Each action supported by a VRTA Port device is described by a standard table, as below, followed by

text to explain the purpose of the action or event.

ID Data Format

Page 20: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 20

XXXX YYYY

The table contains the numeric ID of the action or event (XXXX), and the format of the

action or event data (YYYY).

Below are the Actions that are supported by the VRTA Port

3.3.1 InjectedPortpinDirection

Action

ID

Data Format

1 %u, PORT_PIN_IN | PORT_PIN_OUT

This action buffers the input parameters like port pin number and information about whether

the port pin should be IN or OUT. The PortIdleHandler will process the buffered values when

the OS is in Idle state. The first number in the action data is the port pin number and the second number is the PORT_PIN_IN or PORT_PIN_OUT.

2.3.2 InjectedRefreshPortDirection

Action

ID

Data Format

2 <None>

This action will refresh all the port pins to reflect any changes in the pin direction.

3.3.3 InjectedSetPinMode

Action ID Data Format

3 %u,%u Mode0-PORT_PIN_MODE_ADC

1-PORT_PIN_MODE_CAN

2-PORT_PIN_MODE_FLEXRAY 3-PORT_PIN_MODE_LIN

4-PORT_PIN_MODE_DIO 5-PORT_PIN_MODE_ICU

6-PORT_PIN_MODE_PWM

This action buffers the input parameter like Port pin number and mode. The PortIdleHandler will process the buffered values when the OS is in Idle state. The first number in the action

data is the Port pin number and the second parameter is the mode. It could be something like above mentioned modes.

3.4 Events

User can get values from the VECU to an external Application like vrtaMonitor or a 3rd party

application using Events. There are two ways of doing this

1. Event Polling

Event Polling – External application can poll the events in a vrtadevice to get the value of

the event at that particular time.

For More information about Event hooking and Event Polling, refer the VRTA User Guide.

Below are the Events that are supported by the VRTA Port

Page 21: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 21

3.4.1 CurrentJob

Event

ID

Data Format

1 Macros

* Macros – None | SETPINDIRECTION | SETPINMODE | REFRESHDIRECTION

This event is raised when there is a change in the current request (current job).

3.4.2 DETErrors

Event ID

Data Format

2 Macros

*Macros- None | PORT_E_PARAM_PIN | PORT_E_DIRECTION_UNCHANGEABLE | PORT_E_PARAM_CONFIG | PORT_E_PARAM_INVALID_MODE | PORT_E_MODE_UNCHANGEABLE| PORT_E_UNINIT | PORT_E_PARAM_POINTER

This event is raised when there are any errors (only Development Error Tracer) or there is a change in the previous event value.

Page 22: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 22

4 VRTA DIO Device

4.1 VRTA DIO Overview

The DIO driver provides port and channel based read and write access to the internal

general purpose Input/Output ports. The read and write behavior is not buffered. The basic

behavior of the driver is synchronous.

The DIO Driver provides services from reading and writing to and from the following

DIO Channel – Represents a single general purpose digital I/O pin

DIO Port – Represents multiple DIO channels that are grouped by hardware and

accessible synchronously (controlled by one hardware register)

DIO Channel group – Represents multiple adjoining DIO channels represented by a

logical group. It is a subset of one DIO port. It is also accessed synchronously

The behaviors of the DIO services are synchronous. This module works on pins and ports which are

configured by the PORT driver for this purpose.

DIO Device is the Parent device and has a DIOPort device as its child

DIOPort device has a DIOGroup device as its child device

Dio port device is generated automatically for each Dio port configuration and DIO Group device is

generated automatically for each Channel Group Configuration. This allows users to access the ports

without specifying the port Numbers.

4.2 Actions

User can pass values to the VRTA DIO device from an external application like vrtaMonitor or

a 3rd party application to the VECU using Actions.

Below are the Actions that are supported by the VRTA DIO

4.2.1 Write Channel

Requests to set the level of a channel.

Input Parameters

%u - Channel Number

%u - Value in the channel (0 or 1)

Raised Events:

(%u) Channel Written – This event is raised number when a new value is written into a Channel. This

event returns the Channel Number.

Page 23: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 23

4.2.2 Flip Channel

Requests to flip the level of a Channel.

Input Parameters

%u - Channel Number

Raised Events:

(%u) Channel Written – This event is raised when a new value is written into a Channel. This event returns the Channel Number.

4.2.3 Write Port

Requests to set the value of a Port.This action is provided in the DIO Port device.

Input Parameters

%x - The value that needs to be written in the port

Raised Events:

(%u) Port Written – This event is raised when a new value is written into a port. This event returns

the Port Number.

4.2.4 Write Channel Group

Requests to set the value of a Channel Group. This action is provided in the DIO Group device.

Input Parameters

%x - The value that needs to be written in the Channel Group

Raised Events:

(%u) Channel Group Written – This event is raised when a new value is written into a Channel Group.

This event returns the Channel Group Number.

4.3 Events

User can get values from the VECU to an external Application like vrtaMonitor or a 3rd party

application using Events. There are two ways of doing this

2. Event Polling

3. Event Hooking

Page 24: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 24

Event Polling – External application can poll the events in a vrtadevice to get the value of

the event at that particular time.

Event Hooking – External application can also get notified automatically of some change in

state/value by raising an event.

Below are the Events that are supported by the VRTA DIO

4.3.1 Read Channel

(%u) ReadChannel (%u)

A channel number is passed as an input and the channel pin level is returned. This is a polling event.

4.3.2 Channel Written

(%u) ChannelGroupWritten

This Event will be raised with a Channel Group number that was written.

4.3.3 DET Errors

DETErrors (Enum)

<INVALID_CHANNEL_ID | INVALID_PORT_ID | INVALID_GROUP_ID |PARAM_CONFIG_ERROR |PARAM_POINTER_ERROR >

This Event will be raised from the MCAL when it reports an error.

4.3.4 Port Written

(%u) PortWritten

This Event will be raised with the port number that was written

4.3.5 Channel Group Written

(%x) ReadChannelGroup (%u)

A Channel Group number is passed as an input and the Channel Group pin levels are

returned in hex. This is a polling event.

Page 25: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 25

5 VRTA PWM Device

5.1 VRTA Pwm Overview

The VRTA Pwm is a virtual device that can be used for setting the DutyCycle, Period, output to idle ,

getting the output state, Enable and Disable the Notification. It will support mainly AUTOSAR

functionalities as mentioned below.

Pwm_SetDutyCycle

Pwm_SetPeriodAndDuty

Pwm_SetOutputToIdle

Pwm_GetOutputState

Pwm_DisableNotification

Pwm_EnableNotification

5.2 Access Synchronizable VRTA Pwm Using C++ Methods

In the VRTA Pwm, Each channel is linked to virtual pins available. The current request status

(like SetDutyCycle, SetPeriodandDuty) can be displayed in the vrta Monitor by hooking the proxy APIs

in the MCAL. Error notification can be identified by hooking the proxy APIs in the MCAL.

Method: eveVrtaPwm ()

The constructor.

Method declaration:

eveVrtaPwm (const vrtaTextPtr name, vrtaUInt NumberofChannels)

Parameters:

Parameter Input/Output Description

Name Input The name of the

virtual device.

NumberofChannels Input Total Number of Channels

Description:

This is the constructor used to create an instance of a VRTA Pwm device.

Return values:

Value Description

<none>

Method: UpdateJobResult ()

Update the Job Result.

Page 26: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 26

Method declaration:

void UpdateJobResult(uint8 return_val)

Parameters:

Parameter Input/Output Description

return_val Input It will update the result of the

job, if any.

Description:

This method is used to update the job result by raising an event, if any.

Return values:

Value Description

<none>

Method: UpdateDetErrors ()

Update the DET Errors

Method declaration:

Void UpdateDetErrors(uint8 det)

Parameters:

Parameter Input/Output Description

det Input Update the DET Errors, if any

Description:

This method will update the DET Errors, if any.

Return values:

Value Description

<none>

Method: UpdateCurrentJob ()

Update the current job

Method declaration:

Void UpdateCurrentJob(uint8 job)

Parameters:

Parameter Input/Output Description

job Input It will update the current job.

Description:

This method will give the current job information by raising an event.

Return values:

Value Description

<none>

Method: PwmIdleHandler ()

Used to call the AUTOSAR APIs when the OS is in Idle.

Page 27: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 27

Method declaration:

Void PwmIdleHandler(void)

Parameters:

Parameter Input/Output Description

<none>

Description:

This method gets called from software when it is in Idle state. This is used to route the call

to Proxy MCAL.

Return values:

Value Description

<none>

5.3 Actions

User can pass values to the VRTA Pwm device from an external application like vrtaMonitor

or a 3rd party application to the VECU using Actions.

Each action supported by a VRTA Pwm device is described by a standard table, as below, followed by

text to explain the purpose of the action or event.

ID Data Format

XXXX YYYY

The table contains the numeric ID of the action or event (XXXX), and the format of the

action or event data (YYYY).

Below are the Actions that are supported by the VRTA Pwm

5.3.1 InjectedDutyCycle

Action ID

Data Format

1 %u,%x:;0;32768

This action buffers the input parameters like channel number and Dutycycle. The PwmIdleHandler will process the buffered values when the OS is in Idle state. The first

number in the action data is the channel number and the second number is the Dutycycle.

2.3.2 InjectedPeriodandDutyCycle

Action

ID

Data Format

2 %u,%u,%x:;0;32768

This action buffers the input parameters like channel number, Period and Dutycycle. The

PwmIdleHandler will process the buffered values when the OS is in Idle state. The first

Page 28: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 28

number in the action data is the channel number, second number is the Period and the third

is the Dutycycle.

5.3.2 InjectedOutputToIdle

Action ID

Data Format

3 %u

This action buffers the input parameter like channel number. The PwmIdleHandler will process the buffered values when the OS is in Idle state. The first number in the action data

is the channel number.

5.3.3 InjectedOutputState

Action

ID

Data Format

4 %u

This action buffers the input parameter like channel number. The PwmIdleHandler will process the buffered values when the OS is in Idle state. The first number in the action data

is the channel number.

5.3.4 InjectedEnableNotification

Action

ID

Data Format

5 %u,%u 0-PWM_FALLING_EDGE,1-PWM_RISING_EDGE,2- PWM_BOTH_EDGES

This action buffers the input parameter like channel number. The PwmIdleHandler will process the buffered values when the OS is in Idle state. The first number in the action data

is the channel number. The Notification parameter could be PWM_FALLING_EDGE, PWM_RISING_EDGE, PWM_BOTH_EDGES.

5.3.5 InjectedDisableNotification

Action

ID

Data Format

6 %u

This action buffers the input parameter like channel number and Notification Parameter. The

PwmIdleHandler will process the buffered values when the OS is in Idle state. The first number in the action data is the channel number.

5.4 Events

User can get values from the VECU to an external Application like vrtaMonitor or a 3rd party

application using Events. There are two ways of doing this

4. Event Polling

5. Event Hooking

Event Polling – External application can poll the events in a vrtadevice to get the value of

the event at that particular time.

Page 29: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 29

Event Hooking – External application can also get notified automatically of some change in

state/value by raising an event.

Below are the Events that are supported by the VRTA Pwm

5.4.1 Result

Event

ID

Data Format

1 Macros

*Macros – None|STD_LOW|STD_HIGH

This event is raised when there is a change in the result of the action. However, only one result in vrta-pwm. (i.e) GetoutputState.

5.4.2 CurrentJob

Event

ID

Data Format

2 Macros

* Macros – None|SetDutyCycle|SetPeriodandDutyCycle|SetOutputToIdle|GetOutputState|

EnableNotification|DisableNotification

This event is raised when there is a change in the current request (current job) of the actions.

5.4.3 DETErrors

Event ID

Data Format

3 Macros

*Macros-None|PWM_E_UNINIT|PWM_E_PARAM_CHANNEL|PWM_E_UNCHANGEABLE|INVALID|PARAM_E_POINTER

This event is raised when there are any errors (only Development Error Tracer errors) or there is a change in the previous event value.

5.4.4 InjectedResult

Event

ID

Data Format

4 None|STD_LOW|STD_HIGH

This event is raised while performing the operation like getoutput state to update the event

being performed by the user.

Page 30: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 30

6 VRTA ICU Device

6.1 VRTA ICU Overview

The VRTA - ICU is a virtual device provides services for demodulation of a PWM signal,

counting pulses, measuring of frequency and duty cycle, generating simple interrupts and also

wakeup interrupts.

It also provides services for Signal notification, Controlling wakeup interrupts, Periodic

signal time measurement, Edge time stamping, usable for the acquisition of non-periodic

signals, Edge Counting.

This ICU module pins have 2 modes:

o ICU_MODE_NORMAL

o ICU_MODE_SLEEP

6.2 Access Synchronizable VRTA ICU Using C++ Methods

The VRTA ICU works on so called ICU Channel.

Method: eveVrtaIcu ()

The constructor.

Method declaration:

eveVrtaIcu (const vrtaTextPtr name)

Parameters:

Parameter Input/Output Description

name Input The name of the virtual device.

Description:

This is the constructor used to create an instance of a VRTA ICU device.

Return values:

Value Description

<none>

Method: UpdateIcuDetErrors (uint8 det)

Update the DET Errors.

Method declaration:

void UpdateIcuDetErrors (uint8 det)

Parameters:

Parameter Input/Output Description

det Input It will update the DET of the

job.

Page 31: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 31

Description:

This method is used to update the DET value by raising an event.

Return values:

Value Description

<none>

Method: Update_IcuMode (uint8 Mode)

Update the ICU Mode

Method declaration:

Void Update_IcuMode (uint8 Mode)

Parameters:

Parameter Input/Output Description

icuchannelMode Input Update the Mode.

Description:

This method updates the ICU Mode.

Return values:

Value Description

<none>

Method: Update_icuCheckwakeup (EcuM_WakeupSourceType icu_wakeup)

Update the wakeup source information

Method declaration:

Void Update_icuCheckwakeup (EcuM_WakeupSourceType icu_wakeup)

Parameters:

Parameter Input/Output Description

icu_wakeup Input Update the wakeup source

information.

Description:

This method will update the wakeup source information.

Return values:

Value Description

<none>

Method: Icu_IdleHandler ()

Used to call the AUTOSAR functionalities when the OS is in Idle.

Method declaration:

Void Icu_IdleHandler ()

Parameters:

Parameter Input/Output Description

<None>

Description:

This method will call the AUTOSAR functionalities when the OS is in Idle.

Page 32: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 32

Return values:

Value Description

<none>

6.3 Actions

User can pass values to the VRTA ICU device from an external application like VRTA Monitor

or a 3rd party application to the VECU using Actions.

Each action supported by a VRTA ICU device is described by a standard table, as below, followed by

text to explain the purpose of the action or event.

ID Data Format

XXXX YYYY

The table contains the numeric ID of the action or event (XXXX), and the format of the

action or event data (YYYY).

Below are the Actions that are supported by the VRTA ICU

6.3.1 Init

Action

ID

Data Format

1 <None>

This action is used to call the Icu_Init().

6.3.2 De-Init

Action ID

Data Format

2 <None>

This action is used to call the Icu_De-Init().

6.3.3 SetMode

Action ID

Data Format

3 %u

0-Normal

1-Sleep

The action will set the ICU Pin modes to either Normal or Sleep.

Page 33: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 33

6.3.4 DisableWakeup

Action

ID

Data Format

4 %u

The action will disable the Wakeup if it is configured as wakeup capable true.

6.3.5 EnableWakeup

Action

ID

Data Format

5 %u

The action will enable the Wakeup if it is configured as wakeup capable true.

6.3.6 SetActivationCondition

Action ID

Data Format

6 %u, %u

0-Rising Edge

1-Falling Edge

2-Both Edges

The action will set the activation parameter for the given ICU channel. The first argument

is channel number and the second argument is activation parameter. It could be

ICU_RISING_EDGE,ICU_FALLING_EDGE,ICU_BOTH_EDGES.

6.3.7 DisableNotification

Action

ID

Data Format

7 %u

The action will disable the channel Notification for a channel. The only argument is channel

number.

6.3.8 EnableNotification

Action

ID

Data Format

8 %u

The action will enable the channel Notification for a channel. The only argument is channel

number.

6.3.9 ResetEdgeCount

Action ID

Data Format

9 %u

The action will reset the edge count of an ICU channel. The only argument is channel number.

Page 34: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 34

6.3.10 EnableEdgeCount

Action

ID

Data Format

10 %u

The action will enable the edge count of an ICU channel. The only argument is channel number.

6.3.11 EnableEdgeDetection

Action ID

Data Format

11 %u

The action will enable the edge detection of an ICU channel. The only argument is channel number.

6.3.12 DisableEdgeDetection

Action

ID

Data Format

12 %u

The action will disable the edge detection of an ICU channel. The only argument is channel

number.

6.3.13 DisableEdgeCount

Action

ID

Data Format

13 %u

The action will disable the edge count of an ICU channel. The only argument is channel

number.

6.3.14 StartSignalMeasurement

Action

ID

Data Format

14 %u

The action will start the signal measurement of an ICU channel. The only argument is channel number.

6.3.15 StopSignalMeasurement

Action ID

Data Format

15 %u

The action will stop the signal measurement of an ICU channel. The only argument is channel number.

Page 35: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 35

6.4 Events

User can get values from the VECU to an external Application like vrtaMonitor or a 3rd party

application using Events. There are two ways of doing this

6. Event Polling

7. Event Hooking

Event Polling – External application can poll the events in a vrtadevice to get the value of

the event at that particular time.

Event Hooking – External application can also get notified automatically of some change in

state/value by raising an event.

For more information about the Polling and Hooking, Refer VRTA User Guide.

Below are the Events that are supported by the VRTA ICU

6.4.1 DETErrors

Event ID

Data Format

1 %u

This event is raised when there is a change in the DET.

6.4.2 InputState

Event

ID

Data Format

2 None|ICU_CHANNEL_ACTIVE|ICU_CHANNEL_IDLE

This event is raised to update the ICU channel status. It could be Active or Idle.

6.4.3 Mode

Event ID Data Format

3 None|NORMAL|SLEEP

This event is raised to update the ICU Mode. It could be Normal or Sleep.

6.4.4 EdgeNumbers

Event ID Data Format

4 %u(%u)

This event is raised to update the ICU channel Edge Numbers.

6.4.5 TimeElapsed

Event ID Data Format

5 None|LOW_TIME|HIGH_TIME|ACTIVE_TIME|PERIOD_TIME (%u)

This event is raised to update the ICU channel Time Elapsed.

Page 36: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 36

6.4.6 DutyCycleValues

Event

ID

Data Format

6 %u

This event is raised to update the ICU channel Duty Cycle values.

6.4.7 CheckWakeupStatus

Event ID

Data Format

7 %u

This event is raised to update the ICU channel Wakeup source information.

Page 37: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 37

7 VRTA ADC Device

7.1 VRTA ADC Overview

The VRTA Adc is a virtual device that can be used for controlling the internal

Analogue Digital Converter of the micro controller. It provides services to start and stop a conversion

respectively to enable and disable the trigger source for a conversion. Furthermore, it provides

services to enable and disable a notification mechanism and routines to query the status and result of

a conversion. It will support mainly AUTOSAR functionalities mentioned below.

1) SetupResultBuffer 2) StartGroupConversion

3) StopGroupConversion

4) ReadGroup 5) EnableHardwareTrigger

6) DisableHardwareTrigger 7) EnableGroupNotification

8) DisableGroupNotification 9) GetGroupStatus

10) GetStreamLastPointer

11) GetVersionInfo

7.2 Access Synchronizable VRTA Adc Using C++ Methods

The VRTA Adc works on so called ADC Channel Groups, which are build from so called ADC

Channels. An ADC Channel Group combines as analogue input pin (ADC Channel), the needed ADC

circuitry itself and conversion result register into an entity that can be individually controller and

accessed via ADC Vrta module.

Method: eveVrtaAdc ()

The constructor.

Method declaration:

eveVrtaAdc (const vrtaTextPtr name, AdcGroup str[])

Parameters:

Parameter Input/Output Description

name Input The name of the virtual

device.

Str[] Input The structure which contains the information about the

streaming samples and channels present in a group.

Description:

This is the constructor used to create an instance of a VRTA Adc device and to get the

information about the streaming samples of an each group channel.

Page 38: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 38

Return values:

Value Description

<none>

Method: UpdateJobResult ()

Update the Job Result.

Method declaration:

void UpdateJobResult(vrtaUInt return_val)

Parameters:

Parameter Input/Output Description

return_val Input It will update the result of the job.

Description:

This method is used to update the job result by raising an event. (It could be either zero or

one. If it is success, it will return zero. Otherwise, it would return one)

Return values:

Value Description

<none>

Method: UpdateValidSamples ()

Update the valid samples

Method declaration:

Void UpdateValidSamples(uint8 samples)

Parameters:

Parameter Input/Output Description

samples Input Update the valid samples of

the group channel

Description:

This method updates the valid samples of the group channel. It may be 0,1,2… depends on

the user configuration

Return values:

Value Description

<none>

Method: UpdateadcStatus ()

Update the adc status

Method declaration:

Void UpdateadcStatus(Adc_StatusType status)

Parameters:

Parameter Input/Output Description

status Input Update the status, if any

change in the previous state.

Page 39: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 39

Description:

This method will update the status, if any. It could be Busy, Idle, and Conversion Completed

like that.

Return values:

Value Description

<none>

Method: UpdateCurrentJob ()

Update the current job

Method declaration:

Void UpdateCurrentJob(uint8 job)

Parameters:

Parameter Input/Output Description

job Input It will update the current job.

Description:

This method will give the current job information by raising an event. It could be Start Conversion, Stop Conversion, Enable Notification, and Disable Notification like that.

Return values:

Value Description

<none>

Method: ExecuteJob ()

Used to update the DET Errors, if any

Method declaration:

Void UpdateDetErrors(uint8 det)

Parameters:

Parameter Input/Output Description

det Input Used to update the DET, if any

Description:

This method will update the DET Errors. It will be showed as Enumerations type in the Vrta

Monitor.

Return values:

Value Description

<none>

Method: printfinfo_ReadGroup ()

Used to print the Read Group information

Method declaration:

Void printfinfo_ReadGroup()

Parameters:

Parameter Input/Output Description

<none>

Page 40: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 40

Description:

This method is used to print the read group information’s. It would be the conversion values

of the group channel.

Return values:

Value Description

<none>

Method: printfinfo_GetLastpointer ()

Used to print the get stream last pointer information’s

Method declaration:

Void printfinfo_GetLastpointer(Adc_ValueGroupType* ptrsam)

Parameters:

Parameter Input/Output Description

ptrsam of type Adc_ValueGroupType*

Input Used to print the get stream last

pointer information’s

Description:

This method is used to print the get stream last pointer information’s.

Return values:

Value Description

<none>

Method: RaiseInjectedEvents ()

Used to raise the Injected events.

Method declaration:

Void RaiseInjectedEvents ()

Parameters:

Parameter Input/Output Description

<None>

Description:

This method is used to raise the injected events. It could be Injected valid sample, Injected

Result, Injected Status.

Return values:

Value Description

<none>

Method: AdcIdleHandler ()

Used to raise the AUTOSAR API call when the Os is in Idle.

Page 41: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 41

Method declaration:

Void AdcIdleHandler ()

Parameters:

Parameter Input/Output Description

<None>

Description:

This method is used to raise the AUTOSAR API call when the Os is in Idle.

Return values:

Value Description

<none>

7.3 Actions

User can pass values to the VRTA Adc device from an external application like vrtaMonitor or

a 3rd party application to the VECU using Actions.

Each action supported by a VRTA Adc device is described by a standard table, as below, followed by

text to explain the purpose of the action or event.

ID Data Format

XXXX YYYY

The table contains the numeric ID of the action or event (XXXX), and the format of the

action or event data (YYYY).

Below are the Actions that are supported by the VRTA Adc

7.3.1 InjectedSetupResultBuffer

Action

ID

Data Format

1 %u

The action sets up the buffer for storing the conversion values. The only argument is group

channel number.

7.3.2 InjectedStartGroupConversion

Action ID

Data Format

2 %u

The action will start the conversion for a group channel. The only argument is group channel number.

Page 42: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 42

7.3.3 InjectedStopGroupConversion

Action

ID

Data Format

3 %u

The action will stop the conversion for a group channel. The only argument is group channel number.

7.3.4 InjectedEnableHardwareTrigger

Action ID

Data Format

4 %u

The action will enable the Hardware Triggger for a group channel. The only argument is group channel number.

7.3.5 InjectedDisableHardwareTrigger

Action

ID

Data Format

5 %u

The action will disable the Hardware Triggger for a group channel. The only argument is

group channel number.

7.3.6 InjectedEnableGroupNotification

Action

ID

Data Format

5 %u

The action will Enable the Group Notification for a group channel. The only argument is

group channel number.

7.3.7 InjectedDisableGroupNotification

Action

ID

Data Format

5 %u

The action will disable the Group Notification for a group channel. The only argument is group channel number.

7.3.8 InjectedReadGroup

Action ID

Data Format

5 %u

The action will read the group values for a group channel. The only argument is group

channel number.

7.3.9 InjectedGetStreamLastPointer

Action

ID

Data Format

5 %u

Page 43: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 43

The action will get the stream last pointer for a group values for a group channel. The only

argument is group channel number.

7.3.10 InjectedGetGroupStatus

Action ID

Data Format

5 <none>

The action will get the group status. (It could be idle, busy and stream completed) for a group channel. The only argument is group channel number.

7.4 Events

User can get values from the VECU to an external Application like vrtaMonitor or a 3rd party

application using Events. There are two ways of doing this

8. Event Polling

9. Event Hooking

Event Polling – External application can poll the events in a vrtadevice to get the value of

the event at that particular time.

Event Hooking – External application can also get notified automatically of some change in

state/value by raising an event.

For more information about the Polling and Hooking, Refer VRTA User Guide.

Below are the Events that are supported by the VRTA Adc

7.4.1 Result

Event ID

Data Format

1 %u

This event is raised when there is a change in the result.

7.4.2 ValidSample

Event ID

Data Format

2 %u

This event is raised when there is a change in the validSample.

7.4.3 Status

Event ID Data Format

Page 44: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 44

3 None|ADC_IDLE|ADC_BUSY|ADC_COMPLETED|ADC_STREAM_COMPLETED

This event is raised when there is a change in the status. It would be enumeration as

mentioned in the above table.

7.4.4 CurrentJob

Event ID Data Format

4 None|SETUPRESULTBUFFER|STARTGROUPCONVERSION|

STOPGROUPCONVERSION|ENABLEHARDWARETRIGGER|DISABLEHARDWARETRIGGER|ENABLEGROUPNOTIFICATI

ON|DISABLEGROUPNOTIFICATION|READGROUP|GETSTREAMLASTPOINTER|GETGROUPSTATUS

This event is raised when there is a change in the current job. It would be enumeration as

mentioned in the above table.

7.4.5 DETErrors

Event ID Data Format

5 None|ADC_E_UNINIT|ADC_E_BUSY|ADC_E_IDLE|ADC_E_ALREADY_INITIALIZED|ADC_E_PARAM_CONFIG|ADC_E

_PARAM_POINTER|ADC_E_PARAM_GROUP|ADC_E_WRO

NG_CONV_MODE|ADC_E_WRONG_TRIGG_SRC|ADC_E_NOTIF_CAPABILITY|ADC_E_BUFFER_UNINIT

This event is raised when there is any DET Errors. It would be enumeration as mentioned in

the above table.

7.4.6 InjectedResult

Event

ID

Data Format

6 %u

This event is raised when there is a change in the result of the Injected actions. It would be

enumeration as mentioned in the above table.

7.4.7 InjectedValidSample

Event

ID

Data Format

7 %u

This event is raised when there is a change in the valid sample of an injected action.

7.4.8 InjectedStatus

Event ID

Data Format

8 %u

This event is raised when there is a change in the status of an injected action.

Page 45: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 45

8 VRTA CAN Device

8.1 VRTA Can Overview

The CAN Driver is a virtual device, which adapts the signal levels that are used

on the CAN bus to the logical (digital) signal levels recognized by a microcontroller. It will support

mainly AUTOSAR functionalities mentioned below.

1) CanInit

2) CanInitController 3) CanSetControllerMode

4) CanDisableControllerInterrupts

5) CanEnableControllerInterrupts 6) CanCheckWakeup

7) CanWrite 8) CanMainFunction_Write

9) CanMainFunction_Read 10) CanMainFunction_BusOff

11) CanMainFunction_Wakeup

12) CanMainFunction_Mode

8.2 Actions

User can pass values to the VRTA CAN Driver device from an external application like

vrtaMonitor or a 3rd party application to the VECU using Actions.

Each action supported by a VRTA CAN Driver device is described by a standard table, as below,

followed by text to explain the purpose of the action or event.

ID Data Format

XXXX YYYY

The table contains the numeric ID of the action or event (XXXX), and the format of the

action or event data (YYYY).

8.2.1 CanInit

Action

ID

Data Format

1 <CAN_VALID_ARGUMENTS|CAN_ALREADY_INIT_CHECK|CAN_NULL_POINTER_CHECK>

The action calls the Can_Init function that initializes the module.

8.2.2 Can_InitController

Action ID

Data Format

Page 46: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 46

2 %u, %u, <CAN_EXT|CAN_MIXED|CAN_STD,HIGH|LOW>

The action initializes the bit timing related settings of a CAN controller.

8.2.3 Can_SetControllerMode

Action ID

Data Format

3 %u,

<CAN_STOP|CAN_START|CAN_SLEEP|CAN_WAKEUP|CAN_EXIT|INVALID_MODE>

This action performs software triggered state transitions of the CAN controller State machine.

8.2.4 CanDisableControllerInterrupts

Action

ID

Data Format

4 %u

The action disables all interrupts for this CAN controller.

8.2.5 CanEnableControllerInterrupts

Action

ID

Data Format

5 %u

The action enables all allowed interrupts.

8.2.6 CanCheckWakeup

Action ID

Data Format

6 %u

The action checks if a wakeup has occurred for the given controller.

8.2.7 CanWrite

Action

ID

Data Format

7 %u,%u,%u,%a

The action Can_Write first checks if the hardware transmit object that is identified by the

HTH is free and if another Can_Write is ongoing for the same HTH. It returns CAN_OK if

the hardware transmit object is free. It returns CAN_BUSY if the hardware transmit object is busy with other transmit request.

8.2.8 CanMainFunction_Write

Action ID

Data Format

8 No Arguments

This action performs the polling of TX confirmation and TX cancellation confirmation when

Page 47: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 47

CAN_TX_PROCESSING is set to POLLING.

8.2.9 CanMainFunction_Read

Action

ID

Data Format

9 No Arguments

The action performs the polling of RX indications when CAN_RX_PROCESSING is set to POLLING.

8.2.10 CanMainFunction_BusOff

Action ID

Data Format

10 No Arguments

The action performs the polling of bus-off events that are configured statically as 'to be

polled'.

8.2.11 CanMainFunction_Wakeup

Action ID

Data Format

11 No Arguments

The action performs the polling of wake-up events that are configured statically as 'to be

polled'.

8.2.12 CanMainFunction_Mode

Action

ID

Data Format

12 No Arguments

The action performs the polling of CAN controller mode transitions.

Page 48: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 48

8.3 Events

User can get values from the VECU to an external Application like vrtaMonitor or a 3rd party

application using Events. There are two ways of doing this

10. Event Polling

11. Event Hooking

Event Polling – External application can poll the events in a vrtadevice to get the value of

the event at that particular time.

Event Hooking – External application can also get notified automatically of some change in

state/value by raising an event.

For more information about the Polling and Hooking, Refer VRTA User Guide.

Below are the Events that are supported by the VRTA Can

8.3.1 CanControllerStatus

Event

ID

Data Format

1 %u

This event is raised when there is a change in the status.

Returns CAN_OK if status change request accepted and returns CAN_NOT_OK if a development error occurred

8.3.2 CanWriteStatus

Event

ID

Data Format

2 < CAN_OK|CAN_NOT_OK|CAN_BUSY>

This event is raised when the function Can_Write performs write actions.

The event returns the status CAN_OK when write command has been accepted and

CAN_NOT_OK if a development error occurred and CAN_BUSY if there is No TX hardware buffer available or pre-emptive call of Can_Write that can't be implemented re-entrant

8.3.3 Status

Event ID

Data Format

3 %u

Returns the state of the Can controller mode.

Page 49: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 49

8.3.4 CurrentJob

Event ID Data Format

4 <CAN_INT|CAN_MAINFUNCTION_WRITE|CAN_INITCONTROLLER|CAN_SETCONTROLLERMODE|CAN_DISABLECONTROLLERINTERRUPTS|CAN_ENABLECONTROLLERINTERRUPTS|CAN_WRITE|CAN_APIID_GETVERSIONINFO|CAN_MAINFUNCTION_READ|CAN_MAINFUNCTION_BUSOFF|CAN_MAINFUNCTION_WAKEUP >

This event is raised when there is a change in the action called. It would be enumeration as seen from the above table.

8.3.5 DETErrors

Event ID Data Format

5 <None|CAN_E_PARAM_POINTER|CAN_E_PARAM_HANDLE|CAN_E_PARAM_DLC|CAN_E_PARAM_CONTROLLER|CAN_E_UNINIT|CAN_E_TRANSITION>

This event is raised when there is a change in the DET error status. It would be

enumeration as mentioned in the above table.

8.3.6 DriverState

Event ID Data Format

6 < CAN_UNINIT|CAN_READY >

The event returns the CAN Driver state. Can module have two states CAN_UNINIT and

CAN_READY.

Page 50: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 50

9 VRTA CanTrcv Device

9.1 VRTA CanTrcv Overview

The CAN Transceiver is a virtual device, which adapts the signal levels that are

used on the CAN bus to the logical (digital) signal levels recognized by a microcontroller. It will

support mainly AUTOSAR functionalities mentioned below.

13) SetOpMode

14) GetOpMode 15) GetBusWuReason

16) SetWakeupMode

17) CheckWakeup 18) GetVersionInfo

Method: eveVrtaCanTrcv ()

The constructor.

Method declaration:

eveVrtaCanTrcv (const vrtaTextPtr name)

Parameters:

Parameter Input/Output Description

name Input The name of the virtual

device.

Description:

This is the constructor used to create an instance of a VRTA CanTrcv device

Return values:

Value Description

<none>

Method: CanTrcvIdleHandler ()

Used to raise the AUTOSAR API call when the Os is in Idle.

Method declaration:

Void CanTrcvIdleHandler ()

Parameters:

Parameter Input/Output Description

<None>

Description:

This method is used to raise the AUTOSAR API call when the Os is in Idle.

Return values:

Value Description

<none>

Page 51: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 51

Method: UpdateDetErrors ()

Updates the DET error status of all actions.

Method declaration:

Void UpdateDetErrors (uint8 det)

Parameters:

Parameter Input/Output Description

det input The hex value for the error code

Description:

This method is used to update the DET status of all actions or API calls in the module

Return values:

Value Description

<none>

Method: UpdateCanTrcvResult ()

Update the Result of an action

Method declaration:

Void UpdateCanTrcvResult(vrtaUInt return_val)

Parameters:

Parameter Input/Output Description

return_val Input Update the result, returned

after the call of an API.

Description:

This method will update the result of an API call or action. It could be E_OK or E_NOT_OK.

Return values:

Value Description

<none>

Method: UpdateCurrentJob ()

Update the current job

Method declaration:

Void UpdateCurrentJob(uint8 job)

Parameters:

Parameter Input/Output Description

job Input It will update the current job.

Description:

This method will give the current job information by raising an event. It could be any of the

AUTOSAR APIs defined for this module which are the actions in this design.

Return values:

Value Description

Page 52: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 52

<none>

Method: UpdateCurrentStatus ()

Update the current mode a transceiver is operating in.

Method declaration:

Void UpdateCurrentStatus (CanTrcv_TrcvModeType trcv_status)

Parameters:

Parameter Input/Output Description

trcv_status Input The operating mode of the

transceiver

Description:

This method will give the current status information of a transceiver by raising an event. It

could be any of the three operating modes i.e. NORMAL, STANDBY, and SLEEP

Return values:

Value Description

<none>

Method: UpdateWakeupMode ()

Update the wakeup mode a transceiver is currently in.

Method declaration:

Void UpdateWakeupMode (CanTrcv_TrcvWakeupModeType wu_mode)

Parameters:

Parameter Input/Output Description

wu_mode Input The wakeup mode of the

transceiver

Description:

This method will give the current wakeup mode of a transceiver by raising an event. It could be any of the three modes i.e. ENABLE, DISABLE, and CLEAR.

Return values:

Value Description

<none>

9.2 Actions

User can pass values to the VRTA CanTrcv device from an external application like

vrtaMonitor or a 3rd party application to the VECU using Actions.

Each action supported by a VRTA CanTrcv device is described by a standard table, as below, followed

by text to explain the purpose of the action or event.

ID Data Format

Page 53: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 53

XXXX YYYY

The table contains the numeric ID of the action or event (XXXX), and the format of the

action or event data (YYYY).

9.2.1 SetOpMode

Action

ID

Data Format

1 %u,%u

The action sets the transceiver to any one of the three operating modes. The arguments are the transceiver number and the Operating mode with values 0,1 and 2 .

Where,

0 represents CANTRCV_TRCVMODE_NORMAL

1 represents CANTRCV_TRCVMODE_SLEEP

2 represents CANTRCV_TRCVMODE_STANDBY

9.2.2 GetOpMode

Action

ID

Data Format

2 %u

The action will get the operating mode of the transceiver. The only argument is the transceiver number

9.2.3 GetBusWuReason

Action

ID

Data Format

3 %u

The action will get the reason for the wakeup call detected in a transceiver. The only argument is the transceiver number.

9.2.4 SetWakeupMode

Action ID

Data Format

4 %u,%u

The action will set a particular transceiver to a particular wakeup mode. The arguments are the transceiver number and the wakeup mode whose values are 0,1 and 2

Where,

0 represents CANTRCV_WUMODE_ENABLE

0 represents CANTRCV_WUMODE_DISABLE

0 represents CANTRCV_WUMODE_CLEAR

9.2.5 CheckWakeup

Action ID

Data Format

Page 54: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 54

5 %u

The action will be called if a wakeup interrupt is detected. The only argument is the

transceiver number.

9.3 Events

User can get values from the VECU to an external Application like vrtaMonitor or a 3rd party

application using Events. There are two ways of doing this

12. Event Polling

13. Event Hooking

Event Polling – External application can poll the events in a vrtadevice to get the value of

the event at that particular time.

Event Hooking – External application can also get notified automatically of some change in

state/value by raising an event.

For more information about the Polling and Hooking, Refer VRTA User Guide.

Below are the Events that are supported by the VRTA CanTrcv

9.3.1 Result

Event ID

Data Format

1 %u

This event is raised when there is a change in the result.

9.3.2 CurrentJob

Event

ID

Data Format

2 None|SETOPMODE|GETOPMODE|GETBUSWUREASON|

SETWAKEUPMODE|CHECKWAKEUP

This event is raised when there is a change in the action called. It would be enumeration as

seen from the above table

9.3.3 DETErrors

Event ID Data Format

3 None|CANTRCV_E_INVALID_TRANSCEIVER|CANTRCV_E_PARAM_POINTER|CANTRCV_E_UNINIT|CANTRCV_E_TRC

V_NOT_STANDBY|CANTRCV_E_TRCV_NOT_NORMAL|CA

NTRCV_E_PARAM_TRCV_WAKEUP_MODE|CANTRCV_E_PARAM_TRCV_OPMODE

This event is raised when there is a change in the DET error status. It would be enumeration

as mentioned in the above table.

Page 55: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 55

9.3.4 CurrentStatus

Event ID Data Format

4 None|CANTRCV_TRCVMODE_NORMAL|CANTRCV_TRCVMODE_SLEEP|CANTRCV_TRCVMODE_STANDBY

This event is raised when there is a change in the operating mode of a transceiver. It would

be enumeration as mentioned in the above table.

9.3.5 WakeupMode

Event ID Data Format

5 None|CANTRCV_WUMODE_ENABLE|CANTRCV_WUMODE

_DISABLE|CANTRCV_WUMODE_CLEAR

This event is raised when there is any change in the wakeup mode of a transceiver. It would

be enumeration as mentioned in the above table.

Page 56: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 56

10 VRTA FLASH Device

10.1 VRTA Flash Overview

The VRTA Flash provides an interface between Flash MCAL module and an external application like

vrtaMonitor through AUTOSAR API’s. This allows an external application to monitor and inject actions

on a VECU during runtime.

Jobs Supported by VRTA Flash device are as below

WRITE to a Flash device

READ from a Flash device

COMPARE user data to the data in Flash Memory

ERASE Data in the Flash Memory

CANCEL the Pending Job

Flash device cannot be initialized using vrta Actions. It needs to be initialized in the VECU by the User.

10.2 Access VRTA Flash Using C++ Methods

The VRTA Flash shall combine all available flash memory into one linear address space

(denoted by parameters FlsBaseAddress and FlsTotalSize). This shall map the address and length

parameters for the read, write, erase and compare functions as “virtual” addresses to the physical

addresses according to the physical structure of the memory areas. Error notification can be identified

by hooking the proxy APIs in the MCAL.

Method: eveVrtaFls ()

The constructor.

Method declaration:

eveVrtaFls (const vrtaTextPtr name)

Parameters:

Parameter Input/Output Description

name Input The name of the virtual

device.

Description:

This is the constructor used to create an instance of a VRTA Flash device

Return values:

Value Description

<none>

Page 57: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 57

Method: UpdateJobResult ()

Update the Job Result.

Method declaration:

void UpdateJobResult(MemIf_JobResultType result)

Parameters:

Parameter Input/Output Description

result Input Ok if job is successful

Failed if job is fails Pending if job is pending

Cancelled if job is cancelled Inconsistent if memif_block is

inconsistent Invalid if memif_block is invalid

Unsuccessful if busy or parameters are

not in range

Description:

This method is used to update the job result by raising an event.

Return values:

Value Description

<none>

Method: UpdateJobStatus ()

Update the job status

Method declaration:

Void UpdateJobStatus(MemIf_StatusType status)

Parameters:

Parameter Input/Output Description

Status of type

MemIf_StatusType

Input Uninitialized if flash is

Uninitialized

Idle if flash is Idle Busy if flash is Busy

Busy Internal if flash is Busy Internally

Description:

This method updates the status of the present job by raising an event.

Return values:

Value Description

<none>

Method: UpdateDetErrors ()

Update the DET Errors

Page 58: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 58

Method declaration:

Void UpdateDetErrors(uint8 det)

Parameters:

Parameter Input/Output Description

det Input Update the DET Errors, if any

Configuration Error in Parameter Configuration (0x01)

Address Error in Parameter Address (0x02) Length Error in Parameter Length (0x03)

Data Error in Parameter Data (0x04)

Pointer Error in Parameter Pointer (0x0A) Uninitialized Error if Flash is Uninitialized (0x05)

Busy Error if Flash is Busy (0x06) Erase Error if Erase Verification Failed (0x07)

Write Error if Write Verification Failed (0x08) Timeout Flash Time out Error (0x09)

Description:

This method will update the DET Errors, if any.

Return values:

Value Description

<none>

Method: UpdateCurrentJob ()

Update the current job

Method declaration:

Void UpdateCurrentJob(uint8 job)

Parameters:

Parameter Input/Output Description

job Input Write if write Job is started in the VECU Read if read Job is started in the VECU

Erase if Erase Job is started in the VECU Compare if Compare Job is started in the VECU

Cancel if Cancel Job is started in the VECU

Description:

This method will give the current job information by raising an event.

Return values:

Value Description

<none>

Method: ExecuteJob ()

Used to execute the Job

Page 59: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 59

Method declaration:

Void ExecuteJob ()

Parameters:

Parameter Input/Output Description

<none>

Description:

This method will execute the pending job, check the global variable to raise

RaiseInjectedEvents() method to update the status and result. If there is no pending job the

function will return without processing any jobs.

Return values:

Value Description

<none>

Method: RaiseInjectedEvents ()

Used to update the result and status of the job

Method declaration:

Void RaiseInjectedEvents()

Parameters:

Parameter Input/Output Description

<none>

Description:

This method is used to update the result and status of the job by raising the events

Return values:

Value Description

<none>

Method: FlashIdleHandler ()

Used to execute the AUTOSAR functionalities.

Method declaration:

Void FlashIdleHandler(void)

Parameters:

Parameter Input/Output Description

<none>

Description:

This method gets called from OS when it is in Idle state. This is used to call the AUTOSAR

APIs.

Return values:

Value Description

<none>

Page 60: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 60

10.3 Actions

User can pass values to the VRTA Flash device from an external application like vrtaMonitor

or a 3rd party application to the VECU using Actions.

Each action supported by a VRTA Flash device is described by a standard table, as below, followed by

text to explain the purpose of the action or event.

ID Data Format

XXXX YYYY

The table contains the numeric ID of the action or event (XXXX), and the format of the

action or event data (YYYY).

Below are the Actions that are supported by the VRTA Flash

10.3.1 Inject Write

Action

ID

Data Format

1 %x:32, %a:

This action writes the byte array into the flash memory when the OS in idle. The first number in the action data is the address of 32 bit and the second number is the byte array

which is to be written on the flash memory.

10.3.2 Inject Read

Action

ID

Data Format

2 %x:32,%u:

This action reads the byte array in the address which is to be given by the user. The first

number in the action data is the address of 32 bit and the second number is the length of

the byte array to be read.

10.3.3 Inject Erase

Action

ID

Data Format

3 %x:32,%u:

This action erases the byte array in the address which is to be given by the user. The first

number in the action data is the address of 32 bit and the second number is the length of the byte array to be read.

10.3.4 Inject Compare

Action ID

Data Format

4 %x:32,%u:,%a:

Page 61: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 61

This action compares the byte array in the address which is to be given by the user. The

first number in the action data is the address of 32 bit and the second number is the length

of the byte array to be read and third is the byte array to be compared.

10.3.5 Inject Cancel

Action

ID

Data Format

5 <none>

This action cancels an ongoing job like read, write, compare and erase.

10.3.6 Inject Set Mode

Action ID

Data Format

6 |SLOW|FAST|

This action changes the Mode of the Flash .The Available modes are fast and slow.

This mode is not fully functional in Flash MCAL module.

10.4 Events

User can get values from the VECU to an external Application like vrtaMonitor or a

3rd party application using Events. There are two ways of doing this

14. Event Polling

15. Event Hooking

16.

Event Polling – External application can poll the events in a vrtadevice to get the value of

the event at that particular time.

Example: using Java vrtaComms polling can be done by the following

/*Load VECU using the location and target information of the VECU*/

m_VECU = VECUFinder.load (Config.hostUnderTest (), Config.DemoApp ());

final List<Object> error_count = new ArrayList<Object> (); /*Get a vrta Flash device using its name*/ VECUDevice flash_device = m_VECU.device ("FlashDevice"); /*Get a vrta Flash error event using its name*/ VECUDeviceEvent error = flash_device.event ("DETErrors"); /*Start VECU*/ m_VECU.start (); /** * Test DET Length error */ byte[] data = { 0x41, 0x55, 0x54, 0x4f, 0x53, 0x41, 0x52 }; String str = flash_device.action ("InjectWrite").send (0x20000, data); sleepInMs(300); /*polling Error event after 300ms*/ String error_state = (String)error.state();

Page 62: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 62

Event Hooking – External application can also get notified automatically of some change in

state/value by raising an event.

Example : using Java vrtaComms hooking can be done by the following

/*Load VECU using the location and target information of the VECU*/

m_VECU = VECUFinder.load (Config.hostUnderTest (), Config.DemoApp ());

final List<Object> error_count = new ArrayList<Object> (); /*Get a vrta Flash device using its name*/ VECUDevice flash_device = m_VECU.device ("FlashDevice"); /*Get a vrta Flash error event using its name*/ VECUDeviceEvent error = flash_device.event ("DETErrors"); /*Start VECU*/ m_VECU.start (); /*Hook the Event*/ error.Hook (new EventHook () { Public void values (Object... values) { /*Error count and error value will be updated with every error occurrence in the VECU*/ error_count.add (values[0]); } }); /** * Test DET Length error */ byte[] data = { 0x41, 0x55, 0x54, 0x4f, 0x53, 0x41, 0x52 }; /*Send an Write action with Parameter Errors*/ String str = flash_device.action("InjectWrite").send(0x20000, data); SleepInMs (300); assertEquals (1, error_count.size()); assertEquals("Length", error_count.get(0));

Below are the Events that are supported by the VRTA Flash

10.4.1 Result

Event ID

Data Format

1 %u

This event is raised when there is a change in the result of the actions.

10.4.2 Status

Event

ID

Data Format

2 %u

This event is raised when there is a change in the status of the actions.

Page 63: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 63

10.4.3 DETErrors

Event

ID

Data Format

3 %u

This event is raised when there are any errors (only Development Error Tracer errors) or there is a change in the previous event value.

10.4.4 CurrentJob

Event ID

Data Format

4 None|Write|Read|Erase|Compare|Cancel|

This event is raised while performing the operations like write, read, erase, compare, and cancel to update the event being performed by the user.

10.4.5 InjectedRead

Event ID

Data Format

6 %a

This event is raised to show the read status when the user invokes through external monitor

programs like VRTA Monitor.

10.4.6 InjectedResult

Event

ID

Data Format

7 %u

This event is raised to show the result of the job when the user invokes through external

monitor programs like VRTA Monitor.

10.4.7 InjectedStatus

Event

ID

Data Format

8 %u

This event is raised to show the status when the user invokes through external monitor

programs like VRTA Monitor.

Page 64: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 64

11 Synchronization Clock Device(vrtaSyncClock)

11.1 VrtaSynchClock Overview

The Vrta Synchronizable Clock is a virtual device that can be used as a Clock Source for a

VECU. It can be thought of as an oscillator. It ticks independently of the rest of the application at up

to 1000 ticks per second in Free Running mode (RealTimeMode). It can also run in an Adaptive mode

i.e. the clock ticks as fast as it can whenever the OS is in idle state.

The code example below shows you how to declare a clock named “VECU_SystemClock” that ticks

every 5ms:

On its own, the clock source is not of much use. You can start it, stop it and change its interval, but it

does not maintain a value or raise any interrupts. We need to connect a counter to this clock source.

Two types of counter are provided:

1. up-counting

2. down-counting

These lines of code declare two such counters attached to the clock source:

By default, a counter increments or decrements its current value within the range zero to 2^32−1.

You can reduce the range of the count using the SetMin() and SetMax() methods. The normal place to

do this is in the InitializeDevices() function as shown below. InitializeDevices() is also a good place to

enable the counter.

void InitializeDevices(void){

/* CountUp goes 0...999 then back to 0 */

CountUp.SetMax(999);

CountUp.Start();

/* CountDown goes 1999...1000 then back to 1999 */

CountDown.SetValue(1999);

CountDown.SetMin(1000);

CountDown.SetMax(1999);

CountDown.Start();

}

#define MSECS_PER_TICK (5)

vrtaSyncClock Clock("VECU_SystemClock", MSECS_PER_TICK);

vrtaUpCounter CountUp("CountUp", Clock);

vrtaDownCounter CountDown("CountDown", Clock);

Page 65: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 65

You can read the current value of a counter using counter.GetValue(). But what we‟d really like to do

is to raise an interrupt when the counter reaches a certain value. The vrtaCompare virtual device is

provided to do exactly this job.

When you declare a compare device you can attach it to a counter and specify an interrupt that fires

when the value of the counter reaches a specific value. The next code example shows two

comparators connected to the same counter. The first one raises interrupt 1 when the counter

reaches value 5. The second raises interrupt 2 when the counter value reaches 15.

Hopefully it is clear from this that you can very easily construct a chain of timing elements of arbitrary

complexity by simple combinations of clock, counter and compare devices.

Note - that vrtaSyncClock sources run independently of the application. If you use the

ApplicationManager to pause the application thread, the clocks continue to run and any

counter/compare devices that are attached can continue to raise interrupts that will be serviced once

the application thread resumes. Even if a sleep is used inside a task it won’t affect the clock as it runs

as a Separate Application.

11.2 Timer Hierarchy

Real Ecu’s have a single clock source. Similarly a Singe clock device should be used as a Clock Source

for a Virtual ECU.This helps to synchronize the clock with other devices in the system.

Note - It is recommended to use a Singe Clock Source for a VECU.If you need to use different things

to schedule at different time you can do by having different Counters attached to the same clock

source. Multiple counters can be attached to the same vrtaSyncClock device and each counter can fire

a different ISR using the vrtaComparator device.

vrtaCompare Compare5("Compare5",CountUp,5,1);

vrtaCompare Compare15("Compare15", CountUp,15,2);

vrtaUpCounter Counter1("CountUp", Clock);

vrtaUpCounter Counter2("CountDown", Clock);

vrtaUpCounter Counter3("CountDown", Clock);

Page 66: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 66

11.3 Access Synchronizable Clock Features Using C++ Methods

A vrtaSyncClock device ticks an attached counter every T milliseconds. T is calculated by

multiplying the VrtaSynchClock device‟s clock tick interval by its scaling factor. The scaling factor has

a multiplier and a divisor. If the clock tick interval (set in the constructor or with the SetInterval()

method) is interval, and the scaling factor (set with the SetScale() method) is mult / div, then an

attached counter would be ticked every (interval * mult / div) milliseconds. By default the scale factor

is 1 / 1.

Hopefully it is clear from this that you can very easily construct a chain of timing elements of arbitrary

complexity by simple combinations of clock, counter and compare devices.

Method: vrtaSyncClock ()

The constructor.

Method declaration:

VrtaSyncClock (const vrtaTextPtr name, unsigned interval)

Parameters:

Parameter Input/Output Description

name Input The name of the virtual device.

interval Input The number of milliseconds in

one clock tick.

Description:

This is the constructor used to create an instance of a vrtaSyncClock device.

Return values:

Value Description

<none>

Method: SetInterval ()

Set the tick interval.

Method declaration:

void SetInterval (unsigned interval)

Parameters:

Parameter Input/Output Description

interval Input The number of milliseconds in

one clock tick.

Description:

This method is used to change the number of milliseconds in one clock tick.

Return values:

Value Description

<none>

Page 67: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 67

Method: SetScale ()

Set the scaling factor.

Method declaration:

void SetScale (unsigned mult, unsigned div)

Parameters:

Parameter Input/Output Description

mult Input The multiplier for the scaling

factor.

div Input The divisor for the scaling factor.

Description:

This method sets the scaling factor for the clock. The Minimum Scale Factor for

vrtaSyncClock is 1 ms.

Return values:

Value Description

<none>

Method: Start ()

Start the clock ticking.

Method declaration:

void Start (void)

Parameters:

Parameter Input/Output Description

<none>

Description:

This method starts the clock device ticking any attached counters.

Return values:

Value Description

<none>

Method: Stop ()

Stop the clock ticking.

Method declaration:

void Stop (void)

Parameters:

Parameter Input/Output Description

<none>

Description:

This method stops the clock device ticking any attached counters.

Return values:

Value Description

Page 68: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 68

<none>

Method: InjectTick ()

Returns Boolean depending on the mode the clock Runs

Method declaration:

vrtaBoolean InjectTick (void)

Parameters:

Parameter Input/Output Description

<none>

Description:

This method gets called from software as often as it likes. It only has an effect when we not

free-running. Typically it will be called repeatedly in the idle loop, so the clock will run as

fast as it can.This clock does not get scaled..

Return values:

Value Description

vrtaBoolean False – Free Running (Real Time Mode)

True – Adaptive Mode

11.4 Actions

User can pass values to the VrtaSyncClock device from an external application like

vrtaMonitor or a 3rd party application to the VECU using Actions.

Each action supported by a vrtaSyncClock device is described by a standard table, as below, followed

by text to explain the purpose of the action or event.

ID Data Format

XXXX YYYY

The table contains the numeric ID of the action or event (XXXX), and the format of the

action or event data (YYYY).

Below are the Actions that are supported by the vrtaSyncClock

11.4.1 Interval

Action

ID

Data Format

1 %u

This action sets the number of milliseconds in a clock tick. The action data is the number of milliseconds in a clock tick. This action is equivalent to the SetInterval() method.

Page 69: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 69

11.4.2 Scale

Action

ID

Data Format

2 %u,%u

This action sets the device’s scaling factor. The first number in the action data is the scaling factor multiplier and the second number is the divisor. This action is equivalent to the

SetScale () method.

11.4.3 Start

Action

ID

Data Format

3 <none>

This action starts the clock device ticking any attached counters. This action is equivalent to

the Start () method.

11.4.4 Stop

Action ID

Data Format

4 <none>

This action stops the clock device ticking any attached counters. This action is equivalent to the Stop () method.

11.4.5 Adaptive

Action ID

Data Format

5 <none>

This action changes the clock to run in Adaptive Mode

11.4.6 FreeRunning

Action

ID

Data Format

6 <none>

This action changes the clock to run in Free Running Mode (Real Time Mode)

11.4.7 TickLimit

Action

ID

Data Format

7 %u

This action limits the number of clock ticks in the VECU.The action data is the number of

ticks the clock can have.

By default action data is set to 0 ie, the clock will run continuously. If action data is changed to a Value say 10 then the Clock will run till 10 ticks and will raise an Ticks Remaining event.

Clock Ticks are ignored and is not passed to the VECU until the next TickLimit action is

scheduled.

This is an important feature which can be used to sync time with external devices

Page 70: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 70

11.5 Events

User can get values from the VECU to an external Application like vrtaMonitor or a 3rd party

application using Events. There are two ways of doing this

17. Event Polling

18. Event Hooking

Event Polling – External application can poll the events in a vrtadevice to get the value of

the event at that particular time.

Event Hooking – External application can also get notified automatically of some change in

state/value by raising an event.

Below are the Events that are supported by the vrtaSyncClock

11.5.1 Interval

Event ID

Data Format

1 %u

This event is raised when the clock device’s tick interval changes. The event data is the new

tick interval.

11.5.2 Scale

Event

ID

Data Format

2 %u,%u

This event is raised when the clock device’s scaling factor changes. The event data is the

new scaling factor multiplier followed by the new divisor.

11.5.3 Running

Event

ID

Data Format

3 %u:;0;1

This event is raised when the clock is started or stopped. The event data is 1 if the clock is

now running (i.e. has been started) or zero if the clock is not now running (i.e. has been

stopped).

11.5.4 TicksRemaining

Event

ID

Data Format

4 %u

This event provides information on number of Ticks remaining once the TickLimit action is

set with a tick limit value. When polled this event will inform the number of ticks remaining. But the external devices are notified by event hooking only when the Tick remaining is equal

to zero. This is an important feature which can be used to sync time with external devices.

Page 71: ETAS Virtual ECU V2.0 VRTA Device User Guide · SynchronizableClock. It will also provide information on connecting the device with external applications and send/receive messages

ETAS

ETAS Virtual ECU V2.0 VRTA Device User Guide 71

12 ETAS Contact Addresses

ETAS HQ

ETAS GmbH

Borsigstraße 14 Phone: +49 711 89661-0

70469 Stuttgart Fax: +49 711 89661-106

Germany WWW: www.etas.com

ETAS Subsidiaries and Technical Support

For details of your local sales office as well as your local technical support team and product hotlines, take a look at the ETAS website:

ETAS subsidiaries WWW: www.etas.com/en/contact.php

ETAS technical support WWW: www.etas.com/en/hotlines.php