Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add USB MSC support for esp32s3 #14966

Merged

Conversation

JianyuWang0623
Copy link
Contributor

@JianyuWang0623 JianyuWang0623 commented Nov 27, 2024

Summary

Add USB MSC support for esp32s3

  1. boards/xtensa/esp32s3: Add USB MSC support for esp32s3
  2. esp32s3-devkit/usbmsc: Initializing configuration for USBMSC
  3. Documentation/esp32s3-devkit: Add doc for esp32s3-devkit/USBMSC

For more details, please see commit message

Impact

  • boards/xtensa/esp32s3

Testing

  1. Selftest with esp32s3-devkit:usbmsc
  2. NuttX CI

Test

  # Device:/dev/ram10 <----> Host:/dev/sde

  # Device (NuttX)
    nsh> mkrd -m 10 -s 512 640
    nsh> msconn
    nsh> ls -l /dev/ram10
     brw-rw-rw-      327680 /dev/ram10

  # Host (e.g /dev/sde)
    $ sudo mkfs.ext4 /dev/sdx
    $ sudo mount /dev/sdx /workspace/mnt

  #   Part of `df -h`
    /dev/sdx        292K   24K  248K   9% /workspace/mnt

  #   dmesg (/dev/sdd, /dev/sde)
    [1116587.199896] usb 1-10: new full-speed USB device number 122 using xhci_hcd
    [1116587.369226] usb 1-10: New USB device found, idVendor=584e, idProduct=5342, bcdDevice= 3.99
    [1116587.369231] usb 1-10: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [1116587.369232] usb 1-10: Product: Mass Storage
    [1116587.369233] usb 1-10: Manufacturer: NuttX
    [1116587.369234] usb 1-10: SerialNumber: 0101
    [1116587.385275] usb-storage 1-10:1.0: USB Mass Storage device detected
    [1116587.385526] scsi host5: usb-storage 1-10:1.0
    [1116588.423335] scsi 5:0:0:0: Direct-Access     NuttX    Mass Storage     0101 PQ: 0 ANSI: 2
    [1116588.423746] scsi 5:0:0:1: Direct-Access     NuttX    Mass Storage     0101 PQ: 0 ANSI: 2
    [1116588.424001] sd 5:0:0:0: Attached scsi generic sg3 type 0
    [1116588.424181] sd 5:0:0:1: Attached scsi generic sg4 type 0
    [1116588.424305] sd 5:0:0:0: [sdd] Unsupported sector size 256.
    [1116588.425336] sd 5:0:0:1: [sde] 640 512-byte logical blocks: (328 kB/320 KiB)
    [1116588.638620] sd 5:0:0:1: [sde] Write Protect is off
    [1116588.638624] sd 5:0:0:1: [sde] Mode Sense: 0f 00 00 00
    [1116588.858793] sd 5:0:0:0: [sdd] 0 512-byte logical blocks: (0 B/0 B)
    [1116588.858797] sd 5:0:0:0: [sdd] 256-byte physical blocks
    [1116589.078698] sd 5:0:0:0: [sdd] Write Protect is off
    [1116589.078702] sd 5:0:0:0: [sdd] Mode Sense: 0f 00 00 00
    [1116589.298629] sd 5:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
    [1116589.298903] sd 5:0:0:0: [sdd] Attached SCSI disk
    [1116589.518626] sd 5:0:0:1: [sde] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
    [1116589.972872] sd 5:0:0:1: [sde] Attached SCSI disk
    [1116644.299819] EXT4-fs (sde): mounted filesystem d4e18b90-b0c3-4a0f-8969-2493a41c5e02 r/w without journal. Quota mode: none.

Copy from boards/arm/rp2040/common/src/rp2040_usbmsc.c

Signed-off-by: wangjianyu3 <[email protected]>
USBMSC - USB Mass Storage Class

Build

  $ ./tools/configure.sh -l esp32s3-devkit:usbmsc
  $ make flash ESPTOOL_PORT=/dev/ttyACMx

Runtime

  # Device
  nsh> mkrd -m 10 -s 512 640
  nsh> msconn

  # Host
  $ sudo mkfs.ext4 /dev/sdx
  $ sudo mount /dev/sdx ./mnt/

Signed-off-by: wangjianyu3 <[email protected]>
JianyuWang0623 added a commit to JianyuWang0623/nuttx that referenced this pull request Nov 27, 2024
@github-actions github-actions bot added Size: S The size of the change in this PR is small Area: Documentation Improvements or additions to documentation labels Nov 27, 2024
@JianyuWang0623 JianyuWang0623 force-pushed the br_wjy_esp32s3_usbmsc_demo_241127 branch from 209c0ce to 62976db Compare November 27, 2024 11:58
@JianyuWang0623
Copy link
Contributor Author

@Donny9 @yangsong8-ai Could you review this PR please?

@acassis acassis merged commit 289f43f into apache:master Nov 27, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Documentation Improvements or additions to documentation Board: xtensa Size: S The size of the change in this PR is small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants