Serial pins hardware question

Hello again.

I'm designing a shield on which I can add additional circuitry for specialized applications (sort of a "semi-breadboard" with basic "glue" chips and pins already in place).

I would like this shield to communicate with a Uno on digital pins 0 (Rx) and 1 (Tx). My shield therefore should transmit data to the Uno on pin 0, and receive on pin 1.

But, as I uderstand it, these these pins also are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip. If so, what prevents my active TTL output from conflicting with the ATmega8U2's active TTL output?

I could add a chip with a 3-state output, and I could cause it to power-up in high-impedance, then go active in the setup() function. But if I have the IDE connected to the USB port and my sketch is running, how does the IDE tell my shield to go high-Z when it needs to upload a new sketch?

Can someone tell me what hardware I should be considering to transmit on Uno pin 0?

Thank you.

--- Mike

MikeDodd: Hello again.

I'm designing a shield on which I can add additional circuitry for specialized applications (sort of a "semi-breadboard" with basic "glue" chips and pins already in place).

I would like this shield to communicate with a Uno on digital pins 0 (Rx) and 1 (Tx). My shield therefore should transmit data to the Uno on pin 0, and receive on pin 1.

But, as I uderstand it, these these pins also are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip. If so, what prevents my active TTL output from conflicting with the ATmega8U2's active TTL output?

I could add a chip with a 3-state output, and I could cause it to power-up in high-impedance, then go active in the setup() function. But if I have the IDE connected to the USB port and my sketch is running, how does the IDE tell my shield to go high-Z when it needs to upload a new sketch?

--- Mike

Mike, Here is my circuit, |500x175

The !RS232_0 is just connected to an unused Arduino pin, driving that pin low connects the external RS232 circuit to my Arduino.

For your breadboard example, you could add a manual pushbutton for a latch that disables the external RS232 to allow uploading.

Using this type of circuit, if you wanted to receive data from the PC Serial monitor, Just press the button. Press it again to connect to external RS232.

The way I use mine: when the Arduino resets, all pins are input, the 100k pulls up !RS232_0 which disables external RS232 Input (allowing uploads). When my sketch wakes up, it drives !RS232_0 low which connects to External RS232, The Serial monitor can still see transmitted data, but don't try sending from the PC, the Arduino is connected to the PC thru 1k resistors, if the HC125 is active, it drives the pin 0 with upto 6ma, the 1k resistor limits the PC to 1ma so the PC cannot effectively send data to the Arduino.

Chuck.

On the Uno and similar, there is a 1K resistor between '328P and the USB chip. For the Uno to drive offboard, it just has to overcome the maybe 0.5mA load presented by the 1K Tx pullup.
For offboard reception, the sender has to overcome the same 0.5mA load from the Rx pullup.

When USB not connected, no problem. When USB connected and PC is transmitting, is best to disconnect the offboard sender so it doesn't interfere with the PC.

Just use the software serial library. Then you can specify any two digital pins to be a serial link. All of the functions associated look exactly the same as for Serial.

jrdoner: Just use the software serial library. Then you can specify any two digital pins to be a serial link. All of the functions associated look exactly the same as for Serial.

So does the Uno have UART capability on all digital pins? And a receive buffer? If so, that's wonderful!

CrossRoads: On the Uno and similar, there is a 1K resistor between '328P and the USB chip. For the Uno to drive offboard, it just has to overcome the maybe 0.5mA load presented by the 1K Tx pullup. For offboard reception, the sender has to overcome the same 0.5mA load from the Rx pullup.

I just found that on the Uno schematic. But I'm not sure it's that simple.

Yes, my chip could provide a TTL level that would overcome the '328P's voltage through the 1K resistor. But How would the '328P overcome my chip's voltage? If my chip is high, the '328P can't pull the line down to 0V through the 1K resistor,and if my chip is low, the '328P can't pull it up to a logic 1.

I think I need to make my chip high-Z between Reset and the Setup() function so there's no conflicts between the two chips.

--- Mike

But, as I uderstand it, these these pins also are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip. If so, what prevents my active TTL output from conflicting with the ATmega8U2's active TTL output?

To keep the communication from conflicting, you would use code where the devices are not communicating at the same time. As to electrical conflicts, I've used a diode between the arduino rx and the device tx, with the diode band side connected to the device tx pin.

MikeDodd: So does the Uno have UART capability on all digital pins? And a receive buffer? If so, that's wonderful!

No, it does not.

Software Serial is a polled bit banged serial emulator. It has many limitations. If at all possible use the Hardware Serial (UNO pin 0,1) Mega( 0,1 14,15 16,17 18,19)

Chuck.

MikeDodd: I just found that on the Uno schematic. But I'm not sure it's that simple.

Yes, my chip could provide a TTL level that would overcome the '328P's voltage through the 1K resistor. But How would the '328P overcome my chip's voltage? If my chip is high, the '328P can't pull the line down to 0V through the 1K resistor,and if my chip is low, the '328P can't pull it up to a logic 1.

I think I need to make my chip high-Z between Reset and the Setup() function so there's no conflicts between the two chips.

--- Mike

You are correct, if you drive the RX pin, The UNO cannot receive through the USB serial monitor.

Chuck.