adding a new chip to uno board

i'll say it out right i have some stupid team members.

we are building a robot. in this robot there are 4 atmega 328p chips. all of our boards are custom made. to our dismay after we built up the boards and tried to program the boot loaders they would not program. after some investigation i found that the wrong chips were ordered. instead of 328p we got 328. i found that by changing the signature in the avrdude configuration file from 1E 95 0F to 1E 95 14 for the 328 chip it programs just.

the problem is there are at least 4 people doing development of software and we are using out old robot (which has the correct chips in it) for testing.

my question: is there a way to edit the configuration and board files to allow the IDE to program both chips seamlessly under the uno board moniker without constantly re editing the configuration file?

Each and every programming event requires the correct board file information. If the chip you have is not the chip listed in the attached boards file then it would be my guess that you will not be able to run code written for the 328P. I could be wrong. If
I were you I would not waste any more time and just order replacements from DIPMICRO at the attached link for the ATmega328-PU with OPTIBOOT bootloader pre-installed for $3/EACH. These chips come ready to load sketchs right out of the package.
Since the arduino UNO has an onboard FTDI chip that handles USB to TTL translation , you will need an FTDI breakout for uploading sketches unless you already have that covered by some other method. Here are a couple of examples of FTDI breakout boards that come with USB connectors for connecting to your PC to upload sketches . The one from Mouser has a USB-mini as does the one from SPARKFUN. There is one minor difference (convenience/inconvenience) in that the one from Mouser has a jumper to set the output voltage to 5v or 3.3v while the one from sparkfun requires that you bridge two pads with solder on the
bottom of the board to select one or the other, meaning you could not use it an one voltage and then use it at the other without
desoldering the bridge whereas the one from mouser can be reconfigured in one second. Strangely, the one from sparkfun is almost double the price of the more convenient one from mouser.

I don't know what country you are in so I don't know how feasible it is for you to use any of the information I have just given you
Mouser does ship to foreign countries.
How do you load your sketches ? (or should I say "did" ?)

boards.txt (16.4 KB)

raschemmel:
Each and every programming event requires the correct board file information. If the chip you have is not the chip listed in the attached boards file then it would be my guess that you will not be able to run code written for the 328P. I could be wrong. If
I were you I would not waste any more time and just order replacements from DIPMICRO at the attached link for the ATmega328-PU with OPTIBOOT bootloader pre-installed for $3/EACH. These chips come ready to load sketchs right out of the package.
Since the arduino UNO has an onboard FTDI chip that handles USB to TTL translation , you will need an FTDI breakout for uploading sketches unless you already have that covered by some other method. Here are a couple of examples of FTDI breakout boards that come with USB connectors for connecting to your PC to upload sketches . The one from Mouser has a USB-mini as does the one from SPARKFUN. There is one minor difference (convenience/inconvenience) in that the one from Mouser has a jumper to set the output voltage to 5v or 3.3v while the one from sparkfun requires that you bridge two pads with solder on the
bottom of the board to select one or the other, meaning you could not use it an one voltage and then use it at the other without
desoldering the bridge whereas the one from mouser can be reconfigured in one second. Strangely, the one from sparkfun is almost double the price of the more convenient one from mouser.

http://www.mouser.com/ProductDetail/mikroElektronika/MIKROE-483/?qs=%2Fha2pyFadugsEwyLV5fFyIWdPbushEDhRSvnBE0ODG8%3D

https://www.sparkfun.com/products/9716

Atmega328 w/ Arduino UNO Optiboot Bootloader ATMEGA328P-PU - dipmicro electronics

I don't know what country you are in so I don't know how feasible it is for you to use any of the information I have just given you
Mouser does ship to foreign countries.
How do you load your sketches ? (or should I say "did" ?)

While the older arduino boards did use the FTDI serial USB converter chip, the Uno boards use a 16U2 AVR chip for that function. That is why there are several different PC USB driver software still distributed with the arduino IDE.

While the older arduino boards did use the FTDI serial USB converter chip, the Uno boards use a 16U2 AVR chip for that function. That is why there are several different PC USB driver software still distributed with the arduino IDE.

@retrolefty,
I doubt that will be of much help to them as they are building a DIY and have not stated what support chips they have , if any.
I don't know how they load sketches either (for the same reason).
Do you have any other comments one way or another regarding my reply or the OP's problem ?(suggestions maybe ?)
(possibly confirm or deny what I said about the boards file ?)

is there a way to edit the configuration and board files to allow the IDE to program both chips seamlessly under the uno board moniker without constantly re editing the configuration file?

In short, no. 328 isn't supported by compiler version shipped with Arduino.
Note that if you did it right, once you have bootloaders programmed, the bootloader will identify the 328 as a 328p, and you shouldn't have trouble with unmodified IDEs after that, unless you need to reprogram the bootloader. So you can have someone with a patched avrdude config burn bootloaders for everyone (or use a tool like "optiloader" or Nick Gammon's bootloader loader),
and THEN everyone should be OK.

we use ICSP programmer to program our boards. (such as an avr pocket programmer or the usbtiny isp)loading the boot loader on a virgin chip is merely a convenience because it also sets the fuse setting in the process.

the chips are surface mount packages making them very difficult to replace after they are soldered on.

from what i have read the chips we have posses no less functionality than the native uno chips and i have already successfully run sketches on them. the inconvenient part is whenever i need to go back to an uno board i need to edit my avrdude.conf file to change the signature number.

if it is not possible to have one board with two chip options listed with avrdude then how would i go about creating a custom board entry with all the same tributes as an uno except the signature?

For programming custom boards like robot projects I would just eliminate the bootloader altogether and use an another arduino board running arduinoISP and use the upload sketch using programmer IDE option.

to our dismay after we built up the boards and tried to program the boot loaders they would not program.

@westfw,
Doesn't the OP's comment above mean they didn't do it right ? I'm confused.
Are you saying that this comment:

So you can have someone with a patched avrdude config burn bootloaders for everyone (or use a tool like "optiloader" or Nick Gammon's bootloader loader),
and THEN everyone should be OK.

can undo the OP's situation (won't program problem) ?
It sounds like a catch 22 . How can they follow your above instructions if the chips won't program ? Isn't burning the bootloader
part of the programming process ? What is it I am not understanding ?

For programming custom boards like robot projects I would just eliminate the bootloader altogether and use an another arduino board running arduinoISP and use the upload sketch using programmer IDE option.

Does that mean if I had an ATmega328-PU that did NOT have the OPTIBOOT bootloader , that I could use my UNO set for arduinoISP to upload sketches ?

the chips are surface mount packages

Why would you do such a thing for a school project ? Isn't that a recipe for disaster ? Why are you not using DIP packages that you can slap on a breadboard anytime you want ?

raschemmel:

For programming custom boards like robot projects I would just eliminate the bootloader altogether and use an another arduino board running arduinoISP and use the upload sketch using programmer IDE option.

Does that mean if I had an ATmega328-PU that did NOT have the OPTIBOOT bootloader , that I could use my UNO set for arduinoISP to upload sketches ?

Yes. An arduino running arduinoISP sketch can be used to burn bootloaders or standalone sketches to 328p based projects.

Good to know. THANKS !

Doesn't the OP's comment above mean they didn't do it right ?

Irrelevant, if they're not using the bootloader.

Why do you think it's easier to distribute a boards.txt than an avrdude.conf ?
Using the 1.5 features, you should be able to set up a "board" entry that uses a different avrdude command for upload (referencing a different avrdude.conf, for example), which should then allow user to upload both to 328p and 328-based boards. I think.
(The problem is that if you modify avrdude.conf for the 328, it no longer recognizes the 328p, right?)

(The problem is that if you modify avrdude.conf for the 328, it no longer recognizes the 328p, right?)

Is that a problem if they don't have any 328P s ?

raschemmel:
Is that a problem if they don't have any 328P s ?

And if they did not, it would not, but he says they do.

All very muddled, but the solution would appear to be (as best I know) to make two (extra) entries in boards.txt and even name them "Old Robot" and "New Robot"!

raschemmel:

the chips are surface mount packages

Why would you do such a thing for a school project ? Isn't that a recipe for disaster ? Why are you not using DIP packages that you can slap on a breadboard any time you want ?

If they are using custom boards, then the interfaces should be reasonably well concealed. How many MCUs have you smoked, and how hard did you have to try?

It gets back to that question of Pro Minis - sure, it isn't easy to replace the SMD chip, but the whole board can be replaced for less than the cost of the DIP package.

There is maybe a simple reason why this wont work but could you add a duplicate of the ATmega328P to avrdude.conf and alter the id, desc & signature to match the ATmega328.

    id			= "m328p";     <<< Not sure about this
    desc		= "ATMEGA328";
    signature		= 0x1e 0x95 0x14;

Then duplicate the UNO entry in the boards.txt file and alter

uno.name=Arduino Uno
uno.build.mcu=atmega328p

to something like

uno.name=ATMEGA328
uno.build.mcu=atmega328

this should work (in my tiny mind anyway) if the uno.build.mcu value is used to pull the relevant config entry out of avrdude.conf

Riva:
There is maybe a simple reason why this wont work but could you add a duplicate of the ATmega328P to avrdude.conf and alter the id, desc & signature to match the ATmega328.

Yes.

fungus:

Riva:
There is maybe a simple reason why this wont work but could you add a duplicate of the ATmega328P to avrdude.conf and alter the id, desc & signature to match the ATmega328.

Yes.

You have gotta do better than that. Does the Yes refer to the fact it will work or wont work and if its for not working then an explanation why would be so much more helpful.

Riva:

fungus:

Riva:
There is maybe a simple reason why this wont work but could you add a duplicate of the ATmega328P to avrdude.conf and alter the id, desc & signature to match the ATmega328.

Yes.

You have gotta do better than that.

Not my fault the question is ambiguous...

Yes it will work. That's what the file is for.

as i mentioned earlier the boot loader is only a convenience for setting the configuration fuses for a fresh chip. after the boot loader is programmed the first time we program using ICSP the boot loader is erased.

when using ICSP to program avrdude does a signature check every time that's why i need additional entrys in the config and board files.

thanks for positing the changes i need to make. i will make them and try it out this evening. i will let you know how it works.

thanks a bunch