This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Using SPI pins as GPIO on UCD3138128 and UCD3138A64

Other Parts Discussed in Thread: UCD3138128

The UCD3138128 and 'A64 have dedicated SPI pins.  Here is how to use them as GPIOs

There are 4 registers  used for GPIO.  Each has 4 bits in it, one for each pin. Here are their effects, pin by pin:

Bit Value 0 1
SPIFUNC Pin is SPI pin Pin is GPIO pin
SPDIR Pin is output Pin is input
SPIGPOUT Pin will output 0 if output Pin will output 1 if output
SPIGPIN Value on pin is 0 Value on pin is 1

Notes:

1. SPIDIR, and SPIGPOUT only have effect if the SPIFUNC bit is a 1. 

2. SPIGPIN shows the value on the pin regardless of the other bits.  It works with the pins in SPI and output mode as well as input mode. 

The bit names aren't exactly the same as the pin names, but it's easy to figure out:

Bit Pin
MISO SPI_MISO
MOSI SPI_MOSI
SCS SPI_CS
SCK SPI_CLK