English
Language : 

UPSD3354DV-40U6 Datasheet, PDF (82/272 Pages) STMicroelectronics – fast 8032 MCU with programmable logic
I/O ports of MCU module
UPSD33xx
17.1.4 Alternate functions
There are five SFRs used to control the mapping of alternate functions onto MCU port pins,
and these SFRs are depicted as switches in Figure 15 on page 78.
● Port 3 uses the SFR, P3SFS (Table 39 on page 83).
● Port 1 uses SFRs, P1SFS0 (Table 41 on page 83) and P1SFS1 (Table 42 on page 83).
● Port 4 uses SFRs, P4SFS0 (Table 44 on page 84) and P4SFS1 (Table 45 on page 84).
Since these SFRs are cleared by a reset, then by default all port pins function as GPIO (not
the alternate function) until firmware initializes these SFRs.
Each pin on each of the three ports can be independently assigned a different function on a
pin-by-pin basis.
The peripheral functions Timer 2, UART1, and I2C may be split independently between Port
1 and Port 4 for additional flexibility by giving a wider choice of peripheral usage on a limited
number of device pins.
When the selected alternate function is UART0, UART1, or SPI, then the related pins are in
quasi-bidirectional mode, including the use of the high-side driver for rapid 0-to-1 output
) transitions. The high-side driver is enabled for just one MCU_CLK period on 0-to-1
t(s transitions by the delay function at the “digital_alt_func_data_out” signal pictured in
c Figure 16 through Figure 18 on page 80.
u If the alternate function is Timer 0, Timer 1, Timer 2, or PCA input, then the related pins are
rod in quasi-bidirectional mode, but input only.
P If the alternate function is ADC, then for each pin the pull-ups, the high-side driver, and the
low-side driver are disabled. The analog input is routed directly to the ADC unit. Only Port 1
te supports analog functions (Figure 16 on page 79). Port 1 is not 5 V tolerant.
ole If the alternate function is I2C, the related pins will be in open drain mode, which is just like
s quasi-bidirectional mode but the high-side driver is not enabled for one cycle when
b outputting a 0-to-1 transition. Only the low-side driver and the internal weak pull-ups are
O used. Only Port 3 supports open-drain mode (Figure 17 on page 79). I2C requires the use of
- an external pull-up resistor on each bus signal, typically 4.7kΩ to VCC.
t(s) If the alternate function is PCA output, then the related pins are in push-pull mode, meaning
the pins are actively driven and held to logic '1' by the high-side driver, or actively driven and
uc held to logic '0' by the low-side driver. Only Port 4 supports push-pull mode (Figure 18 on
d page 80). Port 4 push-pull pins can source IOH current when driving logic '1,' and sink IOL
ro current when driving logic '0.' This current is significantly more than the capability of pins on
P Port 1 or Port 3 (see Table 166 on page 249).
teFor example, to assign these port functions:
le● Port 1: UART1, ADC[1:0], P1[7:4] are GPIO
o ● Port 3: UART0, I2C, P3[5:2] are GPIO
Obs ● Port 4: TCM0, SPI, P4[3:1] are GPIO
The following values need to be written to the SFRs:
● P1SFS0 = 00001111b, or 0Fh
● P1SFS1 = 00000011b, or 03h
● P3SFS = 11000011b, or C3h
● P4SFS0 = 11110001b, or F1h
● P4SFS1 = 11110000b, or F0h
82/272
Doc ID 9685 Rev 7