Problem in AVR to PC serial Communication

Discussion in 'Embedded Systems and Microcontrollers' started by allahjane, Jun 4, 2013.

  1. allahjane

    Thread Starter Member

    Sep 19, 2012
    75
    1
    Hi there,

    I am trying to achieve communication between my pc and AVR (atmega 8) using UART. For testing a LED must glow for some byte sent

    The communication takes place through a usb-vritual com port-uart device (usb to mcu serial link) (basically using the chip pl2303Hx).

    But the receiving MCU does not respond to the data being sent as if nothing is being transmitted.

    I have all the proper drivers and cables. I tried using hyper-terminal and even my own custom made app in vb.net

    However the MCU can talk with other MCU flawlessly over UART but not with the usb serial link.

    here are the settings

    data size 8bits
    stop bits 1
    parity none
    baud rate 4800 (gives UBBR value 12 for atmega 8)

    I've connected the Txd pin from the usb to serial adapter to Rx of the MCU uart with a common ground. Also the adapter takes care of level conversions (if any)
     
  2. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    What is your crystal frequency? Does the usb chip work when you connect tx and rx together, do you get an echo in the terminal?
     
  3. allahjane

    Thread Starter Member

    Sep 19, 2012
    75
    1
    Yes, I tried a loopback program. I got Ok when tx and rx were connected and failure when tx and rx were left open.That means chip is working alright. The MCU is operating at 1MHz and the profilic chip at 12Mhz
     
  4. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,364
    Are you using an external crystal on the ATmega8? If so, what is the crystal frequency?
     
  5. allahjane

    Thread Starter Member

    Sep 19, 2012
    75
    1
    No, no external crystal. operating on internal oscillator set to 1Mhz
     
  6. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,364
    I would add an external crystal.
     
  7. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    Have you tried transmitting to the terminal?

    There have been numerous times I have caught a simple baud rate error by trying to send a character and received garbled data. Also, done if those chips operate at 9600 baud by default, so you may need to set it to respond at 4800 baud.

    I didn't see any questions in your post, do you have one? ;)

    Posting your code would also help.
     
Loading...