Skip to content

RP2040 host msc example non-functional (with fatfs) #1488

@pm-mic

Description

@pm-mic

Operating System

Windows 10

Board

raspberry pi pico

Firmware

examples/host/cdc_msc_hid

What happened ?

When trying the msc host example with the fatfs implementation based on the example code, one first runs into the following code at line 97 and 107:
if ( TUSB_ERROR_NONE != tuh_msc_read10(usb_addr, 0, buff, sector, count) ) return RES_ERROR;
Which needs to be correct to:
if ( !tuh_msc_read10(usb_addr, 0, buff, sector, count, NULL) ) return RES_ERROR;
in order to make it compile.

However after this:

  • disk_initialize succeeds
  • disk_is_ready succeeds
  • f_mount succeeds
  • f_chdrive succeeds
  • f_chdir fails with an error 13

Error 13: no filesystem. Although it's clear there's a FAT32 with 512 block size on the USB stick.

When checking the buffer returned from "disk_read" in the function check_fs() (which is called from f_chdir), there's supposed to be a record signature at offset 510, however this buffer is completely empty. It seems like tuh_msc_read10() did not succeed in filling the buffer with an actual value.

How to reproduce ?

  1. Run the examples/host/cdc_msc_hid with only the msc example engaged,
  2. comment out the tuh_msc_inquiry() call (this will cause a race condition with the other calls)
  3. uncomment the file system code below this call
  4. fix the calls on line 97 and 107 in diskio.c
  5. see an error 13

Debug Log as txt file

No response

Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions