Digital input block appearance in a Simulink model,
Digital input block mask overview,
Name |
Type |
Range |
Description |
N/A |
|
|
|
Name |
Type |
Range |
Description |
Pin <x> |
Default: uint32 The data type of the port can be changed using Configure GPIO Pin Map block |
Expected values 0 or 1 |
<x> represents the selected pin number. For each selected pin in the mask, a separate port will be created.
This format is shown only when the Transfer Mode parameter is configured as Polled. |
IRQ |
Function-call |
|
A Function-Call Subsystem should be connected to the port.
This format is shown only when the Transfer Mode parameter is configured as Interrupted. |
Digital output block can be used to configure GPIO pins via MIO and EMIO interfaces. Using this block the pins can be configured to work in either interrupted or polled mode. The pins are labelled from 0-117. Pins 54-117 are connected through the EMIO interface and have to be mapped during the hardware design stage using Vivado Design Suite. To assign a custom label for a certain pin for convenience, Configure GPIO Pin Map block can be used. This block can also be used to assign the port data type for each individual pin. It is optional to use the Configure GPIO Pin Map block in Polled mode. However, when using the Digital Input Block in Interrupted mode, it is mandatory to add the said block to the model as interrupt pins are specified using that block.
Configuration Parameter |
Selectable Option/Value |
Description |
|
DEVICE ID |
XPAR_PS7_GPIO_0_DEVICE_ID
|
Depending on the peripheral availability in your hardware design created using the Vivado Design Suite, available device-ids will be shown. |
|
GPIO Type |
MIO Pins |
EMIO Pins |
Select the GPIO interface. Depending on the selected interface, respective configurable pins are shown. In the case of EMIO, the pins displayed on the block mask may or may not be available in your actual hardware design. |
Transfer Mode |
Polled |
Interrupted |
Select the transfer mode.
|
Interrupt Type |
XGPIOPS_IRQ_TYPE_EDGE_RISING |
Select the interrupt type. |
|
XGPIOPS_IRQ_TYPE_EDGE_FALLING |
|||
XGPIOPS_IRQ_TYPE_EDGE_BOTH |
|||
XGPIOPS_IRQ_TYPE_LEVEL_HIGH |
|||
XGPIOPS_IRQ_TYPE_LEVEL_LOW |
|||
Pin <x> |
On |
Off |
The pins to be configured using the block can be selected by toggling the check boxes. |
Sample time (sec) |
-1 (inherited) or specify |
Specify the sample time for the block in seconds. |
The known limitations associated with the block are:
•By default, in the block mask display all the pins (0-117) are available for the user to configure. However, depending on the hardware design (XSA file provided in the model Target Setup Block) some pins might not be available for configuration.
•Depending on the hardware development board, some pins could be hardwired as either input or output. Waijung 2 block set does not have the ability to acquire this information and therefore, will not be able to indicate these pins in the block mask.
•PIL interrupt; Level low or Level high
oCode architecture doesn’t support this type of interrupt testing with the PIL mode. This is mainly because when it is in the level low or level high interrupt state it won’t change the state.
oIn bareboard we are controlling task using timer interrupts, for example While executing the code the level low interrupt is triggered for one second, once this happens the rest of the code is not executed and will not execute the step function. It will keep interrupting and only the ISR will be executed during the whole period.
Several demo files are provided at:
[<waijung2 installation directory>\waijung2\targets\zynq7000\demo\gpio_demo]
To load the model file run the following commands in the Matlab Command Window:
•Demo 1: waijung2.openDemoInCurrentFolder('zynq7000', 'gpio_demo1')
•Demo 2: waijung2.openDemoInCurrentFolder('zynq7000', 'gpio_demo2')
•Demo 3: waijung2.openDemoInCurrentFolder('zynq7000', 'gpio_demo3')
•Demo 4: waijung2.openDemoInCurrentFolder('zynq7000', 'gpio_demo4')