STM32F7 6 General-purpose I/Os (GPIO)

Started by tha, October 25, 2022, 02:48:57 PM

Previous topic - Next topic

tha

6.3.13 Using the HSE or LSE oscillator pins as GPIOs

เมื่อ the HSE or LSE oscillator ถูก switched OFF (สถานะเริ่มต้นหลังจาก reset), the related oscillator pins สามารถถูกใช้เป็น normal GPIOs.

เมื่อ the HSE or LSE oscillator ถูก switched ON (โดยการเซ็ต the HSEON or LSEON bit ใน the RCC_CSR register) the oscillator จะควบคุม pins ที่เกี่ยวข้องของมันและ the GPIO configuration ของ pins เหล่านี้จะไม่มีผลอะไร.

เมื่อ the oscillator ถูกกำหนดค่าใน a user external clock mode, เฉพาะ the OSC_IN หรือ OSC32_IN pin ถูกสงวนไว้สำหรับ clock input และ the OSC_OUT or OSC32_OUT pin ยังคงสามารถถูกใช้สำหรับ normal GPIO.

tha

6.3.14 Using the GPIO pins in the backup supply domain

The PC13/PC14/PC15/PI8 GPIO functionality จะสูญหายเมื่อ the core supply domain ถูก powered off (เมื่อ the device เข้าสู่ Standby mode). ในกรณีนี้, ถ้า GPIO configuration ของพวกมันไม่ถูกข้ามผ่านโดย the RTC configuration, pins เหล่านี้จะถูกเซ็ตใน an analog input mode.

tha

6.4 GPIO registers

section นี้ให้ a detailed description ของ the GPIO registers.
สำหรับข้อมูลสรุปของ register bits, register address offsets and reset values, ดูที่ Table 23.
The peripheral registers สามารถถูกเขียนใน word, half word or byte mode.

6.4.1 GPIO port mode register (GPIOx_MODER) (x =A to K)

Address offset:0x00
Reset value:
•   0xA800 0000 for port A
•   0x0000 0280 for port B
•   0x0000 0000 for other ports



Bits 31:0 MODER[15:0][1:0]: Port x configuration I/O pin y (y = 15 to 0)
     บิตเหล่านี้ถูกเขียนโดย software เพื่อกำหนดค่า the I/O mode.
     00: Input mode (reset state)
     01: General purpose output mode
     10: Alternate function mode
     11: Analog mode


tha

6.4.2 GPIO port output type register (GPIOx_OTYPER) (x = A to K)

Address offset: 0x04
Reset value: 0x0000 0000



Bits 31:16 Reserved, must be kept at reset value.

Bits 15:0 OT[15:0]: Port x configuration I/O pin y (y = 15 to 0)
     บิตเหล่านี้ถูกเขียนโดย software เพื่อกำหนดค่า the I/O output type.
     0: Output push-pull (reset state)
     1: Output open-drain

tha

6.4.3 GPIO port output speed register (GPIOx_OSPEEDR) (x = A to K)

Address offset: 0x08
Reset value: 0x0C00 0000 (for port A)
Reset value: 0x0000 00C0 (for port B)
Reset value: 0x0000 0000 (for other ports)



Bits 31:0 OSPEEDR[15:0][1:0]: Port x configuration I/O pin y (y = 15 to 0)
     บิตเหล่านี้ถูกเขียนโดย software เพื่อกำหนดค่า the I/O output speed.
     00: Low speed
     01: Medium speed
     10: High speed
     11: Very high speed
  Note: ดูที่ the product datasheets สำหรับค่าของ OSPEEDRy bits เทียบกับ VDD range และ external load.

tha

6.4.4 GPIO port pull-up/pull-down register (GPIOx_PUPDR) (x = A to K)

Address offset: 0x0C
Reset value: 0x6400 0000 (for port A)
Reset value: 0x0000 0100 (for port B)
Reset value: 0x0000 0000 (for other ports)



Bits 31:0 PUPDR[15:0][1:0]: Port x configuration I/O pin y (y = 15 to 0)
     บิตเหล่านี้ถูกเขียนโดย software เพื่อกำหนดค่า the I/O pull-up or pull-down
     00: No pull-up, pull-down
     01: Pull-up
     10: Pull-down
     11: Reserved

tha

6.4.5 GPIO port input data register (GPIOx_IDR) (x = A to K)

Address offset: 0x10
Reset value: 0x0000 XXXX



Bits 31:16 Reserved, must be kept at reset value.

Bits 15:0 IDR[15:0]: Port x input data I/O pin y (y = 15 to 0)
     บิตเหล่านี้อ่านได้เพียงอย่างเดียว. พวกมันบรรจุ the input value ของ the corresponding I/O port.

tha

6.4.6 GPIO port output data register (GPIOx_ODR) (x = A to K)

Address offset: 0x14
Reset value: 0x0000 0000



Bits 31:16 Reserved, must be kept at reset value.

Bits 15:0 ODR[15:0]: Port output data I/O pin y (y = 15 to 0)
     บิตเหล่านี้สามารถถูกอ่านและถูกเขียนโดย software.
     Note: สำหรับ atomic bit set/reset, the ODR bits สามารถถูกเซ็ตและ/หรือรีเซ็ตเป็นรายบิตโดยการเขียนไปยัง the
              GPIOx_BSRR or GPIOx_BRR registers (x = A..F).