Offline
Newbie
Karma: 0
Posts: 1
|
 |
« on: February 26, 2012, 06:18:55 pm » |
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
Online
Brattain Member
Karma: 240
Posts: 16455
Available for Design & Build services
|
 |
« Reply #1 on: February 26, 2012, 07:14:45 pm » |
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
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 58
|
 |
« Reply #2 on: February 29, 2012, 11:53:22 am » |
|
|
|
|
|
Logged
|
|
|
|
|
Dubuque, Iowa, USA
Offline
Edison Member
Karma: 12
Posts: 1522
|
 |
« Reply #3 on: February 29, 2012, 11:50:46 pm » |
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
Online
Brattain Member
Karma: 240
Posts: 16455
Available for Design & Build services
|
 |
« Reply #4 on: March 01, 2012, 12:28:34 am » |
Nah, you need a real programmer for this. Someone that has made bootloaders before.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Offline
Shannon Member
Karma: 116
Posts: 10135
|
 |
« Reply #5 on: March 01, 2012, 04:21:11 am » |
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
Online
Brattain Member
Karma: 240
Posts: 16455
Available for Design & Build services
|
 |
« Reply #6 on: March 01, 2012, 08:41:23 pm » |
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
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 58
|
 |
« Reply #7 on: March 02, 2012, 05:32:21 am » |
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
Full Member
Karma: 0
Posts: 167
|
 |
« Reply #8 on: March 03, 2012, 01:42:42 am » |
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
Brattain Member
Karma: 271
Posts: 25422
Solder is electric glue
|
 |
« Reply #9 on: March 19, 2012, 01:43:21 pm » |
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
Full Member
Karma: 1
Posts: 167
|
 |
« Reply #10 on: April 20, 2012, 09:10:03 am » |
Hi extent, I´m interested in the code you wrote: 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...  Best regards
|
|
|
|
|
Logged
|
|
|
|
|
alabama
Offline
Full Member
Karma: 1
Posts: 168
|
 |
« Reply #11 on: June 19, 2012, 10:04:19 pm » |
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
Newbie
Karma: 0
Posts: 12
|
 |
« Reply #12 on: September 30, 2012, 08:42:09 pm » |
2X on just changing the chip. Our company monkeys  (AKA service tech) can do it. They do it using a normal dip socket.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 5
Posts: 384
|
 |
« Reply #13 on: October 01, 2012, 04:38:22 am » |
ATMega cartridge plug-in.. 
|
|
|
|
|
Logged
|
|
|
|
|
|