Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help in downloading program from PC to Atmega16

Status
Not open for further replies.

drmius

Newbie level 6
Joined
Jan 8, 2018
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
134
Hello all

I am trying to download program from laptop to my Atmega16. For this purpose I am using USBASP. The datasheet for the USBASP I am using is attached below. I followed the pinout and driver installation according to the manual. However, when I try to transsfer code I get following error:


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.

Assuming it is micro-controller error I bought a new IC but the problem persist. Please let me know how to proceed further


Regards
Srinidhi
 

Attachments

  • USB-ASP prog_datasheet.pdf
    5 MB · Views: 84

Hi,

We can not verify the wiring as long as you don't show it to us.

What is your power supply and what voltage? Did you check stable voltage during programming?
What clock source do you use at the target device?

Klaus
 

Hi,

We can not verify the wiring as long as you don't show it to us.

What is your power supply and what voltage? Did you check stable voltage during programming?
What clock source do you use at the target device?

Klaus

Wiring diagram is attached below: IMG_7368.jpgIMG_7369.jpg

Color Notation:
1) Blue : MOSI
2) Orange : MISO
3)Maroon : SCK
4) Green : Reset
5) Red : VCC
6) Black : Ground

Power to target IC is given by Programmer connected to laptop.


I also tried to slow down programmer frequency using -B command in AVRdude and using Jumper wire still the error remained same.
 
Last edited:

Hi,

A microcontroller needs some basics to operate correctly.

Read the datasheet, because it differs from type to type.
* all power supply pins connected? Including the Analog section?
* ceramics capacitor close at each VCC pin?
* Reset circuit?
* others?
* clock circuit / clock source? I assume the factory setup is to operate from internal clock...but as soon as you modify the fuses to any other clock source it may refuse to respond.

Use a new microcontroller and manage to get a valid communication. Reading only. Chip ID...memory contents...
With this you can verify that all your connections are correct.

Be careful with programming clock fuses or brown out fuses....

Klaus
 

Hi,

A microcontroller needs some basics to operate correctly.

Read the datasheet, because it differs from type to type.
* all power supply pins connected? Including the Analog section?
* ceramics capacitor close at each VCC pin?
* Reset circuit?
* others?
* clock circuit / clock source? I assume the factory setup is to operate from internal clock...but as soon as you modify the fuses to any other clock source it may refuse to respond.

Use a new microcontroller and manage to get a valid communication. Reading only. Chip ID...memory contents...
With this you can verify that all your connections are correct.

Be careful with programming clock fuses or brown out fuses....

Klaus

I went through datasheet and it said AVCC along with VCC should be connected to supply. I did connect it to power. Other than that no additional circuitry is needed for programming the IC.

I checked the voltage at IC pins and it is receiving 5V power. I applied external power supply removing USB power and still no use.

Please suggest how to proceed further.
 

Post your procedure you are done . the image didint shows Crystal. So what type of clock you are done ?
 

Post your procedure you are done . the image didint shows Crystal. So what type of clock you are done ?

Procedure:

1) First I installed drivers from https://www.fischl.de/usbasp/
2) Then I installed avrdude
3) In command prompt avrdude -c usbasp -p m16 (I am using atmega16)
4) when I execute above command I get the above mentioned error.
5) To slow SCK I gave avrdude -c usbasp -p m16 -B 5 -U flash:w:bootloader.hex:i
still recieved the same error.

I am using internal oscillator of atmega 16 with default fuse settings
 

The USBASP uses the ISR recording interface of the AVR, which has serious issues with regard to some Fuses, namely the inability to reprogram them. In case, if in the first recording you had for example setting in the program "External Oscillator", you will not be able to carry out a new update in the firmware if using in the actual hardware a "Crystal" unless inserting an external signal in the clock pin, but this was somehow already mentioned before by others.

What I mean is that without showing the screen of the program software with what was actually set there, and without detailing the hardware, it will not be possible to determine if your uC has already become unusable in the current configuration.
 

The USBASP uses the ISR recording interface of the AVR, which has serious issues with regard to some Fuses, namely the inability to reprogram them. In case, if in the first recording you had for example setting in the program "External Oscillator", you will not be able to carry out a new update in the firmware if using in the actual hardware a "Crystal" unless inserting an external signal in the clock pin, but this was somehow already mentioned before by others.

What I mean is that without showing the screen of the program software with what was actually set there, and without detailing the hardware, it will not be possible to determine if your uC has already become unusable in the current configuration.

Below attached are screenshots of Atmel studio showing error and progisp showing Fuse and lock. The settings of fuse and lock are default values, I haven't changed any of them.

When I click on detect uC, it gives the above error.

progisp_screen_shot.jpg

atmel studio_screen_shot.jpg
 

As you should know by reading datasheet, CKSEL=0001 means "reserved", which is hard to know which configuration will be set by default on this case (perhaps this information is also on datasheet)
 
As you should know by reading datasheet, CKSEL=0001 means "reserved", which is hard to know which configuration will be set by default on this case (perhaps this information is also on datasheet)

Is their anyway I can change it and how to do it, or is it better to get a new IC?
 

Below attached are screenshots of Atmel studio showing error and progisp showing Fuse and lock. The settings of fuse and lock are default values, I haven't changed any of them.

When I click on detect uC, it gives the above error.View attachment 144264View attachment 144263



0xE1, 0x99 is 1Mhz only
for 8Mhz you should use 0XE4 ,0X99.

LCD works according to the command with specific time as in data sheet ,if you use 1Mhz it might be not correct ,(assumption only )

https://www.engbedded.com/fusecalc/
 

In case, if in the first recording you had for example setting in the program "External Oscillator", you will not be able to carry out a new update in the firmware if using in the actual hardware a "Crystal" unless inserting an external signal in the clock pin, but this was somehow already mentioned before by others.

I might be wrong but I remember that I solved this problem several time by inserting a random 8-20MHz (any of 8MHz, 10MHz, 12MHz, 16MHz, 20MHz or similiar) crystal between the OSC/crystal pins of Atmega. So it does not have to be the exact crystal used for the previous configuration...

If everything else fails, I know that there is a tool called "Atmega Fusebit Doctor - Fix Fusebits" which is dedicated to solving problems as such.
 

I might be wrong but I remember that I solved this problem several time by inserting a random 8-20MHz (any of 8MHz, 10MHz, 12MHz, 16MHz, 20MHz or similiar) crystal between the OSC/crystal pins of Atmega. So it does not have to be the exact crystal used for the previous configuration...

I may not have been clear, but the specific case I mentioned is when setting in the uC' Fuse the clock for not using the built-in internal oscillator, but rather a signal comming from an external oscillator where the crystal lies. At this specific case, the uC's ISP interface will not work, once its clock comes from the external oscillator, not present; This configuration somehow disconnects the internal oscillator, so even putting a crystal there, the internal oscillator would not work, and the ISP interface would be not able to communicate with the USBASP programmer.
 
Thanks for all the suggestions. I will try them out and get back to you all.

- - - Updated - - -

I had a similar problem a while back - in my case it was a USB driver problem, I used https://zadig.akeo.ie/ and that helped to resolve the issue.

Hi
When I connect my usvasp to PC, it is not displayed in zadig. When I check with the user manual it suggested that, if a device is not displayed it means it already has driver and I can see the device under options. It further stated that I must be careful if I want to Replace driver.

Should I go ahead and replace the driver?

- - - Updated - - -

0xE1, 0x99 is 1Mhz only
for 8Mhz you should use 0XE4 ,0X99.

LCD works according to the command with specific time as in data sheet ,if you use 1Mhz it might be not correct ,(assumption only )

https://www.engbedded.com/fusecalc/

Hi

If I attach 8M crystal oscillator, In fuse calculator which one should I chose? It shows various configurations like Ext RC 8-12Mhz (x CLK + y ms) and corresponding CKSEL and SUT values. Which is the correct configuration?
 

Hi,

like Ext RC 8-12Mhz (x CLK + y ms) and
A crystal oscillator is no RC.
You may re-read the datasheet clock input section. There you will find circuits, technical informations and fuse setup recommendations.

Klaus
 

- - - Updated - - -



Hi
When I connect my usvasp to PC, it is not displayed in zadig. When I check with the user manual it suggested that, if a device is not displayed it means it already has driver and I can see the device under options. It further stated that I must be careful if I want to Replace driver.

Should I go ahead and replace the driver?

- - - Updated - - -


Using USBdeview from https://www.nirsoft.net/ enabled me to see was happening with the USB connection. It would help eliminate a USB driver issue if it is that.
 

Hi
I did try all the suggestions given in this forum, however, I am still getting same error. What I noticed is that whether I connect target IC to usbasp or not I receive same error. I checked power at IC pins and it is getting 5V power.

Does this mean IC is defective?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top