2.23 Measuring CAN bus reception processing times [E2]

You can use this facility to reduce the number of steps required to measure the time from detection of a CAN frame on the bus to execution of the corresponding code in a program in the development of systems that use CAN communications.

 

[How to use]

This facility utilizes the following extended functions of the E2 emulator: CAN bus monitoring and time measurement.

Accordingly, to use this facility, be sure to select [Use the power supplied from the target] for the [Interface for supplying the power] property under the [E2 Expansion Interface] category [E2] on the [Connect Settings] tab in the Property panel before connecting the debug tool.

Remark

For details on the given extended functions of the E2 emulator, refer to the Application Note on the CAN Communication Time Measurement Solution (E2 Emulator, CS+).

(1)

Open the Measuring CAN Bus Reception Processing Times panel

Open the Solution List panel and click on the [GO] button for measuring CAN bus reception processing times. The Measuring CAN Bus Reception Processing Times panel [E2] will open.

Figure 2.163

Measuring CAN Bus Reception Processing Times Panel

(2)

Set the measurement conditions

You can select up to two conditions (conditions 1 and 2) since two timer channels are available for use in measurement.

To set the conditions, use the Measurement Condition Setting dialog box [E2]. Open this by selecting [Set Condition] -> [Set Condition 1...] or [Set Condition 2...] from the toolbar of the Measuring CAN Bus Reception Processing Times panel [E2].

Figure 2.164

Measurement Condition Setting Dialog Box

(a)

Set a measurement-range start condition

The [Measurement range start condition] area allows you to select a condition that defines the beginning of the range over which measurement will proceed. You can measure the time from the beginning to the end of the range, respectively defined by the start and end conditions.

Select "Detect CAN Frame" or "Detect External Trigger Input Signal" for [Condition type]. Other items for which you need to make settings depend on the selected condition type.

<1>

When "Detect CAN Frame" is selected

The beginning of the measurement range is a point where a specific CAN frame is detected by CAN bus monitoring, which is an extended function of the E2 emulator. You need to enter the following information regarding the CAN frame to be detected.

-

Channel

Select the channel for use in the detection of CAN frames by CAN bus monitoring through the E2 expansion interface.

-

Frame format

Select "Standard" or "Extended" as the format of CAN frames to be detected.

-

Baud rate

Select one of the following values as the bit rate for use in the detection of CAN communications.

1M bps, 500K bps, 250K bps, 125K bps

-

Sampling point

Specify the relative position as a percentage (1 to 100%) within one bit period for the sampling of each bit of data in the CAN frame to be detected.

-

ID and the ID mask value

Specify ID in CAN frames to be detected and the mask value to be used as hexadecimal values.

When 0 is selected for a mask bit of the mask value, the bit is treated as being masked.

-

Data and the data mask value

Specify data in CAN frames to be detected and the mask value to be used as hexadecimal values.

When 0 is selected for a mask bit of the mask value, the bit is treated as being masked.

-

Data Length

Select the data size in bytes for CAN frames to be detected as a value from 0 to 8.

-

Detection times

Time measurement starts when CAN frames have been detected the number of times specified in this field.

<2>

When "Detect External Trigger Input Signal" is selected

The beginning of the measurement range is a point where the input of an external trigger signal through the E2 expansion interface is detected. You need to enter the following information regarding the external trigger input signal to be detected.

-

Channel

Select the channel for use in detecting the input of external trigger signals through the E2 expansion interface.

-

Waveform detection

Select the type of waveform to be detected as the external trigger input from among "Rising edge", "Falling edge", and "Both edges", which are in the drop-down list.

(b)

Set a measurement-range end condition

The [Measurement range end condition] area allows you to select conditions that define the end of the range over which measurement will proceed. You can measure the time from the beginning to the end of the range, respectively defined by the start and end conditions.

Select "Detection of DBTAG" or "Detection of external input trigger signal" for [Condition type]. Other items for which you need to make settings depend on the selected condition type.

<1>

When "Detection of DBTAG" is selected

The end of the measurement range is a point where the execution of a dbtag instruction (part of the instruction set of RH850 MCUs) is detected. You need to select the value of DBTAG to be detected from among the following values.

0x21, 0x29, 0x31, 0x39, 0x41, 0x49, 0x51, 0x59, 0x61, 0x69

 

Go to "(3) Insert dbtag instructions at desired positions", insert dbtag instructions at desired positions, to select the value of DBTAG to be detected.

<2>

When "Detection of external input trigger signal" is selected

The end of the measurement range is a point where the input of an external trigger signal through the E2 expansion interface is detected. You need to enter the following information regarding the external trigger input signal to be detected.

-

Channel

Select the channel for use in detecting the input of external trigger signals through the E2 expansion interface.

-

Detected waveform

Select the type of waveform to be detected as the external trigger input from among "Rising edge", "Falling edge", and "Both edges", which are in the drop-down list.

(c)

Make timeout settings

The [Timeout setting] area allows you to make timeout settings. Use [Detect timeout] to select whether to enable timeout detection. With timeout detection enabled, CS+ will detect timeout in the form of the time entered in [Timeout period] having elapsed after time measurement was started but before the measurement-end conditions have been satisfied. Select one of the following actions in response to timeout detection.

-

Detection only

CS+ only detects the timeout and will not take any other action.

Detection of timeout is only used as a condition for external trigger output in "(d) Make settings for the output of an external trigger signal".

-

Stop internal tracing

Tracing within the MCU stops.

-

Stop program

Execution of the program stops.

Caution

"Stop internal tracing" is not selectable as the action on timeout detection when "Detection of DBTAG" is selected as the type of measurement-end condition.

(d)

Make settings for the output of an external trigger signal

The [External trigger output setting] area allows you to make settings for the output of an external trigger signal. Use [Output external trigger signal] to select whether to enable the output of an external trigger signal. With the output of an external trigger signal enabled, CS+ will output an external trigger (high-level pulse) signal when the required condition is satisfied.

Enter the following information.

<1>

External trigger signal output condition

Select the condition for the output of an external trigger signal from among the following.

-

Start condition is true

-

End condition is true

-

Timeout condition is true

 

Caution

"Start condition is true" is not selectable when "Detect External Trigger Input Signal" is selected as the type of measurement-start condition.
"End condition is true" is also not selectable when "Detect External Trigger Input Signal" is selected as the type of measurement-end condition.
"Timeout condition is true" is not selectable when timeout detection is disabled.

<2>

Channel

Select the channel for output of the external trigger through the E2 expansion interface.

<3>

Pulse width

Specify the width of the high-level pulse to be output as the external trigger.

(3)

Insert dbtag instructions at desired positions

Insert dbtag instructions at positions where you wish to detect their execution.

You need to specify a DBTAG value for each dbtag instruction. Select one of the following ten values.

0x21, 0x29, 0x31, 0x39, 0x41, 0x49, 0x51, 0x59, 0x61, 0x69

 

Remark

See "RH850G3M/G3MH/G3K/G3KH User's Manual: Debug Instructions" for details on dbtag instructions.

 

Prior to measurement, you can insert dbtag instructions at desired positions and proceed with automatic rebuilding and downloading when V1.06.00 or a later version of the CC-RH compiler is selected for the active project.

Caution

When dbtag instructions are inserted prior to measurement, rebuilding and downloading will forcibly reset the CPU.

 

You can use the context menu in the Editor panel to set DBTAG insertion points at desired positions in the source code.

Figure 2.165

Context Menu in the Editor Panel

(4)

Start measurement

Start measuring CAN bus reception processing times by using the facilities of the E2 emulator.

Click on or on the toolbar in the Measuring CAN Bus Reception Processing Times panel [E2].

Figure 2.166

Toolbar in the Measuring CAN Bus Reception Processing Times Panel

 

CAN bus reception processing times are not measured by clicking on in the Main window.

 

(a)

Clicking on

The project is rebuilt and downloaded before measurement starts. However, if the compiler used in the active project is a version of CC-RH earlier than V1.06.00, rebuilding and downloading do not proceed.

When [Maintain the DBTAG build option for subsequent measurements] in the Measuring CAN Bus Reception Processing Times panel [E2] is selected, the options which are specified for rebuilding and downloading before measurement are reflected in the [Parameters of software trace (DBTAG) for measuring CAN bus reception processing time] property of the build tool.

(b)

Clicking on

The project is not rebuilt and downloaded before measurement starts.

Select this button when you want to measure CAN bus reception processing times without resets due to rebuilding and downloading.

Note that this button is not displayed if the compiler used in the active project is a version of CC-RH earlier than V1.06.00.

(5)

End measurement

Measurement ends at the same time as execution of the program is stopped.

Execution of the program can be stopped by setting a breakpoint or timeout, or by clicking on .

(6)

View and save the results of measurement

Measurement ends at the same time as execution of the program is stopped.

(a)

View the results of measurement

At the same time as measurement ends, the minimum time, maximum time, average time, and number of rounds of measurement are displayed in the measurement results display area of the Measuring CAN Bus Reception Processing Times panel [E2].

Check that the values shown are as intended.

(b)

Save the results of measurement

Click on on the toolbar in the Measuring CAN Bus Reception Processing Times panel [E2] to save the latest results of measurement in a file.

Details of the CAN frames and dbtag instructions detected during measurement are also recorded with timestamps in the same file as the values displayed in the measurement results display area.