Having Trouble talking to brand new atmega32a board.

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

I am trying to make a development board for my atmega32a according to the schematic linked below (just port B, port C, reset and the isp programmer)

<br>

avrdude.exe: warning: cannot set sck period. please check for usbasp firmware update.
avrdude.exe: error: program enable: target doesn't answer. 1 
avrdude.exe: initialization failed, rc=-1
             Double check connections and try again, or use -F to override
             this check.

avrdude.exe done.  Thank you.

<br>

I am trying to program via ISP, I have bought 2 separate ones to make sure one wasn't faulty, found here: https://www.jaycar.com.au/isp-pr...

 

I have also tried Arduino as ISP with a nano and uno with no success. 

 

I have tried the bootloader for an internal and external clock.

 

I have made 3 separate soldered boards and tried multiple atmega32 in each one, I have 5 in total.

 

In addition, I have made prototype breadboard versions that I can't talk to either.

<br>
I will like some photos of my boards and the schematic. I am very new to this and this is my first experience working with microchips. I have been at this for 2 weeks trying everything I can and I can't figure this out. Any ideas for troubleshooting would be much appreciated.

Thanks, Ethan

 

Attachment(s): 

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

Has it ever programmed successfully?

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

I somehow managed to program the second one in the photos and one on a breadboard but both were doing strange things that I didn't expect, but now I am just now able to talk to any of the boards at all. 

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

Does your programming write to the fuses? One case would be using an elf file instead of a hex file. Or, you might have set fuses manually.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Fri. Sep 23, 2022 - 03:42 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You seem to be missing the power 0.1 uF cap on the AVR power pins--very important to be very close to the pins.  Don't feel bad, they shoulda put on the schematic, which is a very nice balanced schematic.

 

With programmer unplugged, and power on make sure AVR reset measures hi

Make sure diode D3 not backwards

 

Programmer does not (usually) supply power, you do

 

you did number your isp pins as 

 

  9 7 5 3 1    or     2 4 6 8 10

10 8 6 4 2            1 3 5 7 9

 

as viewed form TOP side (NOT BOTTOM), correct?

Some students will go around in a circle --oops!

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Fri. Sep 23, 2022 - 04:03 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not recognizing the board after the first programming attempt is usually (almost always) the result of incorrectly programming the clock fuse. The common error is to program it for "external oscillator" rather than for crystal or resonator.  The result is often called "a brick", which is about what the chip is good for at that point.

 

Check out: [TUT][SOFT] Recovering from a "locked out" AVR | AVR Freaks

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Fri. Sep 23, 2022 - 04:09 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a rough idea of how to do that but my problem is actually getting anything from the board. My isp connection just reads random signatures if i use -F in AVRdude. My understanding of the fuses is that they determine the operating characteristics if the board, such as external or internal clock source, brownout detection etc. How would I go about setting the fuses manually?

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

If you are reading random signatures, then you really cannot do much of anything. At this point, you probably need to review the tutorial I linked in #6.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

Get yourself some of this wire...won't melt and 26 ga is much better/stronger to work with than 30 ga and can carry a bit of current when needed (not amps, more like 200 ma).

Much easier than the stranded (though I've gone that route many times too)

 

https://www.ebay.com/itm/3632126...

 

Solid 4 cond phone cable is good and cheap , but melts easy.  Does make easy bare buss wire

 

How would I go about setting the fuses manually?

You need the programmer to do so.

 

 

The issue also is, that you don't even know the programmer is any good/installed properly...I've had several that should work but hit the trashcan. 

Ether start with a known good programmer, or known good board to program, or suffer a lot of pain (maybe).

You could buy some little junker AVR board just to test your programmer. 

 

https://www.amazon.com/Attiny13-...

 

WHERE is your AVR power supply, you photos only show a programming cable (most programmers supply nothing, not sure about yours)

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Fri. Sep 23, 2022 - 04:35 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have added annotated photos of what my ISP pins numbering looks like. I just added a 0.1 uF capacitor between VCC and GND, and I'm getting the same result. What is the purpose of adding the capacitor here if you don't mind me asking? However, I have just realised that for D3 I have somehow just assumed it was an LED and not the 1N4148 as specified on the schematic. Do you think this could be the issue here as I haven't had that an any of my prototypes either? Cheers

 

Attachment(s): 

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

That does seem helpful although it mentions running the ISP at lower clock speeds, do you know how I might do that in AVRdude?

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

asking again--WHERE is your AVR power supply, you photos only show a programming cable (most programmers supply nothing, not sure about yours)

 

Your ISP pinout (the numbering) looks good

 

The diode is typically not really needed (it is a rare bird)

LED (off) would do no harm, as long as reset can go fully high. (led will never lite, but will serve no purpose)  ...prob just snip it out

GET RID OF C5 FOR NOW--it can be possibly be a problem (though usually with larger values)

 

Typically the only thing I have for reset is a 10K pullup, that's all (and you can even get away with no 10k).

 

WHY DOES YOUR ISP-1 SOLDER TO THE WRONG AVR PIN??  ACCRODING, IT SHOULD GO TO AVR PIN 6

i SEE AT LEAST ONE MORE THAT IS WRONG

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Fri. Sep 23, 2022 - 04:57 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've just tried with an external 5v power supply and it still gives me the same issue and no C5. I don't think it is my programmers, as I have 2 cheap ones and have tried with 2 separate Arduino as ISP boards and still get the same issue, when detecting an Arduino board through my ISP programmers I get the correct chip ID. I can see reset can go low when I press the button so I don't know if that is wrong. Could it be that the programmer is unable to pull it low or something?

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

WHY DOES YOUR ISP-1 SOLDER TO THE WRONG AVR PIN??  ACCRODING, IT SHOULD GO TO AVR PIN 6

i SEE AT LEAST ONE MORE THAT IS WRONG

 

 

ahhh...you used pb 5, pb 6, pb 7, instead of the pin numbers.

 

If the schematic had been drawn ISP with wires instead of the bus (bus to supposedly make that part easier to follow), it prob wouldn't have happensd.

 

...it is almost always easier to follow a short wire from point A to B

 

You can send the drafter a box of coal for your two week adventure

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Fri. Sep 23, 2022 - 05:06 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It uses USB power to power the MCU,

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

Wow, thanks for pointing that out, fixed both boards, got mixed up with portb starting at 0 and pins starting at 1. Still having the same issue :(

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

 Update: just put my last factory fresh IC atmega32a into the board and polled for the chip ID and got this:

>>>: avrdude -c usbasp -P COM1 -F -p m8 
Detected 1e9502 = ATmega32
>>>: avrdude -c usbasp -P COM1 -F -p m8 
ERROR: Unknown signature 000000
>>>: avrdude -c usbasp -P COM1 -F -p m8 
ERROR: Unknown signature 2e6176

 

trying again I just got random crap after that

does this mean that i somehow bricked it by reading it once?

 

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

Reading should not change anything!

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

I have managed to bootload the chip using arduino uno as an isp. I got the following back from the command line:

avrdude: Version 6.3-20201216
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\Ethan Sharpe\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.3/avrdude.conf"

         Using Port                    : COM5
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         AVR Part                      : ATmega32
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom         4    10    64    0 no       1024    4      0  9000  9000 0xff 0xff
           flash         33     6    64    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           efuse          0     0     0    0 no          0    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00

         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.02s

avrdude: Device signature = 0x1e9502 (probably m32)
avrdude: erasing chip
avrdude: reading input file "0x3f"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.01s

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.01s

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 "0b11010110"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0b11010110:
avrdude: load data hfuse data from input file 0b11010110:
avrdude: input file 0b11010110 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0b10100100"
avrdude: writing lfuse (1 bytes):

avrdude: Version 6.3-20201216
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\Ethan Sharpe\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.3/avrdude.conf"

         Using Port                    : COM5
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0b10100100:
avrdude: load data lfuse data from input file 0b10100100:
avrdude: input file 0b10100100 contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude done.  Thank you.

         AVR Part                      : ATmega32
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom         4    10    64    0 no       1024    4      0  9000  9000 0xff 0xff
           flash         33     6    64    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           efuse          0     0     0    0 no          0    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00

         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.02s

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 "C:\Users\Ethan Sharpe\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.3/bootloaders/optiboot_flash/bootloaders/atmega32/8000000L/optiboot_flash_atmega32_UART0_38400_8000000L_B0.hex"
avrdude: writing flash (32768 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 32768 bytes of flash written
avrdude: verifying flash memory against C:\Users\Ethan Sharpe\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.3/bootloaders/optiboot_flash/bootloaders/atmega32/8000000L/optiboot_flash_atmega32_UART0_38400_8000000L_B0.hex:
avrdude: load data flash data from input file C:\Users\Ethan Sharpe\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.3/bootloaders/optiboot_flash/bootloaders/atmega32/8000000L/optiboot_flash_atmega32_UART0_38400_8000000L_B0.hex:
avrdude: input file C:\Users\Ethan Sharpe\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.3/bootloaders/optiboot_flash/bootloaders/atmega32/8000000L/optiboot_flash_atmega32_UART0_38400_8000000L_B0.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.02s

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.01s

avrdude: verifying ...
avrdude: 1 bytes of lock verified

avrdude done.  Thank you.

 

This seems to be working fine, I still can't talk to the board through avrdude though through both my Uno and ISP. But I am somehow able to bootload the chip

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

It uses USB power to power the MCU,

Is that verified? Maybe some cheapo Chinese do not?  Just take a meter to the AVR pins to be sure, can waste a lot of time otherwise

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

Update: I have managed to program the board over Arduino ISP, but I am only able to do this using the Arduino IDE. Using the ISP programmers and Arduino on avrdude just gives me the error:

 

avrdude.exe: error: program enable: target doesn't answer. 1 
avrdude.exe: initialization failed, rc=-1
             Double check connections and try again, or use -F to override
             this check.

avrdude.exe done.  Thank you.

 

I have included some photos of the bootload settings I have used and a photo of it running the sample code successfully

 

Please let me know if I am setting up my AVRdude wrong or if there is some workaround; I need it to work as I want to write hex files to the controller compiled from assembly in microchip studio

 

Also I have used an external power source as well as powered it via the programmer and it doesn't seem to make any difference

Attachment(s): 

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

Top tip... Never use the -F option. 

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

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

1.  never use -F

2.  USBASP can supply power to the target.   It is very handy to power target board via USBASP.

3.  Most USBASP can be configured to provide 3.3V or 5V or none

4.  The warning: cannot set sck period. just means that you have got good Chinese firmware.  (better than German)

5.  All integrated circuits require 100nF ceramic capacitors on VCC, AVCC, ...

 

Serial Bootloader is only useful if you have a permanent UART link.  e.g. USB-UART dongle

 

In Arduino ISP: select mega32 as board, USBASP as programmer,  burn bootloader.  Job done.

 

Since you own a USBASP and have a 5x2 header socket it is convenient to just "Upload via programmer" in Arduino, Codevision, Bascom, AS7.0, ...

n.b. AS7.0 needs you to set up avrdude as an External Tool.

 

So the first job is to check your wiring from mega32 to the 5x2 header.

 

The second job is to buy a USB-UART dongle.   Then you can use a "Serial Terminal" and "Serial Bootloader".   Never need the USBASP again.

This will be much "safer" when experimenting.   Personally,  I always use the bootloader if I have USB-UART.

 

David.

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

avrcandies wrote:

You could buy some little junker AVR board just to test your programmer. 

or a logic analyzer

libsigrokdecode/decoders/avr_isp at master · sigrokproject/libsigrokdecode · GitHub

 

"Dare to be naïve." - Buckminster Fuller

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

"Dare to be naïve." - Buckminster Fuller

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

AVRDUDE: 2.1 Option Descriptions

[after mid-page]

-B bitclock

"Dare to be naïve." - Buckminster Fuller

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

Welcome!

Ethan_SSS wrote:
... atmega32a ... and this is my first experience working with microchips.
The follow-on to mega32A is AVR32DA/AVR32DB (AVRxt with a core voltage regulator)

UPDI is in parallel with the CPU; UPDI has its clock domain that's separate from the CPU clock.

UPDI is one-wire UART with a protocol; so, USB UART though an AVR can do speedy UPDI.

An AVRxt disadvantage is the paucity of PDIP (28 pin only other than ATmega4809-PF)

Ethan_SSS wrote:
I have been at this for 2 weeks ...
The ones at Atmel created AVRxt PCBA that are a fit for proof-of-concept (mEDBG, breadboard, perfboard, protoboard); likewise after Microchip Technology acquired Atmel (nEDBG)

 


Relevant Devices | Migration from the megaAVR® to AVR® Dx Microcontroller Families

Instruction Set Summary | AVR® Instruction Set Manual

Block Diagram | AVR® DD Family

I designed a fast UPDI Programmer | AVR Freaks

ATmega4809 | Microchip Technology

ATMEGA4809-PF | Microchip Technology Inc. | World's Largest Inventory of Microchip Products

 

AVR128DB48 CURIOSITY NANO EVALUATION KIT | Microchip Technology (nEDBG)

 

"Dare to be naïve." - Buckminster Fuller