2.19. GPIO: Unterschied zwischen den Versionen
Zeile 101: | Zeile 101: | ||
|29||SPI1 CSn||UART0 RX||I2C0 SCL||PWM6 B||SIO||PIO0||PIO1|| ||USB VBUS EN | |29||SPI1 CSn||UART0 RX||I2C0 SCL||PWM6 B||SIO||PIO0||PIO1|| ||USB VBUS EN | ||
|} | |} | ||
Für jeden GPIO kann jeweils nur eine Funktion ausgewählt werden. Ebenso sollte jeder Peripherieeingang (z.B. UART0 RX) nur | |||
jeweils an einem GPIO ausgewählt werden.<br> | |||
Wenn derselbe Peripherieeingang mit mehreren GPIOs verbunden ist, sieht das Peripheriegerät das logische ODER dieser GPIO-Eingänge. | |||
== Interrupts == | == Interrupts == |
Version vom 18. Juli 2024, 21:40 Uhr
Hier geht es um die Programmierung der GPIO's
Inhalt dieser Seite
2.19.1. Overview
2.19.2. Function Select
2.19.3. Interrupts
2.19.4. Pads
2.19.5. Software Examples
2.19.6. List of Registers
Overview
Der RP2040 hat 36 multifunktionale General Purpose Input / Output (GPIO) Pins, aufgeteilt in zwei Bänke.
Davon stehen 30 als User-Bank GPIO0 - GPIO29 zur allgemeinen Verwendung zur Verfügung. Die übrigen 6 bilden die QSPI Schnittstelle zur Ansteuerung von externen Speichern.
Alle GPIOs unterstützen digitale Ein- und Ausgänge, aber GPIO26 bis GPIO29 können auch als Eingänge für den Analog-Digital-Wandler (ADC) des Chips verwendet werden.
Jeder GPIO kann direkt von der auf den Prozessoren laufenden Software oder von einer Reihe anderer Funktionsblöcke gesteuert werden.
Die Benutzer-GPIO-Bank unterstützt die folgenden Funktionen:
- Software control via SIO (Single-Cycle IO) - Section 2.3.1.2, “GPIO Control”
- Programmable IO (PIO) - Chapter 3, PIO
- 2 × SPI - Section 4.4, “SPI”
- 2 × UART - Section 4.2, “UART”
- 2 × I2C (two-wire serial interface) - Section 4.3, “I2C”
- 8 × two-channel PWM - Section 4.5, “PWM”
- 2 × external clock inputs - Section 2.15.2.3, “External Clocks”
- 4 × general purpose clock output - Section 2.15, “Clocks”
- 4 × input to ADC - Section 4.9, “ADC and Temperature Sensor”
- USB VBUS management - Section 4.1.2.8, “VBUS Control”
- External interrupt requests, level or edge-sensitive
Die QSPI Bank unterstützt die folgenden Funktionen:
- Software control via SIO (Single-Cycle IO) - Section 2.3.1.2, “GPIO Control”
- Flash execute in place (XIP) - Section 2.6.3, “Flash”
Function Select
Die jedem GPIO zugewiesene Funktion wird durch Schreiben in das FUNCSEL-Feld im CTRL-Register des GPIO ausgewählt.
Siehe GPIO0_CTRL als Beispiel.
Die für jeden IO verfügbaren Funktionen sind in Tabelle 279 und Tabelle 281 aufgeführt.
GPIO | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 |
---|---|---|---|---|---|---|---|---|---|
0 | SPI0 RX | UART0 TX | I2C0 SDA | PWM0 A | SIO | PIO0 | PIO1 | USB OVCUR DET | |
1 | SPI0 CSn | UART0 RX | I2C0 SCL | PWM0 B | SIO | PIO0 | PIO1 | USB VBUS DET | |
2 | SPI0 SCK | UART0 CTS | I2C1 SDA | PWM1 A | SIO | PIO0 | PIO1 | USB VBUS EN | |
3 | SPI0 TX | UART0 RTS | I2C1 SCL | PWM1 B | SIO | PIO0 | PIO1 | USB OVCUR DET | |
4 | SPI0 RX | UART1 TX | I2C0 SDA | PWM2 A | SIO | PIO0 | PIO1 | USB VBUS DET | |
5 | SPI0 CSn | UART1 RX | I2C0 SCL | PWM2 B | SIO | PIO0 | PIO1 | USB VBUS EN | |
6 | SPI0 SCK | UART1 CTS | I2C1 SDA | PWM3 A | SIO | PIO0 | PIO1 | USB OVCUR DET | |
7 | SPI0 TX | UART1 RTS | I2C1 SCL | PWM3 B | SIO | PIO0 | PIO1 | USB VBUS DET | |
8 | SPI1 RX | UART1 TX | I2C0 SDA | PWM4 A | SIO | PIO0 | PIO1 | USB VBUS EN | |
9 | SPI1 CSn | UART1 RX | I2C0 SCL | PWM4 B | SIO | PIO0 | PIO1 | USB OVCUR DET | |
10 | SPI1 SCK | UART1 CTS | I2C1 SDA | PWM5 A | SIO | PIO0 | PIO1 | USB VBUS DET | |
11 | SPI1 TX | UART1 RTS | I2C1 SCL | PWM5 B | SIO | PIO0 | PIO1 | USB VBUS EN | |
12 | SPI1 RX | UART0 TX | I2C0 SDA | PWM6 A | SIO | PIO0 | PIO1 | USB OVCUR DET | |
13 | SPI1 CSn | UART0 RX | I2C0 SCL | PWM6 B | SIO | PIO0 | PIO1 | USB VBUS DET | |
14 | SPI1 SCK | UART0 CTS | I2C1 SDA | PWM7 A | SIO | PIO0 | PIO1 | USB VBUS EN | |
15 | SPI1 TX | UART0 RTS | I2C1 SCL | PWM7 B | SIO | PIO0 | PIO1 | USB OVCUR DET | |
16 | SPI0 RX | UART0 TX | I2C0 SDA | PWM0 A | SIO | PIO0 | PIO1 | USB VBUS DET | |
17 | SPI0 CSn | UART0 RX | I2C0 SCL | PWM0 B | SIO | PIO0 | PIO1 | USB VBUS EN | |
18 | SPI0 SCK | UART0 CTS | I2C1 SDA | PWM1 A | SIO | PIO0 | PIO1 | USB OVCUR DET | |
19 | SPI0 TX | UART0 RTS | I2C1 SCL | PWM1 B | SIO | PIO0 | PIO1 | USB VBUS DET | |
20 | SPI0 RX | UART1 TX | I2C0 SDA | PWM2 A | SIO | PIO0 | PIO1 | CLOCK GPIN0 | USB VBUS EN |
21 | SPI0 CSn | UART1 RX | I2C0 SCL | PWM2 B | SIO | PIO0 | PIO1 | CLOCK GPOUT0 | USB OVCUR DET |
22 | SPI0 SCK | UART1 CTS | I2C1 SDA | PWM3 A | SIO | PIO0 | PIO1 | CLOCK GPIN1 | USB VBUS DET |
23 | SPI0 TX | UART1 RTS | I2C1 SCL | PWM3 B | SIO | PIO0 | PIO1 | CLOCK GPOUT1 | USB VBUS EN |
24 | SPI1 RX | UART1 TX | I2C0 SDA | PWM4 A | SIO | PIO0 | PIO1 | CLOCK GPOUT2 | USB OVCUR DET |
25 | SPI1 CSn | UART1 RX | I2C0 SCL | PWM4 B | SIO | PIO0 | PIO1 | CLOCK GPOUT3 | USB VBUS DET |
26 | SPI1 SCK | UART1 CTS | I2C1 SDA | PWM5 A | SIO | PIO0 | PIO1 | USB VBUS EN | |
27 | SPI1 TX | UART1 RTS | I2C1 SCL | PWM5 B | SIO | PIO0 | PIO1 | USB OVCUR DET | |
28 | SPI1 RX | UART0 TX | I2C0 SDA | PWM6 A | SIO | PIO0 | PIO1 | USB VBUS DET | |
29 | SPI1 CSn | UART0 RX | I2C0 SCL | PWM6 B | SIO | PIO0 | PIO1 | USB VBUS EN |
Für jeden GPIO kann jeweils nur eine Funktion ausgewählt werden. Ebenso sollte jeder Peripherieeingang (z.B. UART0 RX) nur
jeweils an einem GPIO ausgewählt werden.
Wenn derselbe Peripherieeingang mit mehreren GPIOs verbunden ist, sieht das Peripheriegerät das logische ODER dieser GPIO-Eingänge.
Interrupts
Pads
Software Examples
List of Registers
zurück zu The_Core_-_RP2040
zurück zu Raspberry_Pi_Pico_-_RP2040
zurück zu Microcontroller
Zurück zur Hauptseite