idir93
February 20, 2018, 9:53pm
1
Hello guys,
I hope you all are doing!
I am trying to program an Atmega32 using Arduino as ISP (MightyCore).
This how I made the connections.
Connect pins 10 and 30 on IC to 5V on Arduino
Connect pins 11 and 31 to Ground on Arduino
Connect 8 MHz crystal to pins 12 and 13 on IC
Connect pin 6 on IC to pin 11 on Arduino (MOSI)
Connect pin 7 on IC to pin 12 on Arduino (MISO)
-Connect pin 8 on IC to pin 13 on Arduino (SCK)
-Connect pin 9 on IC to pin 10 on Arduino
All the connections are good. What I am experiencing is the following error message.
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
An error occurred while uploading the sketch
or this Expected signature for ATMEGA328P is 1E 95 0F Double check chip, or use -F to override this check.
.
pert
February 20, 2018, 11:32pm
2
The problem is that you have the wrong board selected.
You need to do this:
Tools > Board > ATmega32
Tools > Clock > 8 MHz external
idir93
February 21, 2018, 8:25am
3
Thanks for the answer.
Well, that is exactly what I selected!
pert
February 21, 2018, 8:53am
4
idir93:
Well, that is exactly what I selected!
...and did it solve the problem?
idir93
February 21, 2018, 9:09am
5
No, I meant this was the selection throughout! the thing is it used to work perfectly without a crystal (using internal oscillator) and now it has stopped suddenly. I am making good contacts. I have around 20 atmega32 and they all display the same problem.
westfw
February 21, 2018, 10:03am
6
I meant this was the selection throughout!
Not if it actually said:
Expected signature for ATMEGA328P is 1E 95 0F Double check chip, or use -F to override this check.
idir93
February 21, 2018, 10:13am
7
Yes. This was it! take a look at the screeshot.
pert
February 21, 2018, 1:48pm
8
The problem has nothing to do with the ATmega32 or the crystal. The problem is that the AVRDUDE command is specifying the device as ATmega328P.
Please do this:
File > Preferences > Show verbose output during: > compilation (uncheck) > upload (check) > OK
Run whatever programming process you're doing (Upload Using Programmer or Burn Bootloader)
After the process fails you'll see a button on the right side of the orange bar "Copy error messages". Click that button.
Paste the error messages in a reply here using code tags.
westfw
February 22, 2018, 12:28am
9
Have you done anything to disable auto-reset on the Arduino? (usually a ~10uF cap between RESET and GND at the arduino "power" row of pins.)
Since I have some m32s around, I gave it a try with 1.8.5 and the most recent MightCore, and it works fine here...
/Applications/arduino/Arduino-1.8.5.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Applications/arduino/Arduino-1.8.5.app/Contents/Java/portable/packages/MightyCore/hardware/avr/1.0.8/avrdude.conf -v -patmega32 -cstk500v1 -P/dev/cu.usbserial-FTD61T6Q -b19200 -e -Ulock:w:0x3f:m -Uefuse:w:{bootloader.extended_fuses}:m -Uhfuse:w:0xd6:m -Ulfuse:w:0b10100100:m
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:01:35
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/Applications/arduino/Arduino-1.8.5.app/Contents/Java/portable/packages/MightyCore/hardware/avr/1.0.8/avrdude.conf"
User configuration file is "/Users/billw/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/cu.usbserial-FTD61T6Q
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATmega32
Chip Erase delay : 9000 us
:
Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.05s
avrdude: Device signature = 0x1e9502 (probably m32)
avrdude: erasing chip
avrdude: reading input file "0x3f"
avrdude: writing lock (1 bytes):
Writing | ################################################## | 100% 0.02s
avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3f:
avrdude: load data lock data from input file 0x3f:
avrdude: input file 0x3f contains 1 bytes
avrdude: reading on-chip lock data:
Reading | ################################################## | 100% 0.02s
avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude: reading input file "{bootloader.extended_fuses}"
avrdude: writing efuse (0 bytes):
Writing | ################################################## | 100% 0.00s
avrdude: 0 bytes of efuse written
avrdude: verifying efuse memory against {bootloader.extended_fuses}:
avrdude: load data efuse data from input file {bootloader.extended_fuses}:
avrdude: input file {bootloader.extended_fuses} contains 0 bytes
avrdude: reading on-chip efuse data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 0 bytes of efuse verified
avrdude: reading input file "0xd6"
avrdude: writing hfuse (1 bytes):
Writing | ################################################## | 100% 0.05s
avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xd6:
avrdude: load data hfuse data from input file 0xd6:
avrdude: input file 0xd6 contains 1 bytes
avrdude: reading on-chip hfuse data:
Reading | ################################################## | 100% 0.02s
avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0b10100100"
avrdude: writing lfuse (1 bytes):
Writing | ################################################## | 100% 0.05s
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0b10100100:
/Applications/arduino/Arduino-1.8.5.app/Contents/Java/hardware/tools/avr/bin/avrdude avrdude: load data lfuse data from input file 0b10100100:
-C/Applications/arduino/Arduino-1.8.5.app/Contents/Java/portable/packages/MightyCore/hardware/avr/1.0.8/avrdude.conf avrdude: input file 0b10100100 contains 1 bytes
-v avrdude: reading on-chip lfuse data:
-patmega32 -cstk500v1
-P/dev/cu.usbserial-FTD61T6Q Reading | ################################################## | 100% 0.02s
-b19200
-Uflash:w:/Applications/arduino/Arduino-1.8.5.app/Contents/Java/portable/packages/MightyCore/hardware/avr/1.0.8/bootloaders/optiboot_flash/atmega32/optiboot_flash_atmega32_38400_8000000L.hex:i -Ulock:w:0x0f:m avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude done. Thank you.
avrdude: Version 6.3, compiled on Jan 17 2017 at 12:01:35
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/Applications/arduino/Arduino-1.8.5.app/Contents/Java/portable/packages/MightyCore/hardware/avr/1.0.8/avrdude.conf"
User configuration file is "/Users/billw/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/cu.usbserial-FTD61T6Q
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATmega32
Chip Erase delay : 9000 us
:
Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.05s
avrdude: Device signature = 0x1e9502 (probably m32)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "/Applications/arduino/Arduino-1.8.5.app/Contents/Java/portable/packages/MightyCore/hardware/avr/1.0.8/bootloaders/optiboot_flash/atmega32/optiboot_flash_atmega32_38400_8000000L.hex"
avrdude: writing flash (32768 bytes):
Writing | ################################################## | 100% 0.00s
avrdude: 32768 bytes of flash written
avrdude: verifying flash memory against /Applications/arduino/Arduino-1.8.5.app/Contents/Java/portable/packages/MightyCore/hardware/avr/1.0.8/bootloaders/optiboot_flash/atmega32/optiboot_flash_atmega32_38400_8000000L.hex:
avrdude: load data flash data from input file /Applications/arduino/Arduino-1.8.5.app/Contents/Java/portable/packages/MightyCore/hardware/avr/1.0.8/bootloaders/optiboot_flash/atmega32/optiboot_flash_atmega32_38400_8000000L.hex:
avrdude: input file /Applications/arduino/Arduino-1.8.5.app/Contents/Java/portable/packages/MightyCore/hardware/avr/1.0.8/bootloaders/optiboot_flash/atmega32/optiboot_flash_atmega32_38400_8000000L.hex contains 32768 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 32768 bytes of flash verified
avrdude: reading input file "0x0f"
avrdude: writing lock (1 bytes):
Writing | ################################################## | 100% 0.05s
avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x0f:
avrdude: load data lock data from input file 0x0f:
avrdude: input file 0x0f contains 1 bytes
avrdude: reading on-chip lock data:
Reading | ################################################## | 100% 0.02s
avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude done. Thank you.
idir93
February 22, 2018, 10:34am
10
Hello, problem solved! I had 5 defective ICs!!!! the sixth one worked well.
However, I am facing a problem, if I don't burn the bootloader of MightyCore, the TM1637 works perfectly and the UART is giving some random characters.
When I burn the bootloader the UART works perfectly whereas the the TM1637 doesn't go ON. Why?
pert
February 22, 2018, 10:43am
11
idir93:
if I don't burn the bootloader of MightyCore, the TM1637 works perfectly and the UART is giving some random characters.
What exactly do you mean by "if I don't burn the bootloader"?
As a wild guess I'll say it's related to the clock. When you do Tools > Burn Bootloader in the Arduino IDE it actually does two things. The first is to set the microcontroller's fuses according to the settings defined in boards.txt for your currently selected board. The second is to flash the bootloader file to the microcontroller. The exact fuses set will depend on your selections from Tools > Board, Tools > Clock, and Tools > BOD.
idir93
February 22, 2018, 10:46am
12
I meant, when I load the program to a new IC without burning the boot loader in the first place. I hve a dozen of ICs. My BOD is disabled.
pert
February 22, 2018, 10:54am
13
I believe the factory fuse settings will cause an ATmega32 to run at 1 MHz running on the internal oscillator. There is a macro named F_CPU defined when you compile which is set according to the Tools > Clock menu selection. The value of that macro is used in all clock speed dependent operations. So if you upload code to your ATmega32 with Tools > Clock > 8 MHz but the microcontroller is actually running at 1 MHz then timing dependent operations will be running at 1/8 the expected speed. With serial communication this means your microcontroller is transmitting at 1/8 the expected baud rate. So if your sketch has Serial.begin(9600) then it's actually communicating at 1200 baud. Baud rate mismatch is a common cause of "random characters".
idir93
February 22, 2018, 11:04am
14
Thanks a lot for the explanation! but now since I did burn the bootloader, I lost the TM1637 display! why so?
Whenn you burn the bootloader the entire chip gets erased. You need to upload your code again; using a serial adapter