8000 docs: Add quickref and docs for mimxrt, including network.LAN docs. · micropython/micropython@7a447e0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7a447e0

Browse files
robert-hhdpgeorge
authored andcommitted
docs: Add quickref and docs for mimxrt, including network.LAN docs.
1 parent 71344c1 commit 7a447e0

File tree

10 files changed

+1235
-0
lines changed

10 files changed

+1235
-0
lines changed

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ MicroPython documentation and references
1212
esp8266/quickref.rst
1313
esp32/quickref.rst
1414
rp2/quickref.rst
15+
mimxrt/quickref.rst
1516
wipy/quickref.rst
1617
unix/quickref.rst
1718
zephyr/quickref.rst

docs/library/machine.PWM.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ Methods
7878

7979
With a single *value* argument the pulse width is set to that value.
8080

81+
Specific PWM class implementations
82+
----------------------------------
83+
84+
The following concrete class(es) implement enhancements to the PWM class.
85+
86+
| :ref:`pyb.Timer for PyBoard <pyb.Timer>`
87+
8188
Limitations of PWM
8289
------------------
8390

@@ -90,6 +97,11 @@ Limitations of PWM
9097
80000000 / 267 = 299625.5 Hz, not 300kHz. If the divider is set to 266 then
9198
the PWM frequency will be 80000000 / 266 = 300751.9 Hz, but again not 300kHz.
9299

100+
Some ports like the RP2040 one use a fractional divider, which allow a finer
101+
granularity of the frequency at higher frequencies by switching the PWM
102+
pulse duration between two adjacent values, such that the resulting average
103+
frequency is more close to the intended one, at the cost of spectral purity.
104+
93105
* The duty cycle has the same discrete nature and its absolute accuracy is not
94106
achievable. On most hardware platforms the duty will be applied at the next
95107
frequency period. Therefore, you should wait more than "1/frequency" before

docs/library/machine.SDCard.rst

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,46 @@ You can set the pins used for SPI access by passing a tuple as the
122122

123123
*Note:* The current cc3200 SD card implementation names the this class
124124
:class:`machine.SD` rather than :class:`machine.SDCard` .
125+
126+
mimxrt
127+
``````
128+
129+
The SDCard module for the mimxrt port only supports access via dedicated SD/MMC
130+
peripheral (USDHC) in 4-bit mode with 50MHz clock frequency exclusively.
131+
Unfortunately the MIMXRT1011 controller does not support the USDHC peripheral.
132+
Hence this controller does not feature the ``machine.SDCard`` module.
133+
134+
Due to the decision to only support 4-bit mode with 50MHz clock frequency the
135+
interface has been simplified, and the constructor signature is:
136+
137+
.. class:: SDCard(slot=1)
138+
:noindex:
139+
140+
The pins used for the USDHC peripheral have to be configured in ``mpconfigboard.h``.
141+
Most of the controllers supported by the mimxrt port provide up to two USDHC
142+
peripherals. Therefore the pin configuration is performed using the macro
143+
``MICROPY_USDHCx`` with x being 1 or 2 respectively.
144+
145+
The following shows an example configuration for USDHC1::
146+
147+
#define MICROPY_USDHC1 \
148+
{ \
149+
.cmd = { GPIO_SD_B0_02_USDHC1_CMD}, \
150+
.clk = { GPIO_SD_B0_03_USDHC1_CLK }, \
151+
.cd_b = { GPIO_SD_B0_06_USDHC1_CD_B },\
152+
.data0 = { GPIO_SD_B0_04_USDHC1_DATA0 },\
153+
.data1 = { GPIO_SD_B0_05_USDHC1_DATA1 },\
154+
.data2 = { GPIO_SD_B0_00_USDHC1_DATA2 },\
155+
.data3 = { GPIO_SD_B0_01_USDHC1_DATA3 },\
156+
}
157+
158+
If the card detect pin is not used (cb_b pin) then the respective entry has to be
159+
filled with the following dummy value::
160+
161+
#define USDHC_DUMMY_PIN NULL , 0
162+
163+
Based on the definition of macro ``MICROPY_USDHC1`` and/or ``MICROPY_USDHC2``
164+
the ``machine.SDCard`` module either supports one or two slots. If only one of
165+
the defines is provided, calling ``machine.SDCard()`` or ``machine.SDCard(1)``
166+
will return an instance using the respective USDHC peripheral. When both macros
167+
are defined, calling ``machine.SDCard(2)`` returns an instance using USDHC2.

docs/library/network.LAN.rst

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
.. currentmodule:: network
2+
.. _network.LAN:
3+
4+
class LAN -- control an Ethernet module
5+
=======================================
6+
7+
This class allows you to control the Ethernet interface. The PHY hardware type is board-specific.
8+
9+
Example usage::
10+
11+
import network
12+
nic = network.LAN(0)
13+
print(nic.ifconfig())
14+
15+
# now use socket as usual
16+
...
17+
18+
19+
Constructors
20+
------------
21+
22+
.. class:: LAN(id, *, phy_type=<board_default>, phy_addr=<board_default>, phy_clock=<board_default>)
23+
24+
Create a LAN driver object, initialise the LAN module using the given
25+
PHY driver name, and return the LAN object.
26+
27+
Arguments are:
28+
29+
- *id* is the number of the Ethernet port, either 0 or 1.
30+
- *phy_type* is the name of the PHY driver. For most board the on-board PHY has to be used and
31+
is the default. Suitable values are port specific.
32+
- *phy_addr* specifies the address of the PHY interface. As with *phy_type*, the hardwired value has
33+
to be used for most boards and that value is the default.
34+
- *phy_clock* specifies, whether the data clock is provided by the Ethernet controller or the PYH interface.
35+
The default value is the one that matches the board. If set to ``True``, the clock is driven by the
36+
Ethernet controller, otherwise by the PHY interface.
37+
38+
For example, with the Seeed Arch Mix board you can use::
39+
40+
nic = LAN(0, phy_type=LAN.PHY_LAN8720, phy_addr=2, phy_clock=False)
41+
42+
Methods
43+
-------
44+
45+
.. method:: LAN.active([state])
46+
47+
With a parameter, it sets the interface active if *state* is true, otherwise it
48+
sets it inactive.
49+
Without a parameter, it returns the state.
50+
51+
.. method:: LAN.isconnected()
52+
53+
Returns ``True`` if the physical Ethernet link is connected and up.
54+
Returns ``False`` otherwise.
55+
56+
.. method:: LAN.status()
57+
58+
Returns the LAN status.
59+
60+
.. method:: LAN.ifconfig([(ip, subnet, gateway, dns)])
61+
62+
Get/set IP address, subnet mask, gateway and DNS.
63+
64+
When called with no arguments, this method returns a 4-tuple with the above information.
65+
66+
To set the above values, pass a 4-tuple with the required information. For example::
67+
68+
nic.ifconfig(('192.168.0.4', '255.255.255.0', '192.168.0.1', '8.8.8.8'))
69+
70+
.. method:: LAN.config(config_parameters)
71+
72+
Sets or gets parameters of the LAN interface. The only parameter that can be
73+
retrieved is the MAC address, using::
74+
75+
mac = LAN.config("mac")
76+
77+
The parameters that can be set are:
78+
79+
- ``trace=n`` sets trace levels; suitable values are:
80+
81+
- 2: trace TX
82+
- 4: trace RX
83+
- 8: full trace
84+
85+
- ``low_power=bool`` sets or clears low power mode, valid values being ``False``
86+
or ``True``.
87+
88+
89+
Specific LAN class implementations
90+
----------------------------------
91+
92+
On the mimxrt port, suitable values for the *phy_type* constructor argument are:
93+
``PHY_KSZ8081``, ``PHY_DP83825``, ``PHY_DP83848``, ``PHY_LAN8720``, ``PHY_RTL8211F``.

docs/library/network.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ provide a way to control networking interfaces of various kinds.
152152
network.WLANWiPy.rst
153153
network.CC3K.rst
154154
network.WIZNET5K.rst
155+
network.LAN.rst
155156

156157
Network functions
157158
=================

docs/mimxrt/general.rst

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
.. _mimxrt_general:
2+
3+
General information about the MIMXRT port
4+
=========================================
5+
6+
The i.MXRT MCU family is a high performance family of devices made by NXP.
7+
Based on an ARM7 core, they provide many on-chip I/O units for building
8+
small to medium sized devices.
9+
10+
Multitude of boards
11+
-------------------
12+
13+
There is a multitude of modules and boards from different sources which carry
14+
an i.MXRT chip. MicroPython aims to provide a generic port which runs on
15+
as many boards/modules as possible, but there may be limitations. The
16+
NXP IMXRT1020-EVK and the Teensy 4.0 and Teensy 4.1 development boards are taken
17+
as reference for the port (for example, testing is performed on them).
18+
For any board you are using please make sure you have a data sheet, schematics
19+
and other reference materials so you can look up any board-specific functions.
20+
21+
The following boards are supported by the port:
22+
23+
- MIMXRT1010-EVK
24+
- MIMXRT1020-EVK
25+
- MIMXRT1050-EVK
26+
- MIMXRT1060-EVK
27+
- MIMXRT1064-EVK
28+
- Teensy 4.0
29+
- Teensy 4.1
30+
31+
Supported MCUs
32+
--------------
33+
34+
+-------------+--------------------+-------------------------+
35+
| Product | CPU | Memory |
36+
+=============+====================+=========================+
37+
| i.MX RT1064 | Cortex-M7 @600 MHz | 1 MB SRAM, 4 MB Flash |
38+
+-------------+--------------------+-------------------------+
39+
| i.MX RT1061 | Cortex-M7 @600 MHz | 1 MB SRAM |
40+
+-------------+--------------------+-------------------------+
41+
| i.MX RT1062 | Cortex-M7 @600 MHz | 1 MB SRAM |
42+
+-------------+--------------------+-------------------------+
43+
| i.MX RT1050 | Cortex-M7 @600 MHz | 512 kB SRAM |
44+
+-------------+--------------------+-------------------------+
45+
| i.MX RT1020 | Cortex-M7 @500 MHz | 256 kB SRAM |
46+
+-------------+--------------------+-------------------------+
47+
| i.MX RT1010 | Cortex-M7 @500 MHz | 128 kB SRAM |
48+
+-------------+--------------------+-------------------------+
49+
50+
Note: Most of the controllers do not have internal flash memory. Therefore
51+
their flash capacity is dependent on an external flash chip.
52+
53+
To make a generic MIMXRT port and support as many boards as possible the
54+
following design and implementation decision were made:
55+
56+
* GPIO pin numbering is based on the board numbering as well as on the
57+
MCU numbering. Please have the manual/pin diagram of your board at hand
58+
to find correspondence between your board pins and actual i.MXRT pins.
59+
* All MCU pins are supported by MicroPython but not all are usable on any given board.
60+
61+
Technical specifications and SoC datasheets
62+
-------------------------------------------
63+
64+
The data sheets and other reference material for i.MXRT chip are available
65+
from the vendor site: https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/i-mx-rt-crossover-mcus:IMX-RT-SERIES .
66+
They are the primary reference for the chip technical specifications, capabilities,
67+
operating modes, internal functioning, etc.
68+
69+
For your convenience, a few technical specifications are provided below:
70+
71+
* Architecture: ARM Cortex M7
72+
* CPU frequency: up to 600MHz
73+
* Total RAM available: up to 1 MByte (see table)
74+
* BootROM: 96KB
75+
* External FlashROM: code and data, via SPI Flash; usual size 2 - 8 MB
76+
Some boards provide additional external RAM and SPI flash.
77+
* GPIO: up to 124 (GPIOs are multiplexed with other functions, including
78+
external FlashROM, UART, etc.)
79+
* UART: 4 or 8 RX/TX UART. Hardware handshaking is supported by the MCU,
80+
but the boards used for testing do not expose the signals.
81+
* SPI: 2 or 4 low power SPI interfaces (software implementation available on every pin)
82+
* I2C: 2 or 4 low power I2C interfaces (software implementation available on every pin)
83+
* I2S: 3 I2S interfaces
84+
* ADC: one or two 12-bit SAR ADC converters
85+
* Ethernet controller
86+
* Programming: using BootROM bootloader from USB - due to external FlashROM
87+
and always-available BootROM bootloader, the MIMXRT is not brickable
88+
89+
The lower numbers for UART, SPI and I2C apply to the i.MXRT 101x MCU.
90+
91+
For more information see the i.MXRT data sheets or reference manuals.
92+
NXP provides software support through it's SDK packages.

docs/mimxrt/img/teensy_4.1.jpg

125 KB
Loading

0 commit comments

Comments
 (0)
0