STM32F1 GPIO

Started by tha, November 15, 2020, 09:29:02 AM

Previous topic - Next topic

tha

9.1.11 GPIO configurations for device peripherals
Table 22 ถึง Table 33 แสดง the GPIO configurations ของ the device peripherals.



1. The USART_TX pin สามารถถูกกำหนดค่าเป็น alternate function open drain ได้อีกด้วย.

tha


tha



1. ตารางนี้ใช้กับ connectivity line devices เท่านั้น.
2. สำหรับ the OTG_FS_VBUS pin (PA9) ถูกใช้โดย peripheral อื่นที่ใช้ร่วมกันหรือเป็น a general-purpose IO, the PHY Power-down mode ต้องถูกทำให้ทำงาน (เคลียร์ bit 16 ใน the OTG_FS_GCCFG register).


tha



     The GPIO configuration ของ the ADC inputs ควรเป็น analog.


tha

9.2 GPIO registers
อ้างอิงถึง Section 2.2 บน page 45 สำหรับรายการตัวย่อที่ใช้ใน register descriptions.
The peripheral registers ต้องถูกเข้าถึงโดย words (32-bit).



Bits 31:30, 27:26,         CNFy[1:0]: Port x configuration bits (y= 0 .. 7)
23:22, 19:18, 15:14,     บิตเหล่านี้ถูกเขียนโดย software เพื่อกำหนดค่า the corresponding I/O port.
11:10, 7:6, 3:2              อ้างอิงถึง  Table 20: Port bit configuration table.
                                    In input mode (MODE[1:0]=00):
                                    00: Analog mode
                                    01: Floating input (reset state)
                                    10: Input with pull-up / pull-down
                                    11: Reserved
                                    In output mode (MODE[1:0] > 00):
                                    00: General purpose output push-pull
                                    01: General purpose output Open-drain
                                    10: Alternate function output Push-pull
                                    11: Alternate function output Open-drain

Bits 29:28, 25:24,          MODEy[1:0]: Port x mode bits (y= 0 .. 7)
21:20, 17:16, 13:12,      บิตเหล่านี้ถูกเขียนโดย software เพื่อกำหนดค่า the corresponding I/O port.
9:8, 5:4, 1:0                  อ้างอิงถึง Table 20: Port bit configuration table.
                                     00: Input mode (reset state)
                                     01: Output mode, max speed 10 MHz.
                                     10: Output mode, max speed 2 MHz.
                                     11: Output mode, max speed 50 MHz.

tha



Bits 31:30, 27:26,         CNFy[1:0]: Port x configuration bits (y= 8 .. 15)
23:22, 19:18, 15:14,     บิตเหล่านี้ถูกเขียนโดย software เพื่อกำหนดค่า the corresponding I/O port.
11:10, 7:6, 3:2              อ้างอิงถึง  Table 20: Port bit configuration table.
                                    In input mode (MODE[1:0]=00):
                                    00: Analog mode
                                    01: Floating input (reset state)
                                    10: Input with pull-up / pull-down
                                    11: Reserved
                                    In output mode (MODE[1:0] > 00):
                                    00: General purpose output push-pull
                                    01: General purpose output Open-drain
                                    10: Alternate function output Push-pull
                                    11: Alternate function output Open-drain

Bits 29:28, 25:24,          MODEy[1:0]: Port x mode bits (y= 8 .. 15)
21:20, 17:16, 13:12,      บิตเหล่านี้ถูกเขียนโดย software เพื่อกำหนดค่า the corresponding I/O port.
9:8, 5:4, 1:0                  อ้างอิงถึง Table 20: Port bit configuration table.
                                     00: Input mode (reset state)
                                     01: Output mode, max speed 10 MHz.
                                     10: Output mode, max speed 2 MHz.
                                     11: Output mode, max speed 50 MHz.


tha



Bits 31:16 Reserved, must be kept at reset value.
Bits 15:0 IDRy: Port input data (y= 0 .. 15)
              บิตเหล่านี้ถูกอ่านได้เพียงอย่างเดียวและสามารถถูกเข้าถึงใน Word mode เท่านั้น. มันบรรจุ the input value ของ the
              corresponding I/O port.

tha



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

Bits 15:0 ODRy: Port output data (y= 0 .. 15)
              บิตเหล่านี้สามารถถูกอ่านและเขียนโดย software และสามารถถูกเข้าถึงใน Word mode เท่านั้น.
      Note: สำหรับ atomic bit set/reset, the ODR bits สามารถเซ็ตและเคลียร์เฉพาะรายโดยการเขียนไปยัง the
              GPIOx_BSRR register (x = A .. G).