1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

UART serial communication problem

Discussion in 'AVR' started by nafri, Mar 17, 2014.

  1. nafri

    nafri New Member

    Joined:
    May 3, 2012
    Messages:
    28
    Likes:
    0
    Hi all,

    I have a trouble with UART. I want tom make AVR programing to get UART communication via USB. I also use terminal. exe to sent data, firstly my plan is that I sent to Arduino a char and receive integer like '1'. it can be quite simple but I can not make this. Also every documents make echo which is sent a char and come back same char I also make this and also I have problem with this because when I write terminal ' a ' it can sent it back but when I write 'c' it sent another char such as 'b ' how can I tackle this problem. thanks for your attention....
     
  2. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,917
    Likes:
    1,097
    Baud rate is wrong. # Start bits wrong. #of Stop bits wrong, Wrong data length, Parity (odd, even or none are options), wrong handshake signals.

    Some of my older techniques is to loop back the data, that at least tells you you can send.

    Did a lot with RS232 since 1975 or so, You always needed an expensive little box that could re-route any signal and you had lights for every signal. Then IBM went 9 Pin any really messed stuff up.
     
  3. nafri

    nafri New Member

    Joined:
    May 3, 2012
    Messages:
    28
    Likes:
    0
    ok.. thanks for your reply now I solve the problem but when I write 'a' it always send "1" it enters the infinite loop I think Icansolve this problem with udr0. if I can clear inside the UDR0 after send.I beleive it can exit the infinite loop. how can I clear inside of the udr0.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. ikalogic

    ikalogic Member

    Joined:
    Dec 27, 2003
    Messages:
    834
    Likes:
    14
    Location:
    Limoges, France

    Can you share your source code?
     
  6. kubeek

    kubeek Well-Known Member

    Joined:
    Mar 11, 2006
    Messages:
    1,488
    Likes:
    186
    Location:
    Prague, Czechia (not Chechnya)
    The way I setup UART is that I keep sending a character or string in a loop within the microcontroller, and then I try setting up the baud rate so that the computer can receive it. Also you might wanna look at it on an oscilloscope.
     

Share This Page