element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum RASPBERRY PI PICO DEVICE MSC INCREASE SIZE
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 23 replies
  • Subscribers 660 subscribers
  • Views 5663 views
  • Users 0 members are here
Related

RASPBERRY PI PICO DEVICE MSC INCREASE SIZE

gabofienco
gabofienco over 2 years ago
Hello all,
I am working in a project where I plan to use rp2040 tiny usb device to store some files greater than 5MB in a SDCARD.
My question is.. any ideas how to make the MSC device to point to the address or path generate by rp2040 to the SDCARD??. and if not possible to change the pointing address will be good to know too.
Or how to make the device MSC to look with a size of 128MB in windows just like it does when it is in boot mode?
I had used these references, but I still can't have a good mounted device with a bigger size that is not overflowing flash/ram.
https://github.com/hathach/tinyusb/tree/3ead682af05bee3a275125f3e0384dd9b2882546/examples/device/cdc_msc
github.com/.../pico-bootrom
Thanks for your time.
  • Sign in to reply
  • Cancel
Parents
  • baldengineer
    baldengineer over 2 years ago

    Don't forget that the Pico / RP2040 only runs USB 1.1. Even at 12 megabit/s, 128 megabyte is going to take a very long time to fill.

    You'll probably need to look for examples of projects where people have done what you want, but with other processors.

    The process is not as simple as using the TinyUSB example, changing the max size, and "pointing" to the SD Card. You have write the SD Card handler and figure out how to interface it with the communication that TinyUSB provides.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • gabofienco
    gabofienco over 2 years ago in reply to baldengineer

    I already manage to send data via VCP, but 4MB file is around 1minute... too much time... that is why I am looking for a way to make it appear as a usb mass storage (MSC the rp2040) and that way copy/paste a file and then copy it at will with my firmware to the SDCARD.. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • mayermakes
    mayermakes over 2 years ago in reply to gabofienco

    in that case just using a flash chip that is big enough for the bioggest expected filesize + Firmware might do the trick.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • mayermakes
    mayermakes over 2 years ago in reply to gabofienco

    in that case just using a flash chip that is big enough for the bioggest expected filesize + Firmware might do the trick.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • gabofienco
    gabofienco over 2 years ago in reply to mayermakes

    Not a good solution will be..

    if you increase the mass storage size that way.. you will need RAM too and might not be supported... look:

    [build] Memory region         Used Size  Region Size  %age Used
    [build]            FLASH:    21018788 B         2 MB    1002.25%
    [build]              RAM:    20979880 B       256 KB    8003.19%
    [build]        SCRATCH_X:          0 GB         4 KB      0.00%
    [build]        SCRATCH_Y:          0 GB         4 KB      0.00%
    I don't know if you see where I am going.
    So I just plan to make it look like a virtual big mass storage.. to receive the files... and I redirect that data to my sdcard, that last part I know how to do it... but allowing big files is the problem.
    But thanks for your answer.
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • baldengineer
    baldengineer over 2 years ago in reply to gabofienco

    In that case, this function from the MSC example seems relevant.

    // Invoked when received SCSI_CMD_READ_CAPACITY_10 and SCSI_CMD_READ_FORMAT_CAPACITY to determine the disk size
    // Application update block count and block size
    void tud_msc_capacity_cb(uint8_t lun, uint32_t* block_count, uint16_t* block_size)
    {
      (void) lun;
    
      *block_count = DISK_BLOCK_NUM;
      *block_size  = DISK_BLOCK_SIZE;
    }

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • mayermakes
    mayermakes over 2 years ago in reply to gabofienco

    this might have some useful info for adding more Ram:
    https://forums.raspberrypi.com/viewtopic.php?t=316012
    but I really think that just "making the device appear as 128MB" is more of a windows fallback quirk than actual vitrual size.
    under linux I never saw the RP2040 appear with that size, just the size of the flash chip used.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • gabofienco
    gabofienco over 2 years ago in reply to baldengineer

    Yes, already tried that, but that ENUMs are used also in:

    uint8_t msc_disk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] =
    {.......
    And that generate the overflow.. I also try to make it look like different variables.. and when I try to format it to get a bigger size.. windows gets crazy saying is not possible to format it...
    it is a really good case, isn't it? hehe
    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • mayermakes
    mayermakes over 2 years ago in reply to gabofienco

    more than meets the eye in that problem, but that indicates its just windows saying 128MB because it does not know better.
    have you tried with a Linux OS? How does it react to the same config?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • gabofienco
    gabofienco over 2 years ago in reply to mayermakes

    I know, it is a really good magic what raspberry does with pico in boot mode, waiting for the uf2 files, look:

    image

    replicating it to a normal firmware is not as easy as I expected.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • baldengineer
    baldengineer over 2 years ago in reply to gabofienco

    But you said you don't care about the actual size.

    So don't use the ENUM in the function I provided you.

    That way it will report a different size to the OS.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • baldengineer
    baldengineer over 2 years ago in reply to mayermakes

    FYI, I just tried it on Ubuntu and I see it as 128M:

    image

    and on Rapbian:

    image

    So I don't think it is a Windows "thing." I think the bootloader is reporting maximum size. Which, makes sense. That way they can support almost any sized-Flash without the OS complaining.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • gabofienco
    gabofienco over 2 years ago in reply to baldengineer

    Good to know that LInux uses this magic too

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube