logo elektroda
logo elektroda
X
logo elektroda

Atmega32, USBasp, Avrdude: Resolving Error Setting SCK Period & Invalid Device Signature Issues

bigben93 42675 32
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 9122471
    bigben93
    Level 10  
    Hello

    I decided to delve into the world of microcontrollers, but as it usually happens, the beginning is difficult. I ordered the Mega32 proc and the USBasp programmer (all brand new). I found an example diagram and a program for it on the Internet (2 flashing LEDs). My goal was to check if everything worked together as it should. While the program has compiled somehow, the problems start when I want to throw it into prock. Avrdude spits something like this:

    
    
    avrdude: warning: cannot set sck period. please check for usbasp firmware update.
    avrdude: error: programm enable: target doesn't answer. 1 
    avrdude: initialization failed, rc=-1
    avrdude: AVR device initialized and ready to accept instructions
    avrdude: Device signature = 0x000000
    avrdude: Yikes!  Invalid device signature.
    avrdude: Expected signature for ATMEGA32 is 1E 95 02
    avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
             To disable this feature, specify the -D option.
    


    I upload the program with the following command:

     avrdude -c usbasp -F -p m32 -U flash:w:test.hex -B10 


    I spent the whole day looking for a solution. I even contacted an electronics friend via GG, but he also doesn't know what to do (he confesses to the LPT programmer, but I have a laptop and unfortunately I can't afford such a "luxury").

    If it helps someone, I use Linux (the system recognizes the programmer).

    I am counting on your help and if you need any additional logo, let me know.

    Regards
  • ADVERTISEMENT
  • #2 9124579
    gmp
    Level 19  
    This programmer uses USB1.0 (or 1.1) emulation theoretically should work, but it has a lot of disadvantages. It is a waste of time and nerves.
    If you can afford it, buy AVR-Dragon, it has JTAG - (= revelation)
    or on the 'AVR PROG 4in1' auction site - I used it, a very friendly, professionally made programmer - in my opinion it is worth it.
  • #3 9126097
    saper_2
    Level 18  
    Hi,
    - OFF TOPIC: USBasp vs. AVR DRAGON :D -
    USBasp is a nice programmer, I mostly use it myself.
    I do not see any flaws in it - it is small and cheap - just right for a hobbyist, you do not need to spend PLN 600 on stk600 or 300 on a dragon which will only be used for ISP (jtag is such a gadget for me at least - I never needed program debugging "to the point"). And I think, in order to end the dispute about what is better, each side made a defense speech, the judge will decide :D

    But back to the author's problem :) , the new procks have the internal oscillator set to 1MHz, and in order for USBasp to handle them, set the Slow Sck jumper in the programmer.
    You have an old firmware version in your USBasp:
    avrdude: warning: cannot set sck period. please check for usbasp firmware update.
    The new version of fw usbasp can "slow down" the ISP clock itself to program new processors.

    You can use this to check communication, you don't need to program:
    avrdude -p m32 -c usbasp

    If you have everything well connected you should get something like this (I also have the old fw in mine :D ):
    avrdude: warning: cannot set sck period. please check for usbasp firmware update.
    avrdude: AVR device initialized and ready to accept instructions
    Reading | ################################################## | 100% 0.02s
    avrdude: Device signature = 0x1e9502
    avrdude: safemode: Fuses OK
    avrdude done.  Thank you.
  • #4 9127362
    bigben93
    Level 10  
    @gmp

    The price of AVR Dragon is too high for me. Maybe someday, when I delve into the world of microprocessors and it will be a job for me, I will buy such equipment. In any case, for now such a giant is out, and it's a pity to throw away this USBasp.

    @ saper_2

    Unfortunately, it is not so rosy for me:
    
    avrdude: warning: cannot set sck period. please check for usbasp firmware update.
    avrdude: error: programm enable: target doesn't answer. 1 
    avrdude: initialization failed, rc=-1
             Double check connections and try again, or use -F to override
             this check.
    
    
    avrdude done.  Thank you.
    


    The programmer-> system connection is good (I have connected the programmer so many times that I know the sequence of the legs on the prock and on the KANDA connector by heart). The programming ribbon also seems good (I checked it with an ohmmeter).

    I was also acting on my own and tried a different programming program. EXtreme Burner AVR gave me this message:

    
    Power On Failed
    Cannot Communicate with Target Chip
    


    Here they write to check the ISP connection, but as I said, I checked it in all ways available to me and everything indicates that it is OK.

    I also noticed another interesting thing. When I put a voltmeter on the Vcc and GND pins of the prock, these two LEDs somehow magically lit up. When I took the voltmeter, they remained on for a while, but then they went out. From time to time, applying a voltmeter, these LEDs started in different ways. Sometimes they flashed, sometimes only one was lit (at least it did not seem to me to be "consciously" running the program). When I managed to achieve the effect that both LEDs were on, I tried to contact the Prock, but regardless of what action I triggered at avrdude, the LEDs turned off and the program spewed out an error (to restore this light, I had to cut the power from the prock for a moment, and after turning it on from new to play with voltmeter).

    I am waiting for your opinion on this, but now it seems to me that either the chip is broken or the contact plate on which I have assembled the whole thing is not suitable for such things.
  • #5 9130138
    LordBlick
    VIP Meritorious for electroda.pl
    Why do you describe "other strange / interesting things" and what "seems". This is not a forum for artistic impressions, but for dry technical knowledge. Close the SLOW_CLK jumper (if you haven't consciously or unconsciously moved the fusebits) and the programming should start, only after that we can talk about the operation of the system. A prerequisite for proper programming is to provide power and clock, either inside (fusebits) or outside (fusebits + clock signal or RC oscillator or quartz resonator with capacitors). If you don't know how this is set, google "ATmega32 fusebity" and you know ...
  • #6 9130565
    saper_2
    Level 18  
    bigben93 , give pictures of how you connected everything (connections, power). And try to replace MISO with MOSI, it often happens to me that I get the directions wrong :) .

    Did you connect all the m32 power legs? AVCC, VCC, GND? are there blocking capacitors at the legs of the power supply?
  • ADVERTISEMENT
  • #7 9131544
    bigben93
    Level 10  
    @ Light-I

    Such "artistic impressions" can sometimes help find a solution to the problem.
    As for the jumper, I tried to program with both inserted and removed. The effect was identical.

    I didn't touch the fusebits (I didn't even go to the fusebits options). The processor is new, so it should be set to work with the built-in 1MHz oscillator (at least that's what the datasheet says).

    @ saper_2

    I tried to swap MOSI and MISO but the effect is the same. As for the scheme and connection, I used this page.

    Schematic diagram
    The drawing that I suggested when connecting the programmer

    The schematic was made for the ATMega8, but when I connected it to the M32 I had my prock's datasheet on the screen and connected it so that the pin markings matched.

    I also give a photo of the system assembled by me (made with a phone but what is most important can be seen):
    Atmega32, USBasp, Avrdude: Resolving Error Setting SCK Period & Invalid Device Signature Issues

    As for the power supply, I get electricity from the USB port (I made one cable with a plug, respectively). I checked with a voltmeter and the current reaches the prock (between Vcc and GND is 5V).
  • #8 9131736
    saper_2
    Level 18  
    It looks good, I believe you connect the programmer to PB5, PB6, PB7 (sck, mosi, miso), and of course RST and GND and VCC of the programmer.
    The capacitor is not needed on reset.
    And I would put on some quartz, e.g. 4MHz just for the sake of peace.
    It would be good to check the programmer and processor with someone, or even if you had some other processor (e.g. attiny2313 / attiny26).

    Dismantle everything again, and plug it in again (nicer :P ), but the power supply itself, blocking capacitors (and maybe quartz) and a programmer and then check.
    Oh, and add a 100u / 10V electrolyte or even more to the contact plate on the power supply, because ceramic capacitors are not enough.

    And so somehow I have already run out of ideas, what could be "no hello".
  • #9 9132176
    LordBlick
    VIP Meritorious for electroda.pl
    That's the reason - capacitor against RESET ... After this operation, it should easily move in slow mode. Well, unless this capacitor went through the USBAsp port - no capacitive loads are given directly to the push-pull output. This author of the course on the diode is that this diagram is healthy to go down ... ;) Probably designed more for the STK200, where this capacitor does not matter, because programming is much slower there ...
  • #10 9134157
    bigben93
    Level 10  
    I removed this capacitor from the RESET line and then the same.

    On Monday, I will have access to hardware and software that works at 100% for a while. I will check this processor and programmer. I hope that only this scheme was so unlucky because after the adventures with this system, I want to buy a starter kit with allegrosz. I will spend the money, but I will save myself the nerves at the stage of learning.
  • ADVERTISEMENT
  • #11 9134208
    saper_2
    Level 18  
    The last idea, remove the processor from the socket and press it without it into the board, and see if it sometimes sits well in it, because I have one contact plate that the systems pop out of it :| and sometimes it is not visible that he is not in contact.

    as I wrote, disassemble the system and reconnect (what I wrote: only the power supply and the programmer).
    Ps. Upload 2 photos of the programmer :)
  • #12 9134388
    bigben93
    Level 10  
    I will wait until tomorrow with this connection, because now I am too tired.

    Here are two emo pics of my programmer:
    Atmega32, USBasp, Avrdude: Resolving Error Setting SCK Period & Invalid Device Signature Issues Atmega32, USBasp, Avrdude: Resolving Error Setting SCK Period & Invalid Device Signature Issues
  • #13 9134721
    LordBlick
    VIP Meritorious for electroda.pl
    And how did you close the jumper from slow mode, if you do not even have soldered goldpins?
  • #14 9135555
    bigben93
    Level 10  
    @ Light-I

    Take a look at the first photo. You have a jumper soldered on the top right. As far as I know from the seller, this jumper is responsible for the free programming mode.
  • #15 9135601
    BoskiDialer
    Level 34  
    bigben93 Take a look at the second photo, there is a thick path to the jumper and it goes out to the VCC pin from the target circuit connector, so it will rather be from the power supply.
    The middle (J4) jumper is connected to the reset pin, so it will be from the firmware update, so the latter (J5) will be from slow sck
  • #16 9135643
    saper_2
    Level 18  
    Divine Dialer , you warned me for a few minutes :P . As you write, the jumper you have is from connecting the power to the programmer from the target system. J4 connects the processor reset in the programmer to the connector (needed to upload FW). And J5 remains SlowSCK.

    So when you jumper J5 (e.g. put a piece of insulated wire in the pads and twist it tightly so that both points meet) and then try to communicate with the target processor.
    I mean something like this :) :
    Atmega32, USBasp, Avrdude: Resolving Error Setting SCK Period & Invalid Device Signature Issues
  • #17 9136650
    manekinen
    Level 29  
    avrdude: warning: cannot set sck period. please check for usbasp firmware update.

    Avrdude asks you to update the firmware of the programmer itself, because the old one does not support software SCK speed change. You force such a change with a parameter -B10 . If you add this to the command, the programmer will not set the jumper. sapper_2 already wrote to send a command without this parameter, but again you got the above quoted excerpt, which is disturbing. After updating the firmware, you should get something like this instead of this error:
    set SCK frequency to xx kHz

    So I suggest you put a jumper on the update and update the firmware.
  • #18 9136787
    saper_2
    Level 18  
    mannequin it would be best, only the author cannot update "because" you need a second working programmer, and bigben93 only has a laptop with usb. I'm assuming this usbasp doesn't have a bootloader (it's not a usbasp clone). Besides, J5 short circuit and execution:
    avrdude -p m32 -c usbasp
    won't hurt.
  • #19 9139547
    bigben93
    Level 10  
    I made this jumper connected, but still no communication. The only thing that has changed is the waiting time for a response; previously i got it almost immediately and now i have to wait 2-3 seconds before getting this error message so i suspect slow programming was on.
  • ADVERTISEMENT
  • #20 9139794
    saper_2
    Level 18  
    If you have to wait for an answer, it means that the SCK line clock is slower, i.e. the programmer works in SlowSCK mode (or what to call it there :) ). If it doesn't work right now I would look for a problem with the processor and assume that the processor no is new - although from the store.
    And what did you do with what I told you:
    Have you connected some quartz (maybe not some, but 1-16MHz)?
    Have you reconnected everything (ie power supply and programmer only)?

    You can now replace MISO with MOSI.
  • #21 9211127
    gregorr_
    Level 2  
    Hello.

    I have exactly the same problem with the same programmer, but I'm trying to program Atmega328P. With standard parameters, avrdude throws me the same as the author of the thread:

    
    C:\WinAVR\bin>avrdude -p m328p -P USB -c usbasp -U flash:w:mss.hex -U eeprom:w:mss.eep
    
    avrdude: warning: cannot set sck period. please check for usbasp firmware update.
    avrdude: error: programm enable: target doesn't answer. 1
    avrdude: initialization failed, rc=-1
             Double check connections and try again, or use -F to override
             this check.
    
    
    avrdude done.  Thank you.
    


    After entering the parameters that allow you to bypass the clock check, I get something like this:

    
    C:\WinAVR\bin>avrdude -F -B10 -v -c usbasp -p m328p
    
    avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2009 Joerg Wunsch
    
             System wide configuration file is "C:\WinAVR\bin\avrdude.conf"
    
             Using Port                    : lpt1
             Using Programmer              : usbasp
             Setting bit clk period        : 10.0
             AVR Part                      : ATMEGA328P
             Chip Erase delay              : 9000 us
             PAGEL                         : PD7
             BS2                           : PC2
             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        65     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
               flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
               lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
               calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
               signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
    
             Programmer Type : usbasp
             Description     : USBasp, http://www.fischl.de/usbasp/
    
    avrdude: set SCK frequency to 93750 Hz
    avrdude: warning: cannot set sck period. please check for usbasp firmware update.
    avrdude: error: programm enable: target doesn't answer. 1
    avrdude: initialization failed, rc=-1
    avrdude: AVR device initialized and ready to accept instructions
    avrdude: Device signature = 0x000000
    avrdude: Yikes!  Invalid device signature.
    avrdude: Expected signature for ATMEGA328P is 1E 95 0F
    
    avrdude done.  Thank you.
    

    But something is probably wrong with the connection. . .

    Please put the code in tags.
    Worm
  • #22 9211325
    saper_2
    Level 18  
    Your programmer as well as the thread author programmer NOT supports the possibility of changing the operating frequency of the ISP interface from the program level, you have to set the SlowSCK jumper in your programmer, because by default the processors are set to 1Mhz intOSC, set the slowSCK jumper, or (and also) try to swap MISO and MOSI with each other :)
    And use the [code] tag for console "dumps".
  • #24 9282203
    luxus19
    Level 15  
    I have the same problem "avrdude: warning: cannot set sck period. Please check for usbasp firmware update" but only in Extream burner under Windows 7, but about 2 weeks ago it was ok :(
  • #25 9282223
    saper_2
    Level 18  
    But this is only a warning - a warning ... :)

    If you can program it you can ignore it, unless you are very bothered then you have to update the programmer fw.
  • #26 9283402
    luxus19
    Level 15  
    What if this message pops up and I can't program it?

    Atmega32, USBasp, Avrdude: Resolving Error Setting SCK Period & Invalid Device Signature Issues
  • #28 9283680
    luxus19
    Level 15  
    I can read the signature but I can't ignore it because the program does not enter the batch into the processor, how do I know it because it compares the batch loaded from the file with the one read from the processor :(
  • #29 9284739
    saper_2
    Level 18  
    Hmmm ... interesting, I had a similar problem before the update, that I sometimes had to load the program into the processor 2-3 times because avrdude gave me errors when verifying, but I did not care - I blamed the fact that I have a paw about 30 cm from the plate and the wifi card in full swing.
    But today, after fw update, so far I have not noticed this problem, and I have already reprogrammed the processor 12 times ...

    So, you need to update fw in the programmer to the newest (2009-something) - like -> need a second programmer ...

    I myself admit that I did not think that the old fw could cause such a problem.
  • #30 9285158
    luxus19
    Level 15  
    I talked to the friend from whom I bought it, he told me to send it back, check what and how, and send it back, I hope. :)

Topic summary

The discussion revolves around issues encountered while programming an ATmega32 microcontroller using a USBasp programmer and Avrdude software. Users report errors such as "cannot set sck period" and "invalid device signature," indicating potential problems with the USBasp firmware or connections. Solutions proposed include ensuring the Slow SCK jumper is set, updating the USBasp firmware, and verifying connections to the microcontroller. Users also suggest checking the power supply and using an external oscillator. Some participants share experiences with similar issues on different microcontrollers, such as the ATmega328P and ATmega8, and recommend alternative programming software when Avrdude fails.
Summary generated by the language model.
ADVERTISEMENT