Using SD card reader

Is it posibble to use an SD card reader like this:

And loading a program that will give you a menu of the games/programs that you have “installed” (compiled programs) on the SD card? If it’s possible then you can just buy a super small card (512MB for example) and then you can have all the programs you want.

That’s not Micro USB.

The only way is probably through a USB OTG cable. However, I do believe games have to be on the built in flash storage to run. So for every game we would need to flash it to device first. So that would mean we would need a chip of some sort in the middle, capable of flashing the internal storage. I’m not sure how possible it is to do such a thing.

But the simple answer is no. At least not with extensive work and possibly custom hardware.

The bootloader is capable of reflashing itself. If we supported external storage the bootloader could boot to a menu to select a game (or play the currently installed one) vs going straight to your sketch. Pretty sure this is how gamebuino does thing. That said I’m pretty sure our hardware isn’t capable of being a USB host… it can only plug into other smarter device. It can’t be the smarter device that things (like SD cards) are plugged into.

I think that only the picture isn’t, anyway there are more MicroUSB SD Card readers.

So your saing that Arduboy can only get information that another “smart” device gives to him?
What if you can plug in some sort of a bluetooth adapter and using a “smart” device like a PC or even a smarphone, send to the adapter command to install a different program on the Arduboy?

Almost anything you can plug in would require the Arduboy to be a USB host. It cannot. It can only be a “slave” to other devices. It is a device that you plug into something else, not a device you plug things into.

Then what about connecting it to and Android / iOS / WP device?
For example using an OTG cable and conntecting it with this app:

Had it had USB 3.1 on it, it might have taken an SD card easily. Since USB 3.1 allows any device to be the slave or master. You can even charge your laptop from your phone if you wish.

I’m sure a USB 3 controller is a lot more expensive than USB 2. And the software expense of being host still might be quite a burden.

Yes I know it’s not really possible to do it, was just stating a point :slight_smile:

USB OTG (On-The-Go), which allows USB devices to detect and switch to host mode automatically, was a supplement of the 2.0 specification. As such, is was available long before USB 3.1 and even before USB 3.0.

But even without supporting OTG, a USB controller can be designed to act as either a USB host or a USB device (and many do) but not have the ability to detect and switch modes automatically. The controller would just have to be pre-configured for the desired mode.

It’s just that Atmel decided to design the USB controller in the Atmega32u4 to only support USB device mode, not USB host mode.

For what it’s worth, I don’t believe that even USB 3.1 is required to support OTG. It’s possible that the Type-C Connector, which is a separate specification, requires OTG support.

If you can “plug in” to the SPI bus, then you can just wire in an SD card frame and do the rest in software.

Of course, the SPI lines are not conveniently exposed on a stock Arduboy. But once you have those, it’s my understanding that most SD cards can be read with the card directly connected to the SPI bus ([SD Card SPI Mode details][1]).

This will still require reworking the bootloader, to have it pick stuff out of the SD card and stuff it into flash. And - it might require creating a dead simple SD card memory map so that the bootloader does not have to pick it’s way through the FAT to find the files. And that then means you need custom drivers to create that custom SD card format from the source system (likely either Windows or Linux).

But at the end of the day, once the “game card” is written, you would have something quite small, light, portable, and not needing any additional batteries. It still remains to be seen, though how easy it is to carry around an Arduboy with the extra pins in use for an external device.

As we’ve seen in some of the other discussions, it appears that access to some extra pins will be tricky, to say the least. With the overall width of a standard pin header only being about 2mm, I’m wondering if one edge of the Arduboy could provide a header row for four of the unused pins, straight into the edge.

Dreaming here … a four pin header beside the micro USB port.

Ok, back to reality now!

The gamebuino has a program loader that it flashes first I think… and then that has more brains and can read SD cards, find programs, install them. Not sure if there is some trick to how it find the program loader. Haven’t looked that closely.

I proposed the same thing here, except a six pin header with signals Rx, Tx, SDA, SCL, Power, Ground, for linking two Arduboys or connecting I2C peripherals.

For an SD reader, or other device using SPI protocol, you would probably want 6 pins, not 4. In addition to MOSI, MISO, SCLK, and CS, you would also need Power and Ground, unless you get Ground from somewhere else, such as the USB connector, and Power from who knows where.

I doubt there’s enough space left in the bootloader area to include code to handle an SD card reader, unless you make it the only way to load programs into flash, and remove the USB code. At this point you’re getting pretty far away from the Arduino that the Ardu stands for in Arduboy.

This is what you want! 2boots. Best way by far.

Take a look at this it loads hex from sd card to flash,the games will have to be compiled into hex form then copy to sd card, sd card runs from spi bus quite fast 15 seconds if that to load a game.I just dont know how to implament it into arduboy and support ssd1306 it can run lcd hd*** so just needs changing to sd1306.
There needs to be a loader added to the 2boots bootloader of some kind that starts first witch runs the ssd1306 and shows a games list of whats on the sd card.all the games compiled hex files are on the card along with a settings file so you can change settings like screen brightness volume battery etc

1 Like

Next time I’m near a Micro SD card and a soldering iron I’m going to try this out. If anyone beats me to the punch I’ll send a special gift to!

Could we use something like a micro usb to sd or micro sd card reader. Like this