
EM358x
Rev. 0.4
75
8.2 Configuration
Before using a serial controller, configure and initialize it as follows:
Set up the parameters specific to the operating mode (master/slave for SPI, baud rate for UART, etc.).
Configure the GPIO pins used by the serial controller as shown in Table 8-1 and Table 8-2. Section 2 in
Chapter 7, GPIO shows how to configure GPIO pins.
If using DMA, set up the DMA and buffers. This is described fully in section 8.7.
If using interrupts, select edge- or level-triggered interrupts with the SCx_INTMODE register, enable the
desired second-level interrupt sources in the INT_SCxCFG register, and finally enable the top-level SCx
interrupt in the NVIC.
Write the serial interface operating mode — SPI, TWI, or UART — to the SCx_MODE register.
Table 8-1. SC1 GPIO Usage and Configuration
PB1
PB2
PB3
PB4
SPI - Master
SC1MOSI
Alternate Output
(push-pull)
SC1MISO
Input
SC1SCLK
Alternate Output
(push-pull)
(not used)
SPI - Slave
SC1MISO
Alternate Output
(push-pull), SPI
Slave MISO Mode
SC1MOSI
Input
SC1SCLK
Input
SC1nSSEL
Input
TWI - Master
SC1SDA
Alternate Output
(open-drain)
SC1SCL
Alternate Output
(open-drain)
(not used)
(not used)
UART
TXD
Alternate Output
(push-pull)
RXD
Input
nCTS
Input
1
nRTS
Alternate Output (push-
pull)
1
1
used if RTS/CTS hardware flow control is enabled.
Table 8-2. SC2 GPIO Usage and Configuration
PA0
PA1
PA2
PA3
SPI - Master
SC2MOSI
Alternate Output
(push-pull)
SC2MISO
Input
SC2SCLK
Alternate Output
(push-pull)
(not used)
SPI - Slave
SC2MOSI
Input
SC2MISO
Alternate Output
(push-pull), SPI
Slave MISO Mode
SC2SCLK
Input
SC2nSSEL
Input
TWI - Master
(not used)
SC2SDA
Alternate Output
(open-drain)
SC2SCL
Alternate Output
(open-drain)
(not used)
Содержание EMBER EM358 series
Страница 2: ...EM358x 2 Rev 0 4 ...
Страница 7: ...EM358x Rev 0 4 7 ...