Go Down

Topic: Load sketch code from SD Card (Read 45951 times) previous topic - next topic

lgeek

Oh, I see what you mean. The issue here would be the fact that the flash memory is guaranteed only for a relatively small number of writes. But it is doable if all the code can be squeezed in the bootloader section.

bhagman

mowcius: the Rogue Robotics board completely simplifies talking to SD cards.  It only takes about 2K of flash space in the bootloader to read from the SD card.  The bootloader will work on any of the modules (i.e. uMMC/uMP3/rMP3 - as of now).

I like the idea of a command interpreter.  I think I will work on this concept and implement a scripting engine for reading off the SD cards.  Just remember that you will be sacrificing a LOT of speed/efficiency for flexibility.  But this is often the case with bytecode interpreters.  Would be fun to make a Basic Stamp interpreter. ;)  I'm already intrigued.

b
http://wiring.org.co/ - Wiring - Where Arduino came from. (Wiring begat Arduino)

http://loftypremises.com/ - Everything you wanted to know about me.... and less

http://roguerobotics.com/ - #1 Canadian Arduino distributor

duc23

Resurrecting this thread as I haven't seen any solutions yet using a basic arduino and SD reader.  

This feature would be a huge benefit and open up many more possible ideas for arduino based products.

Allowing for easy field/customer updates to embedded solutions greatly increases the usefulness and flexibility of the total package.

Any further ideas on this subject?


mowcius

#33
Mar 06, 2010, 05:41 pm Last Edit: Mar 06, 2010, 05:41 pm by mowcius Reason: 1
Quote
Any further ideas on this subject?

Yeah.

I have got an rMP3 board from roguerobitics that allows you to load sketches off an SD card with it. I have not got a programmer yet to reprogram my bootloader to try it though.  :(

I would still like to be able to read the .hex sketch off the SD card and send it via serial to program a second arduino but I lack the knowledge to do that. When I have more time I will try and have another chat with bhagman to work out how to do it.

It should also be possible with any SD cards and reading system as the hex is just text and could be interpreted with the arduino. You would need the arduino to send the 'start programming' commands to the slave arduino first and then send the finish ones at the end. Anyone know what those commands are? Anywhere I can look for it?

Mowcius

florinc

Quote
You would need the arduino to send the 'start programming' commands to the slave arduino first and then send the finish ones at the end


The "start programming" is essentially a reset. Force a reset on the target Arduino; immediately after, it enters the "wait for sketch to be uploaded" state. The source Arduino then starts sending the bytes (compiled sketch). After transmission is over, the target will start executing the freshly received sketch.
(Both Arduinos, source and target have the standard bootloader.)

keeper63

Quote
Any further ideas on this subject?


What I have yet to see (and this isn't so much Arduino as AVR) is why code like this, plus the other developments in SD storage, haven't made their way into "bootable SD cartridges" for the UzeBox.

It's had an SD card interface forever, but last I looked there weren't any interface software/code for it. The ability to throw your game .hex file on an SD card (plus its tile graphics, music, and sfx files) would allow you to distribute custom games much easier than what is done most often now.

Maybe it doesn't have as big of following as I expected?

As far as an interpretor for the Arduino is concerned, here is where I think things could shine:

Build an interpretor (and layout gui?) for a ladder logic system.

This would be well within the capabilities (well, for most ladder logic i/o modules) of the Arduino, and it would be useful in the case of bringing industrial controls (and programming) to the hobbyist level. Such a system could be used to implement custom manufacturing and assembly line controls at a smaller (and cheaper) scale, for instance in home or cottage manufacturing...?

In theory, you could even build a programming suite into the Arduino as well, using a 2x16 or 2x20 LCD (plus a keypad or other button pad) for display and input (depending on how much memory a ladder logic interpretor takes, I suppose).
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

duc23

Agreed - this is a gap that needs to be filled.

What I am looking for from the outside seems simple enough.
1) Method to trigger the load of the hex file, or decide to run the already loaded program.  This could be a pin held high/low or the existence of a file on the SD card.  

2) Program existing in the bootloader which can communicate via SPI to a SD card, and load the hex file into program storage.  

Reset and we have a new sketch running...  

Since I don't have a clue to what is really involved, perhaps those much more knowledgeable could chime in and detail what parts of this we are all missing and have kept this from coming to life as of yet.


mowcius

Quote
What I am looking for from the outside seems simple enough.
1) Method to trigger the load of the hex file, or decide to run the already loaded program.  This could be a pin held high/low or the existence of a file on the SD card.  

2) Program existing in the bootloader which can communicate via SPI to a SD card, and load the hex file into program storage.  

Reset and we have a new sketch running...  

Since I don't have a clue to what is really involved, perhaps those much more knowledgeable could chime in and detail what parts of this we are all missing and have kept this from coming to life as of yet.


The boards from Rogue Robotics can do this:
http://www.roguerobotics.com
The info is somewhere on there but the site is running very slowly here at the moment.

Mowcius

bhagman

cr0sh: One of the reasons why you don't see much in the way of bootloader support for SD cards on the Atmel parts is because of the amount of code that needs to be crammed into less than 4K (and that's only available on the ATmega328 - the 168, can only have a 2K bootloader).  It is possible, but the result would be pretty limited.

rbrockman: the bootloader I wrote does exactly what you're looking for.  The example I've done:

http://www.roguerobotics.com/wikidocs/code/bootloader_using_ummc

will load a sketch from the SD card module (uMMC/uMP3/rMP3) if pin 4 is held low during reset.  Once done, it starts the sketch (if pin 4 has gone high).


b
http://wiring.org.co/ - Wiring - Where Arduino came from. (Wiring begat Arduino)

http://loftypremises.com/ - Everything you wanted to know about me.... and less

http://roguerobotics.com/ - #1 Canadian Arduino distributor

Go Up