본문 바로가기
임베디드.일렉트로닉스/STM32

STM32L4x6. GPIO 일반.

by i.got.it 2018. 5. 5.


GPIO



Each general-purpose I/O port has four 32-bit configuration registers (GPIOx_MODER, GPIOx_OTYPER, GPIOx_OSPEEDR and GPIOx_PUPDR), two 32-bit data registers (GPIOx_IDR and GPIOx_ODR) and a 32-bit set/reset register (GPIOx_BSRR). In addition all GPIOs have a 32-bit locking register (GPIOx_LCKR) and two 32-bit alternate function selection registers (GPIOx_AFRH and GPIOx_AFRL).




GPIO main features

• Output states: push-pull or open drain + pull-up/down

• Output data from output data register (GPIOx_ODR) or peripheral (alternate function output)

• Speed selection for each I/O

• Input states: floating, pull-up/down, analog

• Input data to input data register (GPIOx_IDR) or peripheral (alternate function input)

Bit set and reset register (GPIOx_ BSRR) for bitwise write access to GPIOx_ODR

• Locking mechanism (GPIOx_LCKR) provided to freeze the I/O port configurations

• Analog function

• Alternate function selection registers

• Fast toggle capable of changing every two clock cycles

• Highly flexible pin multiplexing allows the use of I/O pins as GPIOs or as one of several peripheral functions


GPIO functional description

Subject to the specific hardware characteristics of each I/O port listed in the datasheet, each port bit of the general-purpose I/O (GPIO) ports can be individually configured by software in several modes:


• Input floating

• Input pull-up

• Input-pull-down

• Analog

• Output open-drain with pull-up or pull-down capability

• Output push-pull with pull-up or pull-down capability

• Alternate function push-pull with pull-up or pull-down capability

• Alternate function open-drain with pull-up or pull-down capability


Each I/O port bit is freely programmable, however the I/O port registers have to be accessed as 32-bit words, half-words or bytes. The purpose of the GPIOx_BSRR and GPIOx_BRR registers is to allow atomic read/modify accesses to any of the GPIOx_ODR registers. In this way, there is no risk of an IRQ occurring between the read and the modify access.




from : RM0351 STM32L4x6 Reference Manual page 295



GPIO Registers

from : RM0351 STM32L4x6 Reference Manual page 303 ~ 311 









///1644

댓글



 

비트코인




암호화폐       외환/나스닥/골드         암호화폐/외환/나스닥/골드
     
현물 |선물 인버스 |선물 USDT       전략매니저(카피트레이딩)         프랍 트레이더 온라인 지원가능. MT4,MT5