GPIO

General purpose input and output is used for Ibex to interact with the buttons and switches on the board. It is also used to drive the LEDs on the board. There are also the GPIO pins of the various headers.

For the input this module provides a raw value as well as a debounced value. Debouncing is useful to avoid counting a single button press multiple times. For more information on contact bounce, see this Wikipedia page.

OffsetRegister
0x0000Output
0x0004Input
0x0008Debounced input
0x000COutput enable
0x0010R-Pi output
0x0014R-Pi input
0x0018R-pi debounced input
0x001CR-pi output enable
0x0020Arduino output
0x0024Arduino input
0x0028Arduino debounced input
0x002CArduino output enable
0x0030PMOD output
0x0034PMOD input
0x0038PMOD debounced input
0x003CPMOD output enable

Output

The output register displays the specified value onto the boards output.

Bit offsetDescription
22mikroBUS reset
21mikroBUS SPI chip select
20Arduino SPI chip select
19R-Pi SPI1 chip select 0
18R-Pi SPI1 chip select 1
17R-Pi SPI1 chip select 2
16R-Pi SPI0 chip select 0
15R-Pi SPI0 chip select 1
14Ethernet reset
13Ethernet SPI chip select
12Flash SPI chip select
11-4LEDs
3LCD backlight
2LCD DC
1LCD reset
0LCD chip select

In this case writing a one will turn an LED on and a zero will turn the LED off.

Input

Both input registers have the same bit mapping. The only difference between the registers is that the latter has debounced signals.

Bit offsetDescription
16-14Software select switches (1, 2, 3)
13mikroBUS interrupt
12-5DIP switches
4-0Joystick (left, down, up, right, press)

The input registers are used to interact with the joystick, the button and the DIP switches that are available on the Sonata board.

Raspberry Pi HAT

The Raspberry Pi HAT header has 27 pins that can act as GPIO. Some can be remapped to other IP blocks (see Pinmux). When writing, it only writes the bits for which the output is set to enable. The input and output registers have the same bit mapping.

Bit offsetDescription
27-0g27 - g0

When the output enable is set to zero it instead acts as an input pin.

Arduino Shield

The Arduino Shield header has 17 pins that can act as GPIO. When writing, it only writes the bits for which the output is set to enable. The input and output registers have the same bit mapping.

Bit offsetDescription
17-0GPIO 17 to 0

When the output enable is set to zero it instead acts as an input pin.

PMOD

The two PMOD headers has 16 GPIO pins. When writing, it only writes the bits for which the output is set to enable. The input and output registers have the same bit mapping.

Bit offsetDescription
15-8PMOD 1
7-0PMOD 0

When the output enable is set to zero it instead acts as an input pin.