Please enable JavaScript to view this site.

Waijung 2 User Guide

Design overview

Timer Interrupt block appearance in a Simulink model,

zynq_7000_timer_interrupt_block_1

Timer Interrupt block mask overview,

Block Name

Mask

Timer Interrupt

zynq_7000_timer_interrupt_block_2

Timer Interrupt Control

zynq_7000_timer_interrupt_block_3

Timer Interrupt Block input interfaces

Timer Interrupt

Name

Type

Range

Description

N/A

 

 

 

Timer Interrupt Control

Name

Type

Range

Description

Freq (Hz)

uint32 | Scalar

 

This port is only available when Action parameter is set to Change Timer Parameters option and Timer Interval check box is checked. This port can be used to change the timer frequency.

Dir (Inc)

boolean | Scalar

 

This port is only available when Action parameter is set to Change Timer Parameters option and Counter Direction check box is checked. This port can be used to change the timer counter direction. If true the counter is set to increment and if false to decrement.

Timer Interrupt Block output interfaces

Timer Interrupt

Name

Type

Range

Description

IRQ

Function-call

 

This port should be used to specify the Interrupt Service Routine (ISR). The user must ensure that blocks inside the function-call subsystem should be simple and create minimum overhead.

Timer Interrupt Control

Name

Type

Range

Description

Counter Val

uint16 | Scalar

 

This port is only available when Action parameter is set to Read Counter Value option.

Valid Freq

boolean | Scalar

 

This port is only available when Action parameter is set to Change Timer Parameters option and Timer Interval check box is checked. If the frequency value specified from the Freq (Hz) port is invalid, the port will output a false signal and vice versa.

Timer Interrupt Block behavior

This is an implementation of Triple Timer Counter (TTC) driver in the PS block. The Timer Interrupt block can be used to setup the timer and the ISR. There can only be one block per device id per model.

The Timer Interrupt Control block can be used to control the configured timers from the Timer Interrupt block. This block should be placed inside a function-call generator block in order to be used. This block can be used for the following actions:

Change Timer Functionality

Read Counter Value

Change Timer Parameters

Timer Interrupt Block configuration

The following parameters can be configured through block mask of Timer Interrupt block.

Configuration Parameter

Selectable Option/Value        

Default Value

Description

DEVICE ID

XPAR_PS7_TTC_0_DEVICE_ID

XPAR_PS7_TTC_0_DEVICE_ID

Depending on the peripheral availability in your hardware design created using the Vivado Design Suite, available device-ids will be shown.

XPAR_PS7_TTC_1_DEVICE_ID

XPAR_PS7_TTC_2_DEVICE_ID

XPAR_PS7_TTC_3_DEVICE_ID

XPAR_PS7_TTC_4_DEVICE_ID

XPAR_PS7_TTC_5_DEVICE_ID

Start timer during initialization

on

off

on

If checked, the timer will start during the initialization. If not, the user has to start the timer from a Timer Interrupt Control block.

Enable interrupts during initialization

on

off

off

If checked, the timer interrupt will be enabled during the initialization. If not, the user has to enable the timer interrupt from a Timer Interrupt Control block.

Timer counter direction

Increment

Decrement

Increment

This parameter determines the counter direction of the timer.

Unit

Hz

kHz

MHz

Hz

This parameter is used to set the unit of the timer frequency value specified in the Value parameter.

Value

 

 

This parameter is used to set the frequency of the interrupt service routine. The unit of this value should be specified in the Unit parameter. If the frequency value specified is not valid, the initialization of the driver will fail and the model will not run. If observed via a serial monitor the following sentence will be shown:

“TtcPs driver initialization failed”

The following parameters can be configured through block mask of Timer Interrupt Control block.

Configuration Parameter

Selectable Option/Value

Default Value

Description

DEVICE ID

 

 

All the timers initialized using the Timer Interrupt block will be available in the drop down. Select the timer device to be configured.

Action

Change Timer Functionality

 

Select the action to be performed on the selected timer.

If,

Change Timer Functionality: This action is used when the user wants to enable/disable interrupts, start/stop the timer and/or reset the counter on the fly.

Read Counter Value: This action is used to read the timer counter value.

Change Timer Parameters: This action is used to change the timer interval and counter direction on the fly.

Read Counter Value

Change Timer Parameters

Interrupts

N/A

N/A

If,

N/A: The interrupt status would not change.

Enable: The interrupt of the selected timer will be enabled.

Disable: The interrupt of the selected timer will be disabled.

Enable

Disable

Timer

N/A

N/A

If,

N/A: The timer status would not change.

Start: The selected timer will start.

Stop: The selected timer will stop

Start

Stop

Reset Counter

True

False

False

If True the counter of the respective timer will be reset.

Timer Interval

on

off

on

If checked, Freq (Hz) port will appear. Use the port to change the frequency of the timer on the fly. The unit of the frequency can be specified using => in dropdown parameter. When changing the timer interval, the following sequence is automatically adhered every time and therefore, could create overhead.

A) Disable the interrupt

B) Stop the timer

C) Reset the counter

D) Change the timer interval

E) Enable the interrupt

F) Start the timer

Counter Direction

on

off

on

If checked, Dir (Inc) port will appear. Use the port to change the direction of the timer on the fly. A logic true signal will set it to increment and a logic false will set it to decrement. When changing the counter direction, the following sequence is automatically adhered every time and therefore, could create overhead.

A) Disable the interrupt

B) Stop the timer

C) Reset the counter

D) Change counter direction

E) Enable interrupt

F) Start the timer

Sample time (sec)

-1 (inherited) or specify

-1

Specify the sample time for the block in seconds.

Timer Interrupt Block limitations

N/A

Troubleshooting

N/A

Typical application

Several demo files are provided at:

[<waijung2 installation directory>\waijung2\targets\zynq7000\demo\timer_interrupt_demo]

To load the model file run the following commands in the Matlab Command Window:

Demo 1: waijung2.openDemoInCurrentFolder('zynq7000', 'timer_demo1')

 

Copyright 2024 Aimagin Co.,Ltd. Rev.1454