587
SAM4CP [DATASHEET]
43051E–ATPL–08/14
whether the pin is configured to be controlled by the PIO Controller or assigned to a peripheral function. This enables
configuration of the I/O line prior to setting it to be managed by the PIO Controller.
Similarly, writing in PIO_SODR and PIO_CODR affects PIO_ODSR. This is important as it defines the first level driven
on the I/O line.
32.5.5 Synchronous Data Output
Clearing one or more PIO line(s) and setting another one or more PIO line(s) synchronously cannot be done by using
PIO_SODR and PIO_CODR registers. It requires two successive write operations into two different registers. To
overcome this, the PIO Controller offers a direct control of PIO outputs by single write access to PIO_ODSR. Only bits
unmasked by the Output Write Status register (PIO_OWSR) are written. The mask bits in PIO_OWSR are set by writing
to the Output Write Enable register (PIO_OWER) and cleared by writing to the Output Write Disable register
(PIO_OWDR).
After reset, the synchronous data output is disabled on all the I/O lines as PIO_OWSR resets at 0x0.
32.5.6 Multi-Drive Control (Open Drain)
Each I/O can be independently programmed in open drain by using the multi-drive feature. This feature permits several
drivers to be connected on the I/O line which is driven low only by each device. An external pull-up resistor (or enabling
of the internal one) is generally required to guarantee a high level on the line.
The multi-drive feature is controlled by the Multi-driver Enable register (PIO_MDER) and the Multi-driver Disable register
(PIO_MDDR). The multi-drive can be selected whether the I/O line is controlled by the PIO Controller or assigned to a
peripheral function. The Multi-driver Status register (PIO_MDSR) indicates the pins that are configured to support
external drivers.
After reset, the multi-drive feature is disabled on all pins, i.e. PIO_MDSR resets at value 0x0.
32.5.7 Output Line Timings
Figure 32-3
shows how the outputs are driven either by writing PIO_SODR or PIO_CODR, or by directly writing
PIO_ODSR. This last case is valid only if the corresponding bit in PIO_OWSR is set.
Figure 32-3
also shows when the
feedback in the Pin Data Status register (PIO_PDSR) is available.
Figure 32-3.
Output Line Timings
32.5.8 Inputs
The level on each I/O line can be read through PIO_PDSR. This register indicates the level of the I/O lines regardless of
their configuration, whether uniquely as an input, or driven by the PIO Controller, or driven by a peripheral.
Reading the I/O line levels requires the clock of the PIO Controller to be enabled, otherwise PIO_PDSR reads the levels
present on the I/O line at the time the clock was disabled.
2 cycles
APB Access
2 cycles
APB Access
Peripheral clock
Write PIO_SODR
Write PIO_ODSR at 1
PIO_ODSR
PIO_PDSR
Write PIO_CODR
Write PIO_ODSR at 0