I have a board which there is an LCD on it and I want to show some lines in the LCD. I have a broken-pin Atmega32 which the broken pins didn't used for LCD, I have written a simple code which just shows on and off a text in LCD.

Since my Atmega32 is broken and the broken pins are needed for another part of circuit I had to buy a new Atmega32 but all I found is Atmega32A.

Since technically Atmega32A can be used instead of ordinary Atmega32, I have compiled and burnt the same code that I have written for Atmega32 into the newly bought Atmega32A. But the LCD does not work anymore and also I had a sample code which rotates a step-motor clockwise and counter-clockwise each with 1000ms delay. But it took almost 5000ms in Atmega32A in order to change the rotation direction.

I don't really know what is going on!!!

Can anybody help me on this?

here is a question about the same problem that I have but the accepted answer does not contain any useful detail on how to solve the problem(or atleast I don't get it!!).

More details

The LCD display on an ordinary Atmega32 Above picture is the the LCD display on an ordinary Atmega32. The LCD display with same code on an Atmega32A(no output) Above picture is the LCD display with same code on an Atmega32A(no output)

The codes to compile and burn the codes:

avr-gcc -mmcu=atmega32 lcd-sample-main.c -o .makefiles/lcd-sample-main  -O1 && \
avr-objcopy -O ihex .makefiles/lcd-sample-main .makefiles/lcd-sample-main.hex && \
sudo avrdude -c usbasp -p m32 -U flash:w:.makefiles/lcd-sample-main.hex
  • 1
    \$\begingroup\$ Have you tried pulling the firmware from the '32 to be certain that both are running the same code? \$\endgroup\$ – Ignacio Vazquez-Abrams Dec 30 '14 at 16:35
  • 1
    \$\begingroup\$ I believe this is the fuse bits problem. Fresh chip may come with different default bits. \$\endgroup\$ – Maxthon Chan Dec 30 '14 at 16:41
  • \$\begingroup\$ Good call. A big chunk of port C is used by JTAG by default, and the incorrect clock source would throw off the timing for the LCD. \$\endgroup\$ – Ignacio Vazquez-Abrams Dec 30 '14 at 16:47
  • 1
    \$\begingroup\$ Use AVRDUDE to read the current fuse bytes from the '32 and then write them to the '32A. AVRDUDE documentation \$\endgroup\$ – Ignacio Vazquez-Abrams Dec 30 '14 at 17:24

The problem was with the fuse bits setting in the new '32A controller.
Thanks to Ignacio for giving the idea, I read the current fuse bytes from the '32 and then wrote them to the '32A and everything is working now.

To reading the fuse bits:

sudo avrdude -c usbasp -p m32 -U lfuse:r:-:h -U hfuse:r:-:h

And for writing them(These are the values that i have read from the '32 fro lfuse and hfuse)

sudo avrdude -c usbasp -p m32 -U lfuse:w:0xf4:m -U hfuse:w:0xdf:m



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.