8000 mimxrt: Add some documentation for the MSC mode. · micropython/micropython@f24a814 · GitHub
[go: up one dir, main page]

Skip to content

Commit f24a814

Browse files
committed
mimxrt: Add some documentation for the MSC mode.
1 parent 55cc76c commit f24a814

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

docs/mimxrt/quickref.rst

Lines changed: 40 additions & 0 deletions
< 50FF td data-grid-cell-id="diff-d2378f00f41df969f43cf6c034539b0b79c93ed1b097fc2998c052b8d0d6d898-539-578-0" data-selected="false" role="gridcell" style="background-color:var(--diffBlob-additionNum-bgColor, var(--diffBlob-addition-bgColor-num));text-align:center" tabindex="-1" valign="top" class="focusable-grid-cell diff-line-number position-relative left-side">
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,46 @@ port and LAN(1) for the 1G port.
537537

538538
For details of the network interface refer to the class :ref:`network.LAN <network.LAN>`.
539539

540+
541+
External drive mode
542+
-------------------
543+
544+
On some boards a mode is enabled, that mounts the board's internal file system as
545+
external USB drive, called MSC support. Data of that drive can be accessed and changed by the PC.
546+
In that state, access to the internal drive by the MicroPython is limited to
547+
readonly mode, avoiding file corruption. Changes made by the PC to the file system may not be visible
548+
at the board until the drive is ejected by the PC or a soft reset of the board
549+
is made.
550+
551+
To enable write access to by the board, eject the drive at the PC **and** perform
552+
a soft-reset on the board, either by pushing Ctrl-D at REPL or calling machine.soft_reset().
553+
554+
The external drive mode can be enabled of disabled by calling mimxrt.usb_mode(). Examples::
555+
556+
# disable MSC support
557+
import mimxrt
558+
mimxrt.usb_mode("vcp")
559+
560+
::
561+
562+
# enable MSC support
563+
import mimxrt
564+
mimxrt.usb_mode("vcp+msc") # enable VCP and MSC support
565+
566+
These command must be placed into boot.py. They get effective after the next hard reset or
567+
power cycle.
568+
569+
The readonly state of the local file system access can be told by an IOCTL call of the file
570+
system's block device. ::
571+
572+
import mimxrt
573+
574+
bdev = mimxrt.Flash()
575+
readonly = bdev.ioctl(7, 0)
576+
577+
If the drive is in readonly state, bdev.ioctl(7, 0) returns `True`.
578+
579+
540580
Transferring files
541581
------------------
542582

0 commit comments

Comments
 (0)
0