+ Post New Thread
Results 1 to 17 of 17
  1. #1
    Advanced Member level 5
    Points: 16,403, Level: 30
    Achievements:
    7 years registered
    neazoi's Avatar
    Join Date
    Jan 2008
    Location
    Greece
    Posts
    3,324
    Helped
    12 / 12
    Points
    16,403
    Level
    30

    Locking an MCU due to wrong fuses, fow to fix?

    Hi I tried to program a atmega644p-20pu and an atmega8 on a serial programmer using these fuses http://qrp.gr/microcomputer/644P.gif
    At this time I do not have the serial programmer anymore but a USBasp one, and I tried programming these two chips again. But in the new software when a fuse bit is checked, it means 1 and not 0. This is something I haven't taken care of, so essentially what I did by mistake, was to set all the other fuses, except the ones wanted.
    So accidentally I set all the lock fuses.

    Now I cannot erase the chips not even communicate with them (programmer complains cannot find target device).
    I have tried them in circuit with a 20MHz crystal in place for the atmega644, applying external power or not. Neither worked.

    Can you please let me know what to do?
    Professional engineering is the top, but amateur engineering is more fun.
    It is when you cross the barrier between these two, that things become really fascinating!

  2. #2
    Super Moderator
    Points: 256,679, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    44,779
    Helped
    13618 / 13618
    Points
    256,679
    Level
    100

    Re: Locking an MCU due to wrong fuses, fow to fix?

    A well known problem. Once you have disabled serial and JTAG programming, parallel programming is the only way to reset the fuses. See datasheet section 25.6 Parallel Programming.


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  3. #3
    Advanced Member level 5
    Points: 16,403, Level: 30
    Achievements:
    7 years registered
    neazoi's Avatar
    Join Date
    Jan 2008
    Location
    Greece
    Posts
    3,324
    Helped
    12 / 12
    Points
    16,403
    Level
    30

    Re: Locking an MCU due to wrong fuses, fow to fix?

    Quote Originally Posted by FvM View Post
    A well known problem. Once you have disabled serial and JTAG programming, parallel programming is the only way to reset the fuses. See datasheet section 25.6 Parallel Programming.
    OMG! so I now need another programmer that supports parallel programming?
    I guess I cannot do it with dip switches to set the appropriate bits to reset the chip as per 25.7.8 ?
    Professional engineering is the top, but amateur engineering is more fun.
    It is when you cross the barrier between these two, that things become really fascinating!



  4. #4
    Super Moderator
    Points: 256,679, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    44,779
    Helped
    13618 / 13618
    Points
    256,679
    Level
    100

    Re: Locking an MCU due to wrong fuses, fow to fix?

    Reviewing the documentation, I realized that disabling serial programming (SPIEN fuse) is not possible over serial programming, only over JTAG or parallel. Means you have not totally locked out further programming, but probably disabled the clock oscillator. In this case, it should work to connect an external clock source to pin XTAL1 to give programmer access.



  5. #5
    Advanced Member level 5
    Points: 16,403, Level: 30
    Achievements:
    7 years registered
    neazoi's Avatar
    Join Date
    Jan 2008
    Location
    Greece
    Posts
    3,324
    Helped
    12 / 12
    Points
    16,403
    Level
    30

    Re: Locking an MCU due to wrong fuses, fow to fix?

    Quote Originally Posted by FvM View Post
    Reviewing the documentation, I realized that disabling serial programming (SPIEN fuse) is not possible over serial programming, only over JTAG or parallel. Means you have not totally locked out further programming, but probably disabled the clock oscillator. In this case, it should work to connect an external clock source to pin XTAL1 to give programmer access.
    All right, that's a relief.
    I have a 20MHz crystal connected like this in the MCU, but it did not do anything. Maybe I should connect an external active crystal oscillator instead? What frequency?
    Professional engineering is the top, but amateur engineering is more fun.
    It is when you cross the barrier between these two, that things become really fascinating!



  6. #6
    Super Moderator
    Points: 74,965, Level: 66
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,196
    Helped
    3464 / 3464
    Points
    74,965
    Level
    66

    Re: Locking an MCU due to wrong fuses, fow to fix?

    Hi,

    Yes, use no Xtal, but an oscillator.

    Frequency: if I remember right, then it should with 1MHz and higher.
    It will work with lower frequencies, but then you may need to slow down ISP clock frequency of the programmer, too.
    Btw: this is what you can try anyway....

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.


    1 members found this post helpful.

  7. #7
    Super Moderator
    Points: 256,679, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    44,779
    Helped
    13618 / 13618
    Points
    256,679
    Level
    100

    Re: Locking an MCU due to wrong fuses, fow to fix?

    Just a valid external oscillator frequency up to 20 MHz. Probably not too low, there's a required relation to serial programming SCK.


    1 members found this post helpful.

  8. #8
    Super Moderator
    Points: 79,430, Level: 68
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    13,011
    Helped
    4345 / 4345
    Points
    79,430
    Level
    68

    Re: Locking an MCU due to wrong fuses, fow to fix?

    I'm no expert in Atmega devices but the schematic suggests it generates the negative voltage needed for serial communication comes from a charge pump (D8/D9) so check if there is a signal leaving pin 4. If it isn't there, try an external clock source. If it still isn't there, looks like you need a JTAG programmer.

    Brian.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  9. #9
    Advanced Member level 5
    Points: 16,403, Level: 30
    Achievements:
    7 years registered
    neazoi's Avatar
    Join Date
    Jan 2008
    Location
    Greece
    Posts
    3,324
    Helped
    12 / 12
    Points
    16,403
    Level
    30

    Re: Locking an MCU due to wrong fuses, fow to fix?

    Quote Originally Posted by betwixt View Post
    I'm no expert in Atmega devices but the schematic suggests it generates the negative voltage needed for serial communication comes from a charge pump (D8/D9) so check if there is a signal leaving pin 4. If it isn't there, try an external clock source. If it still isn't there, looks like you need a JTAG programmer.

    Brian.
    No this is not for the ICSP this is just a serial port fit for the project (it works).
    All the answers here are very helpful, I will try the external osc option as suggested and let you know.
    Thanks all!
    Professional engineering is the top, but amateur engineering is more fun.
    It is when you cross the barrier between these two, that things become really fascinating!



  10. #10
    Advanced Member level 5
    Points: 16,403, Level: 30
    Achievements:
    7 years registered
    neazoi's Avatar
    Join Date
    Jan 2008
    Location
    Greece
    Posts
    3,324
    Helped
    12 / 12
    Points
    16,403
    Level
    30

    Re: Locking an MCU due to wrong fuses, fow to fix?

    Quote Originally Posted by KlausST View Post
    Hi,

    Yes, use no Xtal, but an oscillator.

    Frequency: if I remember right, then it should with 1MHz and higher.
    It will work with lower frequencies, but then you may need to slow down ISP clock frequency of the programmer, too.
    Btw: this is what you can try anyway....

    Klaus
    Thanks it worked for the atmega644 I unlocked it and programmed 3 of these correctly!

    But how about the ATMEGA8 ?
    I connect the oscillator on pin 9 or 10 of the DIP and it does not seem to work
    Professional engineering is the top, but amateur engineering is more fun.
    It is when you cross the barrier between these two, that things become really fascinating!



  11. #11
    Advanced Member level 2
    Points: 2,835, Level: 12
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    561
    Helped
    49 / 49
    Points
    2,835
    Level
    12

    Re: Locking an MCU due to wrong fuses, fow to fix?

    I had similar problem programming ATmega16/32 on EasyAVR v7 and I guess I just removed the XTAL or plugged a low-frequency XTAL and programmed.



  12. #12
    Advanced Member level 5
    Points: 16,403, Level: 30
    Achievements:
    7 years registered
    neazoi's Avatar
    Join Date
    Jan 2008
    Location
    Greece
    Posts
    3,324
    Helped
    12 / 12
    Points
    16,403
    Level
    30

    Re: Locking an MCU due to wrong fuses, fow to fix?

    Quote Originally Posted by baileychic View Post
    I had similar problem programming ATmega16/32 on EasyAVR v7 and I guess I just removed the XTAL or plugged a low-frequency XTAL and programmed.
    This did not work in my case with the atmega8. It only worked with the atmega644. I have tried initially a 12MHz clock and then a 3.5MHz. I have tried applying it in both clock pins just in case. Neither worked. What am I doing wrong?
    Professional engineering is the top, but amateur engineering is more fun.
    It is when you cross the barrier between these two, that things become really fascinating!



  13. #13
    Super Moderator
    Points: 74,965, Level: 66
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,196
    Helped
    3464 / 3464
    Points
    74,965
    Level
    66

    Re: Locking an MCU due to wrong fuses, fow to fix?

    Hi,

    Reset, brown out?
    Wiring?
    Supply?

    I don't think it needs anything else..

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  14. #14
    Advanced Member level 5
    Points: 16,403, Level: 30
    Achievements:
    7 years registered
    neazoi's Avatar
    Join Date
    Jan 2008
    Location
    Greece
    Posts
    3,324
    Helped
    12 / 12
    Points
    16,403
    Level
    30

    Re: Locking an MCU due to wrong fuses, fow to fix?

    Quote Originally Posted by KlausST View Post
    Hi,

    Reset, brown out?
    Wiring?
    Supply?

    I don't think it needs anything else..

    Klaus
    Ok It may be a little confusing, so here are the connections I did on the DIP atmega8:
    Pin 1 RST also connected to programmer
    Pin 19 SCK also connected to programmer
    Pin 18 MISO also connected to programmer
    Pin 17 MOSI also connected to programmer
    Pin 7 and pin 20 VCC 5V connected to programmer VCC
    Pin 8 and pin 22 GND also connected to programmer GND
    I have tried external crystal oscillator modules connected on pin9 at first and pin10 next, to try out.

    Is there anything else I forgot to connect?
    Professional engineering is the top, but amateur engineering is more fun.
    It is when you cross the barrier between these two, that things become really fascinating!



    •   AltAdvertisement

        
       

  15. #15
    Advanced Member level 2
    Points: 2,835, Level: 12
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    561
    Helped
    49 / 49
    Points
    2,835
    Level
    12

    Re: Locking an MCU due to wrong fuses, fow to fix?

    If it is locked when you used say 20 MHz crystal then put a 4 Mhz crystal on board and then in compiler settings change XTAL frequency to say 4 MHz and build it and try to burn. See if this works. I had done something like that when I had same issue of locking with mikroC PRO AVR Compiler, ATmega16/32/2560 and 16 MHz crystal and mikroProg for AVR programmer.



  16. #16
    Advanced Member level 5
    Points: 16,403, Level: 30
    Achievements:
    7 years registered
    neazoi's Avatar
    Join Date
    Jan 2008
    Location
    Greece
    Posts
    3,324
    Helped
    12 / 12
    Points
    16,403
    Level
    30

    Re: Locking an MCU due to wrong fuses, fow to fix?

    Quote Originally Posted by baileychic View Post
    If it is locked when you used say 20 MHz crystal then put a 4 Mhz crystal on board and then in compiler settings change XTAL frequency to say 4 MHz and build it and try to burn. See if this works. I had done something like that when I had same issue of locking with mikroC PRO AVR Compiler, ATmega16/32/2560 and 16 MHz crystal and mikroProg for AVR programmer.
    When it was locked it used the internal RC oscillator. I guess it was set to 8MHz I am not sure.
    So what value of crystal oscillator should I try and is the exact value critical?
    Professional engineering is the top, but amateur engineering is more fun.
    It is when you cross the barrier between these two, that things become really fascinating!



  17. #17
    Advanced Member level 2
    Points: 2,835, Level: 12
    baileychic's Avatar
    Join Date
    Aug 2017
    Posts
    561
    Helped
    49 / 49
    Points
    2,835
    Level
    12

    Re: Locking an MCU due to wrong fuses, fow to fix?

    Quote Originally Posted by neazoi View Post
    When it was locked it used the internal RC oscillator. I guess it was set to 8MHz I am not sure.
    So what value of crystal oscillator should I try and is the exact value critical?
    Try with or without 4 Mhz crystal on programmer board and try to compile code for 1 MHz and burn. See if this works.



--[[ ]]--