Skip to content

Commit 783cc65

Browse files
committed
Merge remote-tracking branch 'upstream/master' into doc-ja
2 parents 2dde504 + f187c77 commit 783cc65

File tree

98 files changed

+1897
-625
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1897
-625
lines changed

docs/esp32/quickref.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ See :ref:`machine.SDCard <machine.SDCard>`. ::
747747

748748
import machine, os, vfs
749749

750-
# Slot 2 uses pins sck=18, cs=5, miso=19, mosi=23
750+
# On original ESP32, slot 2 uses pins sck=18, cs=5, miso=19, mosi=23
751751
sd = machine.SDCard(slot=2)
752752
vfs.mount(sd, '/sd') # mount
753753

docs/library/machine.SDCard.rst

Lines changed: 136 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ arguments that might need to be set in order to use either a non-standard slot
2323
or a non-standard pin assignment. The exact subset of arguments supported will
2424
vary from platform to platform.
2525

26-
.. class:: SDCard(slot=1, width=1, cd=None, wp=None, sck=None, miso=None, mosi=None, cs=None, freq=20000000)
26+
.. class:: SDCard(slot=1, width=1, cd=None, wp=None, sck=None, miso=None, mosi=None,
27+
cs=None, cmd=None, data=None, freq=20000000)
2728

2829
This class provides access to SD or MMC storage cards using either
2930
a dedicated SD/MMC interface hardware or through an SPI channel.
@@ -37,7 +38,8 @@ vary from platform to platform.
3738
- *slot* selects which of the available interfaces to use. Leaving this
3839
unset will select the default interface.
3940

40-
- *width* selects the bus width for the SD/MMC interface.
41+
- *width* selects the bus width for the SD/MMC interface. This many data
42+
pins must be connected to the SD card.
4143

4244
- *cd* can be used to specify a card-detect pin.
4345

@@ -51,7 +53,14 @@ vary from platform to platform.
5153

5254
- *cs* can be used to specify an SPI chip select pin.
5355

54-
- *freq* selects the SD/MMC interface frequency in Hz (only supported on the ESP32).
56+
The following additional parameters are only present on ESP32 port:
57+
58+
- *cmd* can be used to specify the SD CMD pin (ESP32-S3 only).
59+
60+
- *data* can be used to specify a list or tuple of SD data bus pins
61+
(ESP32-S3 only).
62+
63+
- *freq* selects the SD/MMC interface frequency in Hz.
5564

5665
Implementation-specific details
5766
-------------------------------
@@ -67,52 +76,130 @@ The standard PyBoard has just one slot. No arguments are necessary or supported.
6776
ESP32
6877
`````
6978

70-
The ESP32 provides two channels of SD/MMC hardware and also supports
71-
access to SD Cards through either of the two SPI ports that are
72-
generally available to the user. As a result the *slot* argument can
73-
take a value between 0 and 3, inclusive. Slots 0 and 1 use the
74-
built-in SD/MMC hardware while slots 2 and 3 use the SPI ports. Slot 0
75-
supports 1, 4 or 8-bit wide access while slot 1 supports 1 or 4-bit
76-
access; the SPI slots only support 1-bit access.
77-
78-
.. note:: Slot 0 is used to communicate with on-board flash memory
79-
on most ESP32 modules and so will be unavailable to the
80-
user.
81-
82-
.. note:: Most ESP32 modules that provide an SD card slot using the
83-
dedicated hardware only wire up 1 data pin, so the default
84-
value for *width* is 1.
85-
86-
The pins used by the dedicated SD/MMC hardware are fixed. The pins
87-
used by the SPI hardware can be reassigned.
88-
89-
.. note:: If any of the SPI signals are remapped then all of the SPI
90-
signals will pass through a GPIO multiplexer unit which
91-
can limit the performance of high frequency signals. Since
92-
the normal operating speed for SD cards is 40MHz this can
93-
cause problems on some cards.
94-
95-
The default (and preferred) pin assignment are as follows:
96-
97-
====== ====== ====== ====== ======
98-
Slot 0 1 2 3
99-
------ ------ ------ ------ ------
100-
Signal Pin Pin Pin Pin
101-
====== ====== ====== ====== ======
102-
sck 6 14 18 14
103-
cmd 11 15
104-
cs 5 15
105-
miso 19 12
106-
mosi 23 13
107-
D0 7 2
108-
D1 8 4
109-
D2 9 12
110-
D3 10 13
111-
D4 16
112-
D5 17
113-
D6 5
114-
D7 18
115-
====== ====== ====== ====== ======
79+
SD cards support access in both SD/MMC mode and the simpler (but slower) SPI
80+
mode.
81+
82+
SPI mode makes use of a `SPI` host peripheral, which cannot concurrently be used
83+
for other SPI interactions.
84+
85+
The ``slot`` argument determines which mode is used. Different values are
86+
supported on different chips:
87+
88+
========== ======== ======== ============ ============
89+
Chip Slot 0 Slot 1 Slot 2 Slot 3
90+
========== ======== ======== ============ ============
91+
ESP32 SD/MMC SPI (id=1) SPI (id=0)
92+
ESP32-C3 SPI (id=0)
93+
ESP32-C6 SPI (id=0)
94+
ESP32-S2 SPI (id=1) SPI (id=0)
95+
ESP32-S3 SD/MMC SD/MMC SPI (id=1) SPI (id=0)
96+
========== ======== ======== ============ ============
97+
98+
Different slots support different data bus widths (number of data pins):
99+
100+
========== ========== =====================
101+
Slot Type Supported data widths
102+
========== ========== =====================
103+
0 SD/MMC 1, 4, 8
104+
1 SD/MMC 1, 4
105+
2 SPI 1
106+
3 SPI 1
107+
========== ========== =====================
108+
109+
.. note:: Most ESP32 modules that provide an SD card slot using the
110+
dedicated hardware only wire up 1 data pin, so the default
111+
value for ``width`` is 1.
112+
113+
Additional details depend on which ESP32 family chip is in use:
114+
115+
Original ESP32
116+
~~~~~~~~~~~~~~
117+
118+
In SD/MMC mode (slot 1), pin assignments in SD/MMC mode are fixed on the
119+
original ESP32. The SPI mode slots (2 & 3) allow pins to be set to different
120+
values in the constructor.
121+
122+
The default pin assignments are as follows:
123+
124+
====== ====== ====== ====== ============
125+
Slot 1 2 3 Can be set
126+
------ ------ ------ ------ ------------
127+
Signal Pin Pin Pin
128+
====== ====== ====== ====== ============
129+
CLK 14 No
130+
CMD 15 No
131+
D0 2 No
132+
D1 4 No
133+
D2 12 No
134+
D3 13 No
135+
sck 18 14 Yes
136+
cs 5 15 Yes
137+
miso 19 12 Yes
138+
mosi 23 13 Yes
139+
====== ====== ====== ====== ============
140+
141+
The ``cd`` and ``wp`` pins are not fixed in either mode and default to disabled, unless set.
142+
143+
ESP32-S3
144+
~~~~~~~~
145+
146+
The ESP32-S3 chip allows pins to be set to different values for both SD/MMC and
147+
SPI mode access.
148+
149+
If not set, default pin assignments are as follows:
150+
151+
======== ====== ====== ====== ======
152+
Slot 0 1 2 3
153+
-------- ------ ------ ------ ------
154+
Signal Pin Pin Pin Pin
155+
======== ====== ====== ====== ======
156+
CLK 14 14
157+
CMD 15 15
158+
D0 2 2
159+
D1 4 4
160+
D2 12 12
161+
D3 13 13
162+
D4 33*
163+
D5 34*
164+
D6 35*
165+
D7 36*
166+
sck 37* 14
167+
cs 34* 13
168+
miso 37* 2
169+
mosi 35* 15
170+
======== ====== ====== ====== ======
171+
172+
.. note:: Slots 0 and 1 cannot both be in use at the same time.
173+
174+
.. note:: Pins marked with an asterisk * in the table must be changed from the
175+
default if the ESP32-S3 board is configured for Octal SPI Flash or
176+
PSRAM.
177+
178+
To access a card in SD/MMC mode, set ``slot`` parameter value 0 or 1 and
179+
parameters ``sck`` (for CLK), ``cmd`` and ``data`` as needed to assign pins. If
180+
the ``data`` argument is passed then it should be a list or tuple of data pins
181+
or pin numbers with length equal to the ``width`` argument. For example::
182+
183+
sd = SDCard(slot=0, width=4, sck=8, cmd=9, data=(10, 11, 12, 13))
184+
185+
To access a card in SPI mode, set ``slot`` parameter value 2 or 3 and pass
186+
parameters ``sck``, ``cs``, ``miso``, ``mosi`` as needed to assign pins.
187+
188+
In either mode the ``cd`` and ``wp`` pins default to disabled, unless set in the
189+
constructor.
190+
191+
Other ESP32 chips
192+
~~~~~~~~~~~~~~~~~
193+
194+
Other ESP32 family chips do not have hardware SD/MMC host controllers and can
195+
only access SD cards in SPI mode.
196+
197+
To access a card in SPI mode, set ``slot`` parameter value 2 or 3 and pass
198+
parameters ``sck``, ``cs``, ``miso``, ``mosi`` to assign pins.
199+
200+
.. note:: ESP32-C3 and ESP32-C6 only have one available `SPI` bus, so the only
201+
valid ``slot`` parameter value is 2. Using this bus for the SD card
202+
will prevent also using it for :class:`machine.SPI`.
116203

117204
cc3200
118205
``````

extmod/network_cyw43.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,8 @@ static const mp_rom_map_elem_t network_cyw43_locals_dict_table[] = {
583583
{ MP_ROM_QSTR(MP_QSTR_IF_AP), MP_ROM_INT(MOD_NETWORK_AP_IF) },
584584
{ MP_ROM_QSTR(MP_QSTR_SEC_OPEN), MP_ROM_INT(CYW43_AUTH_OPEN) },
585585
{ MP_ROM_QSTR(MP_QSTR_SEC_WPA_WPA2), MP_ROM_INT(CYW43_AUTH_WPA2_MIXED_PSK) },
586+
{ MP_ROM_QSTR(MP_QSTR_SEC_WPA3), MP_ROM_INT(CYW43_AUTH_WPA3_SAE_AES_PSK) },
587+
{ MP_ROM_QSTR(MP_QSTR_SEC_WPA2_WPA3), MP_ROM_INT(CYW43_AUTH_WPA3_WPA2_AES_PSK) },
586588

587589
{ MP_ROM_QSTR(MP_QSTR_PM_NONE), MP_ROM_INT(PM_NONE) },
588590
{ MP_ROM_QSTR(MP_QSTR_PM_PERFORMANCE), MP_ROM_INT(PM_PERFORMANCE) },

ports/esp32/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,5 @@ set(SDKCONFIG_DEFAULTS ${CMAKE_BINARY_DIR}/sdkconfig.combined)
6161
# Include main IDF cmake file.
6262
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6363

64-
# Set the location of the main component for the project (one per target).
65-
list(APPEND EXTRA_COMPONENT_DIRS main_${IDF_TARGET})
66-
6764
# Define the project.
6865
project(micropython)

ports/esp32/boards/ESP32_GENERIC_C3/mpconfigboard.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@
33
#define MICROPY_HW_BOARD_NAME "ESP32C3 module"
44
#define MICROPY_HW_MCU_NAME "ESP32C3"
55

6-
#define MICROPY_HW_ENABLE_SDCARD (0)
7-
86
// Enable UART REPL for modules that have an external USB-UART and don't use native USB.
97
#define MICROPY_HW_ENABLE_UART_REPL (1)

ports/esp32/boards/ESP32_GENERIC_C6/mpconfigboard.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#define MICROPY_HW_BOARD_NAME "ESP32C6 module"
44
#define MICROPY_HW_MCU_NAME "ESP32C6"
55

6-
#define MICROPY_HW_ENABLE_SDCARD (0)
76
#define MICROPY_PY_MACHINE_I2S (0)
87

98
// Enable UART REPL for modules that have an external USB-UART and don't use native USB.

ports/esp32/boards/ESP32_GENERIC_S2/mpconfigboard.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#define MICROPY_HW_MCU_NAME "ESP32S2"
33

44
#define MICROPY_PY_BLUETOOTH (0)
5-
#define MICROPY_HW_ENABLE_SDCARD (0)
65

76
// Enable UART REPL for modules that have an external USB-UART and don't use native USB.
87
#define MICROPY_HW_ENABLE_UART_REPL (1)

ports/esp32/boards/LOLIN_C3_MINI/mpconfigboard.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
#define MICROPY_HW_MCU_NAME "ESP32-C3FH4"
33
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-c3-mini"
44

5-
#define MICROPY_HW_ENABLE_SDCARD (0)
6-
75
#define MICROPY_HW_I2C0_SCL (10)
86
#define MICROPY_HW_I2C0_SDA (8)
97

ports/esp32/boards/LOLIN_S2_MINI/mpconfigboard.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "mpy-s2-mini"
44

55
#define MICROPY_PY_BLUETOOTH (0)
6-
#define MICROPY_HW_ENABLE_SDCARD (0)
76

87
#define MICROPY_HW_I2C0_SCL (35)
98
#define MICROPY_HW_I2C0_SDA (33)

0 commit comments

Comments
 (0)