Search code examples
avruartatmega

UART works in one ATmega128 board but fails with same hex file in another


I have been working with ATmega128 and other such series for about 2 years and used a UART library for serial transmission. I am pretty sure the library is correct because I have used it hundreds of times but from the past few months I cannot do UART on my ATmega128. I am sure that my hardware is correct, I am sure of my code and to add to it, the same hex file runs good in other two ATmega boards but not in other boards.

  1. PORTs are giving 5V output when all pins coded to give output.
  2. Statements execute before any UART function occurs and after that it stops (does nothing, no UART, not even statements after UART)
  3. I tried copy pasting UART code completely in main.c and it worked then.

Please help! I have no idea what is going on.


Solution

  • Well, after a lot of tussle, I finally found the problem and solved it. When I checked the fuse bits of the other microcontroller (the working one), I found Extended Fuse bits different from the not working microcontroller. I changed the Extended Fuse bits to 0xFF and problem solved.