Arduino as mass storage device?

Use the link, there might be something useful in there.

Thank you.

Joseph

The SD card already uses DOS FAT and the SD library works like DOS folders and files access with 8.3 filenames and FILE blocks.

It can use a Sandisk format, that's all I know.

The card has an MCU and does it's own wear-leveling.

It is Very Important to know that SD/flash has to write 128 byte page if just 1 changes.
These can't be treated like hard drives as far as hopping through data say sorting on the card.

What you do instead is to get your raw data to one file as it arrives and write an index file with the start byte # of each data record concurrently. Instead of sorting the data file, write a sorted index file and use that to write a sorted data file if needed. Indexed file access is a very powerful tool.

hello again i don't have room to put a sd card in there or i would.

My problem is I'm limited on space.

Joseph

Do you have room in your Arduino chip's flash? The newer bootloaders allow writing to flash in runtime.

If i did i have to bodge it a little and run some magic wire on the pins. I might be able to do it.

Joseph

You don't know this Arduino capability then. It is built-in.

You know that your sketch gets turned into machine code loaded into internal flash on the Arduino MCU by the IDE?

You know about using PROGMEM to store constant data in unfilled parts of the same flash? Arduino Uno has 32K flash, a big sketch might fill 8K if it's not waste-y.

The newer Arduino bootloaders allow writing to flash by a running sketch. It lets you save data not previously known as constant in flash, and read it often after.

You have mentioned that a few times. So the question is what will fit? If an Uno or Zero fit, you can use e.g. a Nano or proMini or ProMicro and have space for a SD card (I guess).

Questions:

  1. What is the use of sending stuff to the serial monitor? What are you trying to build?
  2. If you can provide some detail of what would be in that text file, we might be able to help with code for an alternative to the mass storage device.

Hello all. I'm sorry I been so busy taking are of my father and I had another topic on something that works with this topic I totally forgot about this one.

Let me try to explain the best I can to clear up what I'm trying to do. I have limited amount of space. I can not fit a SD card module in this arduino project. I have a two button macro keypad project I'm working on for my brother. He needs to be able to do a couple of combo presses on things he does. So I'm building him a small keypad to do that. I can add a small eeprom to the board or use the internal eeprom on the board.

The micro controller is the standard arduino pro micro using the atmega32u4 processor. So I need to give him a way to change the keys to do different things functions. I can not fit a SD card module I need a way to upload a text file of some kind that takes about less then 1kb of space for the 2 buttons. So adding the pro micro as a mass storage would help that. I just don't know how to do something like that. My brother can just drag and drop a file onto the drive.

He knows nothing about arduino, coding or hardware he is just a gamer and I'm trying to build him something for his birthday to help him out. I hope this helps to explain what I'm trying to do?
Thank you.

Joseph

Yes, we've understood that's been your goal since you started this thread. The question remains, can you write the code to make your atmega32u4 act like a mass storage device (presenting whatever non-volatile memory you choose as the file system) to allow brain-dead drag-and-drop files transfers while at the same time acting as a HID. Dunno. But, methinks you may have signed up to an untenable goal.

Hello, I can not write something like that to make a mass storage device. that is way above my skills at this moment. I need help with that. but you are right this might be a untenable for me.

Joseph

I can probably write you something like that for a Windows platform. Offer stands.

This will help in the understanding of what you exactly need; the above app can be tailored with e.g. error checking.