Usb games loader


#1

Hello community!

Whereas the limited memory will only have one (decent) game loaded at a
time, it will be possible to develop / configure an external loader via USB?
In my mind it could be:

  • A passive drive (ex .: usb pen) from which the program already
    loaded on arduboy or a program previously loaded (?) On the pen drive
    can show a list of games and load the one chosen by the user;List item

  • An active drive (ex .: PC, tablet or smartphone) via a program or an
    app that automatically loads when connecting on arduboy a new program
    (the loader) with a list of available games and the user’s choice is automatically loads the selected game.

A similar mechanism could be used to divide a game into chapters (or
levels) that can be loaded dynamically, something like multiple disks in
PC and PS1 old games.

Obviously the use of a simple USB stick would be extremely comfortable but I can
not think of a workable solution, while an active drive might actually
be feasible, right? Also it would allow gamers to use in a more user-friendly way their Arduboy!

(I just finished developing a weather station with Arduino and raspberry pi connected via USB)

Sorry for my english!


(Ross) #2

Yes indeed this is very possible. It is not difficult to upload, especially a compiled program, to the arduino using a usb cord and your choice of python, c, java - anything you like. There have been some approaches discussed in IRC which do similar things - I would definitely hop on there and chat with some of the folks in there to flesh out your idea some.
http://community.arduboy.com/t/arduboy-irc-channel/93/

I would focus on an active drive. Even another microcontroller could be leveraged to accomplish what you wanting.

Existing and Helpful Projects


Here is a project that will do compilation and uploading. This makefile setup can be integrated into another project to provide the mechanism for placing the compilation on the Arduboy.


#3

The same program could also store saves backups. Now I am really busy but I’ll keep informed on the subject and in the future surely I will contribute to its development!


(Ross) #4

I honestly imagine something like this will show up, because it’s a great idea! Thanks for getting a development discussion rolling with a thread.


(Tramtrist) #5

As ekem said I was kicking around an idea with him in IRC to create an android app which would store all your games and then push them to the arduboy via USB. Not for actively played games but simply to load a new one instead of needoyour pc. If someone doesn’t beat me to it I may try writing it myself.


#6

Wonderful! Keep us up to date on its development, I think that this will be one of most used arduboy tools :smile:

In any case it could be used also to do a primitive switch for actively played games, keeping infos in EEPROM and loading the new “chapter” as a new program.


(Kevin) #7

I’ve thought about this before, you could make a separate device that has an SD card and acts as a usb host to program arduinos. This would be really helpful because it could be used on not only Arduboy but anything else using the same chip! We will support anyone working on this and might take a crack at it ourselves soon enough!


(Louis) #8

Oh, wow. A missed opportunity to use SD cards like game boy carts. Really well done games could have even gotten custom labels to print out. Well maybe for arduboy 2 right? =]


(Albert Filice) #9

Or even a micro SD card to cut down on size since they’re common in phones now.


(Josh Goebel) #10

This would have to be a like a type of boot loader… Arduino can read SD cards easily enough, but not run software from them. The architecture is designed to fetch the next instruction from the flash and then execute it. So we’d need like a BIOS that started when you booted the device and gave you access to the SD card… then allowed you to select a game and re-flash the device with that game, then let you play it. Of course the space the BIOS took up couldn’t be used to software. So we’d now need this “BIOS” + boot loaded, or perhaps we could combine the two be modifying and building our own boot loader with that functionality built in.


(Josh Goebel) #11

Actually it has to be the boot loader… only the boot loader has permission to re-flash the memory. Normal application programs cannot use the SPM instruction to reprogram flash.


(Matthew) #12

I’ve been thinking about how to load multiple games when away from a computer ever since I got my Arduboy. My thinking is around using a £4 Raspberry Pi Zero (powered by a small li-ion pack or USB powerbank) to upload games to the Arduboy via a micro-USB to micro-USB cable. The Pi would initially upload a menu app to the Arduboy so you could select your game. When selected, this would send your game selection back to the Pi via serial over USB. The Pi would then fire the relevant .hex file back over the USB. At that point, you could disconnect the Pi and the Arduboy would function as normal with your selected game stored on there. It’s only when you wanted to change the game that you’d have to reconnect the Pi.

I’m hoping to work on this idea over the next few weeks, but my Python skills are limited. If anyone else fancies having a go, let me know.


(Scott) #13

It would be nicer to add a small display and buttons to the Pi, to allow you to select a sketch and start the upload.


(Kevin) #14

Go for it, let us know how it works out and be sure to post pictures if you do!


(Matthew) #15

Hmm. That might be nice, but would add to the cost and complexity. And the ArduBoy already has a lovely display and buttons that I could use. My aim is to only need a few things:

  • ArduBoy
  • Raspberry Pi Zero and SD card
  • USB cable between the two
  • USB Powerbank to power the Pi if you want to change games when you’re out and about

Is this something people would be interested in? I am, because being able to change games easily is the only feature missing from the ArduBoy as a games player IMHO. Obviously from a developer point of view, this isn’t particularly interesting because you’d be connected to a computer all the time anyway when developing!


(Matthew) #16

So I’ve made some early first steps. I’m trying to use avrdude to upload .hex files to the Arduboy but judging by other threads, I might be heading for a lot of pain!

Can anyone help me with the arguments to use with avrdude? Here’s what I’m using currently (but getting timeout errors):

avrdude -p m32u4 -c avrispmkII -P /dev/ttyACM0 -U flash:w:fileToBurn.hex -v

Here’s my current setup (the finished version wouldn’t need a USB hub as the Arduboy would be the only thing needing to be plugged into the micro USB port)


(Scott) #17

I believe you want to use avr109 instead of avrispmkII for the programmer.

If you have the Arduino IDE running on your Pi, and are able to upload sketches using it, the best thing to do is open File > Preferences in the IDE and set Show verbose output during: upload. Then, when you upload a sketch the output will include the avrdude command line used. Even the command line used for a regular PC may be correct for a Pi as well.


(Matthew) #18

Thanks. I’ve also noticed the need to open and close a serial connection at 1200 baud before running avrdude. Will keep trying.


(Kevin) #19

You might also be able to use “arduino” as the programmer target, although I’ve only tested that with an uno.

I’ve got to admit I’ve never actually used avrdude to upload to an Arduboy, only reflash the bootloader using a programmer.

I think @JO3RI has done this a bunch though?


#20

just upload with Arduino IDE and set the
"Show verbose output during:" UPLOAD

upload a sketch and you can see the complete command you should use