7.5.3 GPIO Configuration
Register priority: If GPIO pins are used, follow this procedure:
First, configure individual I/O bits as either inputs or outputs (Register 8); 0 = input, 1 = output. Bits B0 to B6 are connected to GPIO0 to GPIO6, respectively.
Then, configure individual bits to the desired function. When configuring for output, set the Data Register (Register 5) first to avoid glitches.
To configure the GPIO pins for the CS function (see Register 9):
- Configure ECS (0 = disable, 1 = enable). If set to 1 and the I/O configuration is set to output as well, this pin becomes ECS. Details of this configuration are described in , CS Mode.
- Configure for clock polarity (CP), relative to ECS in Register 2; see Register 9. Set this bit to 0: a negative edge of SCLK follows ECS (CP = 1). Set this bit to 1: a positive edge of SCLK follows ECS (CP = 0).
- Configure for special function (Register 12): Special function signals can be assigned to the GPIO pins in this manner: 0 = disable, 1 = enable. Pins xxout must be configured as outputs, and xxin must be configured as inputs in Register 8.
- GPIO data to force (Register 5) GPIO data (1 = low, 0 = high). Forcing a bit, which is assigned to a special function, may be stored until GPIO is enabled.
Data may be stored in internal registers and therefore may show on a given GPIO pin after the configuration is changed.