Atmega328P FTDI 5V USB Serial Communication

atmegacommunicationserialusb

I am working a Atmega328P and FTDI 5V USB Cable to get a Serial Communication between the Micro-controller and the PC. I am using Tera Term for receiving out from Micro-controller.

I am using an FTDI 5V USB Cable with 6 pinout.

I have following connections as

  • FTDI——->ATmega328P
  • VCC——–>Power
  • GND——->Ground
  • RX———>Pin3

I am using the following code:

int main(void)
{

    UBRR0H = (BRC >> 8);
    UBRR0L = BRC;

    UCSR0B = (1 << TXEN0);
    UCSR0C = (1 << UCSZ01) | (1 << UCSZ00);

    while(1)
    {
        UDR0 = '8';
        _delay_ms(1000);

    }
}

But I am not getting any values back in my Tera Term screen. I have done the appropriate settings with my Tera Term for serial.
I am kind of stuck with this for sometime now. Please can someone let me know, if I am doing something wrong?

Best Answer

You probably need to get an oscilloscope involved so that you can see signal levels and whether any actual serial signals are appearing.

Do know that the number one mistake made in connecting up serial ports like this is getting the Tx and Rx signals cross wired. The FTDI cable will be labeled with Tx being its output signal pin on pin 4 (orange wire) and its Rx being its input signal on pin 5 (yellow wire).

enter image description here

You must connect the Tx pin of the FTDI cable to the Rx pin on the AVR. Likewise you must connect the Tx pin of the FTDI cable to the Tx pin on the AVR.

The big mistake that is often made is that folks connect the two Tx signals together and the two Rx signals together.