STM32 PDF
STM32 PDF
See Table on
following page
Note: During and just after reset, the alternate functions are not active
and the I/O ports are configured in Input Floating mode
(CNFx[1:0]=01b, MODEx[1:0]=00b)
GPIO Configuration: Output MODE Bits
GPIO Operation
During and just after reset, the alternate functions are not
active and the I/O ports are configured in Input Floating mode
(CNFx[1:0]=01b, MODEx[1:0]=00b)
When configured as output, the value written to the Output
Data register (GPIOx_ODR) is output on the I/O pin.
It is possible to use the output driver in Push-Pull mode or Open-Drain
mode (only the N-MOS is activated when outputting 0).
The Input Data register (GPIOx_IDR) captures the data present
on the I/O pin at every APB2 clock cycle
All GPIO pins have an internal weak pull-up and weak pull-
down which can be activated or not when configured as input
GPIO Atomic Bit Set or Reset
Atomic Read/Modify access
No interruption in the middle to cause errors
Atomic operations ensure that the desired change is not
interrupted resulting in partial set/reset of GPIOs
There is no need for the software to disable interrupts when
programming the GPIOx_ODR at bit level: it is possible to
modify only one or several bits in a single atomic APB2 write
access
This is achieved by programming to ‘1’ the Bit Set/Reset
Register (GPIOx_BSRR, or for reset only GPIOx_BRR) to select
the bits you want to modify.
Unselected bits will not be modified
Input Configuration
When the I/O Port is programmed as Input:
The Output Buffer is disabled
The Schmitt Trigger Input is activated
The weak pull-up and pull-down resistors are activated or not
depending on input configuration (pull-up, pull-down or floating)
The data present on the I/O pin is sampled into the Input Data Register
every APB2 clock cycle
A read access to the Input Data Register obtains the I/O State
Input Configuration
Output Configuration
When the I/O Port is programmed as Output:
The Output Buffer is enabled:
Open Drain Mode: A “0” in the Output register activates the N-MOS while a
“1” in the Output register leaves the port in Hi-Z. (the P-MOS is never
activated)
Push-Pull Mode: A “0” in the Output register activates the N-MOS while a “1” in
the Output register activates the P-MOS
The Schmitt Trigger Input is activated.
The weak pull-up and pull-down resistors are disabled.
The data present on the I/O pin is sampled into the Input Data Register
every APB2 clock cycle
Read access to Input Data Register gets the I/O state in open drain mode
Read access to Output Data register gets last written value in Push-Pull
mode
Output Configuration
Compare to input
configuration
Alternate Function Configuration
When the I/O Port is programmed as Alternate Function:
The Output Buffer is turned on in Open Drain or Push-Pull configuration
The Output Buffer is driven by the signal coming from the peripheral
(alternate function out)
The Schmitt Trigger Input is activated
The weak pull-up and pull-down resistors are disabled
The data present on the I/O pin is sampled into the Input Data Register
every APB2 clock cycle
A read access to the Input Data Register gets the I/O state in open
drain mode
A read access to the Output Data register gets the last written value in
Push-Pull mode
Alternate Function Configuration
Analog Configuration
When the I/O Port is programmed as Analog configuration:
The Output Buffer is disabled.
The Schmitt Trigger Input is de-activated providing zero consumption for
every analog value of the I/O pin. The output of the Schmitt Trigger is
forced to a constant value (0).
The weak pull-up and pull-down resistors are disabled.
Read access to the Input Data Register gets the value “0”.
Analog Configuration
GPIO Registers
GPIO Registers
GPIO Registers
Assignments
ARM Project #1 (To start this week)
STM32
MICROCONTROLLER
TIM_CounterModeConfig
TIM_SetCounter
TIM_SetAutoreload
TIM_PrescalerConfig
TIM_ITConfig
TIM_Cmd
TIM_ClearITPendingBit
Note: Modify only files in the “User” group of your project and never change the
standard peripheral drivers since they will affect other programs not just the one you
are working on at the time. Modification of such files will result in deducting points off
your project grade.
Assignments
ARM Project #4
STM32 MICROCONTROLLER:
DIGITAL-TO-ANALOG
CONVERTER (DAC)