diff options
author | Mike Causer <mcauser@gmail.com> | 2021-04-30 14:05:33 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2021-05-06 15:44:53 +1000 |
commit | b98197f950b572aff2a34934e64d094e5cea6cd5 (patch) | |
tree | 978cab80d9f09c8fd79cb8e8a72f71a02d4e0ad3 /docs/esp32 | |
parent | 47583d8cbd251d9cb3b0f4a70c5594d1329ad930 (diff) | |
download | micropython-b98197f950b572aff2a34934e64d094e5cea6cd5.tar.gz micropython-b98197f950b572aff2a34934e64d094e5cea6cd5.zip |
docs/esp32: Add UART to quickref.
Diffstat (limited to 'docs/esp32')
-rw-r--r-- | docs/esp32/quickref.rst | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/docs/esp32/quickref.rst b/docs/esp32/quickref.rst index c29688f000..2a9c8397c8 100644 --- a/docs/esp32/quickref.rst +++ b/docs/esp32/quickref.rst @@ -171,6 +171,33 @@ Notes: * The pull value of some pins can be set to ``Pin.PULL_HOLD`` to reduce power consumption during deepsleep. +UART (serial bus) +----------------- + +See :ref:`machine.UART <machine.UART>`. :: + + from machine import UART + + uart1 = UART(1, baudrate=9600, tx=33, rx=32) + uart1.write('hello') # write 5 bytes + uart1.read(5) # read up to 5 bytes + +The ESP32 has three hardware UARTs: UART0, UART1 and UART2. +They each have default GPIO assigned to them, however depending on your +ESP32 variant and board, these pins may conflict with embedded flash, +onboard PSRAM or peripherals. + +Any GPIO can be used for hardware UARTs using the GPIO matrix, so to avoid +conflicts simply provide ``tx`` and ``rx`` pins when constructing. The default +pins listed below. + +===== ===== ===== ===== +\ UART0 UART1 UART2 +===== ===== ===== ===== +tx 1 10 17 +rx 3 9 16 +===== ===== ===== ===== + PWM (pulse width modulation) ---------------------------- |