summaryrefslogtreecommitdiffstatshomepage
path: root/docs/mimxrt
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2025-03-13 16:50:27 +0100
committerDamien George <damien@micropython.org>2025-03-25 12:44:20 +1100
commitcdcc70d4f86b2948db4003c7ed55092b628394a8 (patch)
tree0fe657602273d830870570d00966cfda020da849 /docs/mimxrt
parent1e7328ca28de201d6cd1ef31fb64e37613c0f9fb (diff)
downloadmicropython-cdcc70d4f86b2948db4003c7ed55092b628394a8.tar.gz
micropython-cdcc70d4f86b2948db4003c7ed55092b628394a8.zip
mimxrt: Enable default devices for I2C, SPI and UART.
Since all boards are configured to have a I2C(0), SPI(0) and UART(1), these can be set as default devices, allowing the instantiation of I2C(), SPI(), UART() without an id argument. Signed-off-by: robert-hh <robert@hammelrath.com>
Diffstat (limited to 'docs/mimxrt')
-rw-r--r--docs/mimxrt/quickref.rst12
1 files changed, 11 insertions, 1 deletions
diff --git a/docs/mimxrt/quickref.rst b/docs/mimxrt/quickref.rst
index 49d7befc74..9f1efd4ffc 100644
--- a/docs/mimxrt/quickref.rst
+++ b/docs/mimxrt/quickref.rst
@@ -122,10 +122,13 @@ See :ref:`machine.UART <machine.UART>`. ::
uart1 = UART(1, baudrate=115200)
uart1.write('hello') # write 5 bytes
uart1.read(5) # read up to 5 bytes
+ uart1 = UART(baudrate=19200) # open UART 1 at 19200 baud
The i.MXRT has up to eight hardware UARTs, but not every board exposes all
TX and RX pins for users. For the assignment of Pins to UART signals,
-refer to the :ref:`UART pinout <mimxrt_uart_pinout>`.
+refer to the :ref:`UART pinout <mimxrt_uart_pinout>`. If the UART ID is
+omitted, UART(1) is selected. Then, the keyword
+option for baudrate must be used to change it from the default value.
PWM (pulse width modulation)
----------------------------
@@ -305,12 +308,15 @@ rates (up to 30Mhz). Hardware SPI is accessed via the
cs_pin(0)
spi.write('Hello World')
cs_pin(1)
+ spi = SPI(baudrate=4_000_000) # Use SPI(0) at a baudrate of 4 MHz
For the assignment of Pins to SPI signals, refer to
:ref:`Hardware SPI pinout <mimxrt_spi_pinout>`.
The keyword option cs=n can be used to enable the cs pin 0 or 1 for an automatic cs signal. The
default is cs=-1. Using cs=-1 the automatic cs signal is not created.
In that case, cs has to be set by the script. Clearing that assignment requires a power cycle.
+If the SPI ID is omitted, SPI(0) is selected. Then, the keyword
+option for baudrate must be used to change it from the default value.
Notes:
@@ -355,6 +361,10 @@ has the same methods as software SPI above::
i2c = I2C(0, 400_000)
i2c.writeto(0x76, b"Hello World")
+ i2c = I2C(freq=100_000) # use I2C(0) at 100kHz
+
+If the I2C ID is omitted, I2C(0) is selected. Then, the keyword
+option for freq must be used to change the freq from the default value.
I2S bus
-------