Multiple ATMEGA328P in a single board, with one single TTL Serial FT232RL

Hi there, I’m doing a small project here where I have 5 ATMEGA328P in a single board, and I want to add a TTL Serial FT232RL to program the micro controllers.
I was thinking to use 74HC4051 multiplexer / demultiplexer (found some nice documentation here thanks to Nick Gammon).
I probably will need to use 2 of the 74HC4051 due I’ll need to hook up the TX and RX from the FT232RL, and the outputs goes to the TX/RX of each ATMEGA micro controllers.
So, this way, I can hook up the 74HC4051 to “select” which one I want to program at a time.

I’m not sure if it’s gonna work, but if anyone have a better idea, I would appreciate it !
I’m sorry about the attached schematic example (mess)… I did it quickly just to give some idea about what I want to achieve !
Thank you !

Update: I updated the circuit by adding a 3rd 74HC4051 to control the reset of the ATMEGA.
I also will add the recommended caps and other components … I just did a quick diagram to have an idea about the project !
thanks again !

Test2.pdf (161 KB)

I think you'll need weak pullups on the Tx lines so they are not floating after a reset on the chips that are not being driven.

And 0.1uF caps, power, gnd, control signals on the '4051s.

Not sure how the FTDI will do driving 5 reset circuits in parallel (i.e. 500nF of capacitance). You can put a scope on a reset line and see.

@CrossRoads, thanks for your thoughts !
You're right, I'm missing there the reset connection to every ATMEGA... and I may need an additional 4051 just for the reset option.

So, do you think it will work fine for this purpose by using the '4051s ? I mean, the plan is use the '4051s to program the selected ATMEGA, and may use the serial to read/write/debug just like a regular arduino !


The really serious question here is why you would ever have 5 ATmega328P on a single board? :roll_eyes:

Nevertheless, if nothing else is connecting to the serial inputs on the 328s, there is no reason to use multiplexers to connect them - just connect them all in parallel to the output of the USB interface. They will only respond to serial input if and when you tell them to - which includes on reset (note, not on power-up if you are using the standard bootloader). So using a multiplexer to select which is reset (and then you do not need to worry about how many reset capacitors are connected at once) is adequate.

Question is, what controls the multiplexer selection?

What is the purpose of the 1k resistors in series with the Rx and Tx lines of the 328s? In the Arduino, it is so that something connected to the board pins can override the connections to the on-board USB interface, but what is the reason in your design?

The really serious question here is why you would ever have 5 ATmega328P on a single board? :roll_eyes:

I know that sounds crazy, and I can tell you that I have the same project running today with only one ATmega2560 that I designed back to 2012 ...
The reason I'm doing this way now is that I need to upgrade to a new platform that will communicate with a raspberry pi to run in standalone mode, and the pi will have an interface with a server that will handle all the back end.
The main reason to use 5 micros on the same board is that I need it to run independently, without interrupts!
The old design that I mentioned using the ATmega2560, will not support it because it will hang when "multiple interactions happen". Trust me, I tested and even tried with arduino due... didn't get the expected results!
So, I have today this new "prototype" on a breadboard, and it's working smooth, and the only thing I need is to setup the serial port to be "programmed".. I could set 5 different FT232RL to do the job, but I'm so picky that I want to save some money and space in the board lol.

By the way I updated the schematic by adding a 3rd of '4051s. and the pullup resistors for the TX lines... I'll add the capacitors as well when I get everything "pictured" in mind to go !

Thank you !

I think on of these would be a better chip, better propagation delays. Same functionality.

I think on of these would be a better chip, better propagation delays. Same functionality.

Great ! I'll check out ! Thanks for your help !

Hi guys, I also found on the datasheet the CDx4HCx4053 and on page 21, according to the CDx4HCx4053 Functional Block Diagram I can hook up the TX, RX and the reset pin on pins 14,15 and 4. and with this one I can setup to program 2 of 328s... (well I'll still need 3 of '4053s and at the end will be the same result as '4051s, but with different wiring...)

I'm asking that because I can use the '4053s to hook up the TX,RX and reset pin in one single chip, on the oher hand the '4051s would be used one IC per pin (RX,TX and reset)... and at the end I still need to use 3 of the '40XXs....

What do you guys think ? Should I keep the '4051s or go for the '4053s ?