Below are the generic intialization
steps to configure a UNICOMM instance and the recommended order for software to
execute these steps. Peripheral specific initializations are listed in the
respective sections.
- Put the UNICOMM instance into
reset by setting the RSCTL.RESETASSERT register bit from Section 22.6.
- Enable power to the UNICOMM
instance by writing "0h26" to the KEY field and setting the EN bit for the
PWREN register in the UNICOMM_REGS registers. Wait four or more cycles after
this is set before writing to the individual peripheral registers.
- Configure the peripheral mode
for the UCx instance in the IPMODE.SELECT field from the UNICOMM_REGS
registers to operate as a UART, SPI, I2C Controller, or I2C Target.
- Enable the pin functionality
for each GPIO being used in the peripheral configuration in the IOMUX_REGS
registers. See the Chapter 13 section for more information.
Note: IOMUX configurations must
be done after the peripheral mode (IPMODE.SELECT) is configured
(previous step).
- (Optionally) Configure the
inter-module internal loopback/pairing settings in the SPG_REGS registers
between two UCx modules in the same SPG. See Figure 22-1 to determine which UCx pairings are available on this
device.
- Configure the
loopback pairs (maximum of one pair per SPG module) in the LPBKx
register field.
- Configure the I2C
pairs (maximum of one pair per SPG module) in the PAIRx register
field.
- Configure the below settings
in the UNICOMMUART_REGS / UNICOMMSPI_REGS / UNICOMMI2CC_REGS /
UNICOMMI2CT_REGS registers .
- To enable clocking of the UNICOMM module, configure the
clock source in the CLKSEL register to be MCLKDIV2, the functional
clock of UNICOMM.
- Configure the clock
divider for the UNICOMM instance's peripheral-specific functional
clock in the CLKDIV.RATIO register field. This decides how much to
divide down the overall UNICOMM clock source for each specific
UNICOMM instance clock.
- Perform
peripheral-specific initializations (example: SPI peripheral vs.
controller mode, UART baud rate etc.) Follow the detailed steps in
in the UART Initialization, SPI Initialization, I2C Controller Initialization, and I2C Target Initialization chapters.