Is there a way to flash 3 different ATmega328p with one USB connection

Hey guys,

i am currently desinging a system in wich i use 3 ATmega328p. All of them have a different use and
obviously a different programm flashed. These ATmegas328p are all soldered onto a PCB and this PCB should not be accessable by the customer (only if possible). My problem is that i want to be able to do Software updates via 1 usb connection for all these arduinos. Is there a way to do that?

I am not looking for solutions like using a ISP header for every single one.

LG
Wilgelmy

PS: please overlook any tipos or spelling errors. I am not native english

Which of the two threads about this topic do you want peaople to reply to ?

Its wasteful of peoples time to reply in one thread and not see the replies in the other ?

Sorry i posted it in Networking and Protokolls first and then thought it would suit better in here.

If you put a header on your PCB so that you can connect a USB-TTL cable then you could put a multi-way switch between the Tx Rx and DTR lines so that you could route the signals to any one of the three Atmega 328s.

An easier option might be to put three separate headers on the PCB.

...R

Thanks for the quick Reply :smiley:

would you be so kind and provide a example link to an multy way swicht?

i cant find anything when i google for that -.-

LG Wilgelmy

You can connect all three Arduinos to a USB hub. But you will not be able to program all three at once...

Regards,
Ray L.

How big is this device? Can you hide a small USB hub inside?

Maybe just one plug with 3 Tx and 3 Rx and your “programmer” has 3 FTDI interfaces. (Plus power and ground.)

I would not like to put a USB socket on a customer device purely for programming. It will not take long for a creative customer to “accidentally” erase the program.

If you had enough free pins on the 328p chips, you could connect one via usb, and have it program the other two, either through serial or isp interface.

MorganS:
I would not like to put a USB socket on a customer device purely for programming. It will not take long for a creative customer to "accidentally" erase the program.

Well thats a pretty good argument. I havent thought about that.

If i put an USB hub inside how can i decide wich chip i want to programm?

LG Wilgelmy

david_2018:
If you had enough free pins on the 328p chips, you could connect one via usb, and have it program the other two, either through serial or isp interface.

Thats exaclty what i also thought about but then you would need to change the resetpin in the "Arduino as ISP" sketch depending on what arduino you want to programm...

And then you would be able to upload the new code

Wilgelmy:
would you be so kind and provide a example link to an multy way swicht?

I don't know of any.

You could probably rig one up with a group of AND and OR gates.

If you describe the purpose of the 3 Atmega328s and the sorts of changes that you envisage for their programs someone might think of a better solution.

For example if the updates only involve data there would probably be no need to re-program the chips.

...R

Robin2:
If you describe the purpose of the 3 Atmega328s and the sorts of changes that you envisage for their programs someone might think of a better solution.

Well i am trying to build a lasertag system.
The first Atmega328p are the sensors if you got hit.
The second Atmega328p is the weapon that transmitts the Signal.
And the third Atmega328p is the main one that takes all the infos and sends it so a main server.

So if i say i want to do software updates i really mean changing the sketch on the chip.

I originaly thought about including a fourth Atmega328p and programm this one with a modified Version ot the "Arduino as ISP" Sketch. So that i can provide a update for example for the sensors and there is a code like 0x01 in the beginning of the sketch that tells the fourth Atmega328p wich chip to programm.

Wilgelmy:
Well i am trying to build a lasertag system.

I don't like to offer advice for projects that involve weapons - either real or pretend. There is altogether too much violence in the world.

...R

Well i can´t understand that because everything here is in the name of sience.
And this is not a thing that i am planing to release to public. Its just a "can i do it" challange.
But that´s of cause your decision.
Maybe we could talk via pm if you dont want to support that kind of projekts in public.

Anyway could you please just tell me if thats possible at all?

LG Wilgelmy

Wilgelmy:
Maybe we could talk via pm if you dont want to support that kind of projekts in public.

I have even less desire to get involved privately in anything related to weapons.

...R

ok to bad...

tanks a lot anyway.

someone else willing to help me?

What problems are you currently having? Which pieces of advice did you follow? For the ones you didn't follow, explain why you think that is not relevant to your project.

Are all three atmega328's on the same board, or are they on separate boards and somehow interconnected?

MorganS:
What problems are you currently having? Which pieces of advice did you follow? For the ones you didn't follow, explain why you think that is not relevant to your project.

ok sorry i overlooked the second page -.-

So i dont know how i should use a switch because i think i could not decide wich chip i want to flash.
Thats why i didnt follow that idea.

I also dont know how i should do that with a multi way swtich because i also could not decide wich chip i want to flash.

Right now i am looking for a way to check the sketch i want to flash for an adress wich is assinged to an chip.

david_2018:
Are all three atmega328's on the same board, or are they on separate boards and somehow interconnected?

They are all on different bords and right now connected via I²C but i could change that to SPI oder something else.

I could also add a fourth chip to the mainborad if that helps

LG Wilgelmy

Wilgelmy:
They are all on different boards and right now connected via I²C but i could change that to SPI or something else.

I could also add a fourth chip to the mainboard if that helps

That is going to severely limit the possibilities, are these custom boards or standard arduino boards? How are you converting usb to serial, the standard 8u2 or 16u2, an ftdi chip, ch340, etc? Without modifying the bootloader, you would need to use either the serial port or the icsp header connections. Custom programmed 16u2 might be able to do it, not familiar enough with that chip to know if it has the capacity to run three serial connections to three separate atmega328 chips. An atmega32u4 (leonardo) chip as an isp programmer would be a possibility, since it doesn't need to have the capacitor on reset for the isp sketch, or an atmega328 programming the other atmega328s through serial might work.