I'm trying to design a PCB that contains a CO2 sensor with UART interface, an Xbee module using UART and an AtMega328 chip. Because I have only a single UART on the AtMega328 I use SoftwareSerial for the CO2 module. The Xbee module is connected directly to digital pin 0 and 1 (TX, RX) on the Atmega328. This means that I would have to disconnect the Xbee if I want to program the Atmega328 and vice versa. (Edit: I would prefer to keep the Xbee connected through the hardware serial. Connecting the Xbee to SoftwareSerial would prevent me from being able to configure it and change the firmware).
In my previous attempt to solve this I used a 6-pin header and jumpers (3x2). To connect the Xbee to Serial I created a cable connecting the outer pins together, allowing me to flash the firmware of the Xbee.
I want this to be controlled by the Arduino. As far as my limited knowledge of electronics goes I would be using multiple 'double pole, double throw' switches. If I would use (for example) the NX3L2467 this would give me the following options:
(F = FT232 UART-to-USB, D = ArDuino, X = Xbee Module). I use 5Y* and 6Y* in my example to address the 1Y* and 2Y* pins on the second switch.
This would in turn result in the following truth table:
This construction would allow me to do what I want, connect Xbee to Duino, Duino to FTDI, FTDI to Xbee. Is using two of these switches the most efficient way to manage this without moving to another microcontroller? Is there an IC that would be able to switch between these devices without having two 'switches' between every connection?