Pages: [1]   Go Down
Author Topic: How to design a PCB that allows firmware updates.  (Read 3541 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

We have a small project to collect water well data in the field, basically a PCB with an ATmega2560, SD card and a bunch of sensors.  The current version works well, but over the past few months, we had to change the firmware a few times.  Bit of an issue, take laptop to field, connect and reload.  Can be done but.

I would like to put a new file on the SD card and have the PCB load the new firmware and run.

My thoughts are to add another microcontroller to a new board that runs after reset and checks for a new version for the ATmega and loads as required.  Similar (I think to the way the Uno and Mega boards currently work)

The problem I’m having is I’m new to this embedded electronics thing and have been have troubles locating any info.

Could someone point me in the right direction and any other help would be greatly

Thanks
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 443
Posts: 23834
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This question is asked now & again. The bootloader as currently written checks to see if anyone is sending sketch-load commands after a reset, and starts the sketch load process if there is, otherwise the loaded sketch starts.

What would need to be done for Option 1 is to write a bootloader that checked for a sketch file on the SD card, if one existed then load that sketch up. If no sketch file found, check if anyone is sending sketch-load commands, and if neither, the loaded sketch runs.

For Option 2, the current bootloader just runs normally, not really caring who is providing the data.

I am pretty sure Option 2 has been done before, I recall reading about an art installation or similar where someone had a sketch that loaded new sketches into installed Arduino's.
In fact, that sounds a lot like what Optiloader does:
http://arduino.cc/forum/index.php/topic,68183.0.html

Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Option 1 maybe?
http://baldwisdom.com/bootdrive/
Logged

Dubuque, Iowa, USA
Offline Offline
Edison Member
*
Karma: 31
Posts: 2270
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


That's option 2. Option 1 would be hacking the bootloader, which normally only looks at the UART to see if a new program is being uploaded, to check a digital pin or such for a flag that says it should start reading from a flash chip at a predefined location.

It would be kinda neat and magical but would make the bootloader larger. I nominate Crossroads to begin work immediately.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 443
Posts: 23834
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Nah, you need a real programmer for this. Someone that has made bootloaders before.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12286
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
My thoughts are to add another microcontroller to a new board...

Would the SD card be shared between the two processors?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 443
Posts: 23834
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I think what OP is after, and this would make a great combination, is basically taking an Uno/equivalent with an SD/uSD sheild, and run basically Optiloader but put a sketch from the SD card into the target board instead of loading a bootloader.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Couldn't you just run a tiny sketch on the Arduino with a #include and a function in a .h file on the SD card?
When you say firmware, do you mean a sketch?
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 167
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Getting an SD capable bootloader is probably one of the best if you can spare the 2k for the boot loader.  I don't know of any off hand but I know I've seen some of the guys here starting to think about one recently.

The BootDrive is a nice option as well, leaving the stock bootloader on the micro and emulating AVRDude talking over the serial line.

For my own project I used a 2nd micro controller similar to the BootDrive, but I'm directly SPI programming my main chip, removing the need for a bootloader entirely and allowing faster communication between the two devices.  I get around needing 2 SD cards or switching between them by talking through my  updating micro controller to the same card that it reads to update the main controller.  It impacts throughput significantly, but should also reduce write latency at the same time.  If you're interested in perusing this option I can link you my code and schematics, but they are very early in development.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 514
Posts: 31534
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Couldn't you just run a tiny sketch on the Arduino with a #include and a function in a .h file on the SD card?
No the #include is an instruction to the compiler, it is never seen in the arduino code that is running.
Logged

Offline Offline
Full Member
***
Karma: 1
Posts: 196
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi extent,

I´m interested in the code you wrote:
Quote
If you're interested in perusing this option I can link you my code and schematics, but they are very early in development.

Is it possible to get access to your files?
That would be fantastic... smiley

Best regards
Logged

alabama
Offline Offline
Full Member
***
Karma: 1
Posts: 183
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

pnewman,
Why not field boards with ZIF sockets, another at the shop. Program extra chips at the shop, exchange them with the ones in the field, then reprogram again if necessary, back at the shop, for the next update?
No fancy stuff, easily done, and a few more chips.
TomJ
Logged

Einstein once said you don't really understand anything until you can explain it to your Grandmother

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

2X on just changing the chip. Our company monkeys  smiley-twist (AKA service tech) can do it. They do it using a normal dip socket.
Logged

Offline Offline
Sr. Member
****
Karma: 5
Posts: 422
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ATMega cartridge plug-in.. smiley-grin
Logged

Pages: [1]   Go Up
Jump to: