Getting first character repeated in UART transmission AVR

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

I am using ATmega16 to transmit a string via UART. For some reason, when I press "write" in my programming software, AVR FLASH in this case, I get the first character of my string repeated. I attach a picture for you to understand better. I have tried different codes, so I think that the code is not the problem. I also tried receiving data and it works perfect. The problem is when transmitting. What do you think of this?

 

EDITED: An interesting thing: when I delay before the transmission, the character does not repeat. 

Attachment(s): 

-.Electronics is Science.-

Last Edited: Sun. Nov 26, 2017 - 04:26 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your programmer probably resets the AVR a couple of times. Your code fires up, prints a char, then gets reset. I gather if you power up the AVR normally, the problem doesn’t occur?

Last Edited: Sun. Nov 26, 2017 - 06:12 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
Your programmer probably resets the AVR a couple of times. Your code fires up, prints a char, then gets reset. I gather if you power up the AVR normally, the problem doesn’t occur?

 

When I power up the AVR normally, the problem doesn't occur. It just occurs when I start writing on it. 

-.Electronics is Science.-

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just to further expand, when you write the code to flash there are two phases - write to flash then verify. There’s a reset between these two with which your code fires up, prints a char thenbthe programner promptly resets and does the verify after which your code is allowed to run unhindered.