Chapter 11
General Purpose Input/Output
Controller (GPIO)
This chapter describes the operation of the General Purpose Input/Output Controller (GPIO) on
SiFive systems. The SiFive GPIO controller is a peripheral device mapped in the internal memory
map, discoverable in the Configuration String. It is responsible for low-level configuration of the
actual GPIO pads on the device (direction, pull up-enable, and drive value), as well as selecting
between various sources of the controls for these signals. The GPIO controller allows seperate
configuration of each of
N
GPIO bits. Figure 11.1 shows the control structure for each pin.
Atomic operations such as toggles are natively possible with the RISC-V ’A’ extension.
Memory Map
The memory map for the SiFive GPIO control registers is shown in Table 11.1. The GPIO memory
map has been designed to only require naturally aligned 32-bit memory accesses.
Input / Output Values
The same
port
register can be configured on a bitwise fashion to represent either inputs or out-
puts, as set by the
direction
register. Writing to the
port
register will update the bits regardless
of the tristate value. Reading the
port
register will return the written value. Reading the
value
register will return the actual value of the pin.
In other words, on a read:
value = (input & direction) | (output & ~direction)
Interrupts
A single interrupt bit can be generated for each GPIO bit. The interrupt can be driven by rising or
falling edges, or by level values, and each can be enabled individually.
Inputs are synchronized before being sampled by the interrupt logic, so the input pulse width must
be long enough to be detected by the synchronization logic.
To enable an interrupt, set the corresponding bit in the
rise ie
and/or
fall ie
to
1
. If the correp-
sonding bit in
rise ip
or
fall ip
is set, an interrupt pin will be raised.
33
Summary of Contents for E300
Page 1: ...SiFive E300 Platform Reference Manual Version 1 0 1 c SiFive Inc ...
Page 2: ...2 SiFive E300 Platform Reference Manual Version 1 0 1 ...
Page 4: ...ii SiFive E300 Platform Reference Manual Version 1 0 1 ...
Page 12: ...4 SiFive E300 Platform Reference Manual Version 1 0 1 ...
Page 14: ...6 SiFive E300 Platform Reference Manual Version 1 0 1 ...
Page 22: ...14 SiFive E300 Platform Reference Manual Version 1 0 1 ...
Page 32: ...24 SiFive E300 Platform Reference Manual Version 1 0 1 ...
Page 40: ...32 SiFive E300 Platform Reference Manual Version 1 0 1 ...
Page 56: ...48 SiFive E300 Platform Reference Manual Version 1 0 1 ...
Page 60: ...52 SiFive E300 Platform Reference Manual Version 1 0 1 ...