8000 mimxrt/bootloader: Merge latest changes. · micropython/micropython@e02427c · GitHub
[go: up one dir, main page]

Skip to content

Commit e02427c

Browse files
committed
mimxrt/bootloader: Merge latest changes.
Merge branch 'master' into mimxrt/bootloader.
2 parents 807816f + 5682595 commit e02427c

File tree

40 files changed

+2552
-70
lines changed
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
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ the following libraries.
9797
network.rst
9898
uctypes.rst
9999

100+
The following libraries provide drivers for hardware components.
101+
102+
.. toctree::
103+
:maxdepth: 1
104+
105+
wm8960.rst
106+
100107

101108
Port-specific libraries
102109
-----------------------
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ uasyncio::
7272
sreader = uasyncio.StreamReader(audio_in)
7373
num_read = await sreader.readinto(buf)
7474

75+
Some codec devices like the WM8960 or SGTL5000 require separate initialization
76+
before they can operate with the I2S class. For these, separate drivers are
77+
supplied, which also offer methods for controlling volume, audio processing and
78+
other things. For these drivers see:
79+
80+
- :ref:`wm8960`
81+
7582
Constructor
7683
-----------
7784

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
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.
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``.
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
=================