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
0x00Output
0x04Input
0x08Debounced input
0x0CDebounce threshold
0x10Raspberry pi header
0x14Raspberry pi mask
0x18Arduino shield header
0x1CArduino shield mask

Output

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

Bit offsetDescription
7-0LEDs

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
13-9Joystick (left, down, up, right, press)
8Button
7-0DIP switches

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

Debounce threshold

This register indicates how many clock cycles an input needs to be stable before it shows up on the output. The same threshold applies to all of the inputs.

Bit offsetDescription
31-0Threshold

Raspberry Pi header

The Raspberry Pi header has 26 GPIO pins, this register can read from and write to these pins. When writing, it only writes the bits for which the write mask has a one. The header and write mask registers have the same bit mapping.

Bit offsetDescription
24GPIO 26
......
1GPIO 3
0GPIO 2

Arduino shield header

Arduino shield headers have 13 IO pins, this register can read from and write to these pins. When writing, it only writes the bits for which the write mask has a one. The header and the write mask registers have the same bit mapping.

Bit offsetDescription
13IO 13
......
1IO 1
0IO 0