I select the adecuate board and the programmer. But when I try to burn it it gives this error:
avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: program 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.
So as I understand the problem is that the firmware on my programmer is old and is not compatible with the new functions. Specifically the one that sets the clock rate on the programmer. According to this it is only a matter of comunication; but the thread doesen't give a solution on how to bypass this issue.
I have the JP1 jumper bridged because the chip is fresh and so I need slow programming.
kprims:
The JP1 jumper is used for self programming, remove it and try again. Some of the Chinese USBasps have firmware to account for slow programing.
I have had great luck using this Alpha Firmware for USBasp's.
True, looking at schematics and the tracks on the PCB reveals that the port for slow programming is JP3.
The thread you attach recomends not to upgrade the firmware due to potential errors during updating that could brick the USBasp
However, I continue to have the same error even after removing the jumper
Update: I've tried to upload a bootloader to an Arduino Nano and it worked.
So I think that two things can happen:
That there's some error on my PCB which makes impossible for the bootloader to be burn. However, I don't know where I could have made a mistake since I checked with several barebone atmega2560 to make mine.
That the programmer is unable to enter the slow speed mode needed to program a fresh atmega
Please ignore the warning about the USBasp firmware. The stock firmware will work just fine for burning a bootloader on an ATmega2560. While the alpha firmware is nice, I think you are better off focusing on the real problem instead of getting sidetracked into a completely different project.
pert:
Please ignore the warning about the USBasp firmware. The stock firmware will work just fine for burning a bootloader on an ATmega2560. While the alpha firmware is nice, I think you are better off focusing on the real problem instead of getting sidetracked into a completely different project.
Thanks for the info.
Thats the conclusion I got to since I've been able to burn the bootloader to an Arduino Nano.
The problems seems to be on the fresh chipo since I've check continuity from the ICSP pins to the corresponding leg on the atmega chip. I've done the same for 5V and GND.
Is there some configuration I'm missing on the programmer?
What also makes me think there's a problem on the circuit is that the programmer doesen't obtain responde from the board as you can see on my first message... But again the message seems to don't allow to discriminate between circuit or wiring problem and clock incompatibility
You could check capacitors C13 and C14 and since they hook to your crystal, they may be stopping you from programming. It may just be the picture, but they look damaged.
Maybe also clean up the PCB as it looks like it could use it. Again, it may just be the photo, but when I blow things up, it looks a little rough.
kprims:
You could check capacitors C13 and C14 and since they hook to your crystal, they may be stopping you from programming. It may just be the picture, but they look damaged.
Maybe also clean up the PCB as it looks like it could use it. Again, it may just be the photo, but when I blow things up, it looks a little rough.
Thanks for the response.
I've desoldered the capacitors and put on new ones. I've also cleaned the board:
The problems seems to be on the fresh chipo since I've check continuity from the ICSP pins to the corresponding leg on the atmega chip. I've done the same for 5V and GND.
Have you checked continuity from the micro all the way to the USBasp programer? Maybe you have a bad Dupont connector.
I bought a bunch of micros recently and had 1 that was bad out of the box. They are probably knockoffs. I hope your 2560 isn't bad, putting on a new one would be a bear.
exaustgas:
Have you checked continuity from the micro all the way to the USBasp programer? Maybe you have a bad Dupont connector.
I bought a bunch of micros recently and had 1 that was bad out of the box. They are probably knockoffs. I hope your 2560 isn't bad, putting on a new one would be a bear.
I don't think it's the cables since know I am using the ribon cable provided by the usbasp. I will check anyway....
I'm starting to think that it is the chip. But it is a lot of bad luck.
I bought two, the first one had to be discarded because I did a really bad job soldering it (it was my first time with smd).
But if you're saying that it happened to you maybe it is more common than I thought.
The chips where bought from LCSC
I have resorted to testing most components in a breadboard before soldering I've had so much bad luck. Probably because of my soldering skills though
Not sure how to do that with a 2560 though. Maybe solder it before anything else and see if you can upload code. If you can, solder the rest of the board. I'm pretty new to this too.
I recently had one digital pin that was bad, all else was ok. Mine came from Amazon, but are likely knockoffs, making the situation worse, who knows what's actually in there.
exaustgas:
I have resorted to testing most components in a breadboard before soldering I've had so much bad luck. Probably because of my soldering skills though
This was a problem for me. I've tested the circuit on protobard and arduino nano. It works flawlessly.
Making experimentation with atmega2560 is hard due to SMD. Moreover, I think it was a great idea to do it directly on PCB because there was less chances of getting something worng (soldering on the incorrect pin and all that stuff). I was mistaken.
exaustgas:
Not sure how to do that with a 2560 though. Maybe solder it before anything else and see if you can upload code. If you can, solder the rest of the board. I'm pretty new to this too.
Yes, I thought of that once I had soldered all the components and the board wasn't working. This however demostrated my confidence that the board would work on first try
By the way. I have made continuity testing between the pins of the THT header of the USBasp and the pins of the THT header on the PCB; they are fine.
I have also checked continuity between the pins of the THT ICSP header and the atmega2560 legs (and when I say legs it's the legs, not the solder pads) to discard any bad soldering.
Buying from aliexpress I'd expect a knock off. Do you have a hot air reflow station? Then you could remove the chip you have on there and reuse your board. The pictures are not great, are you 100 percent sure you have the orientation of the chip correct?
exaustgas:
Buying from aliexpress I'd expect a knock off.
What do you recomend then?
exaustgas:
Do you have a hot air reflow station?
No, but I could ask some favours. However, I have 9 more boards, so there's no problem (ordered from JLCPCB, so that was the minimum).
exaustgas:
The pictures are great, are you 100 percent sure you have the orientation of the chip correct?
Yes, was the first think I checked.
I mean, there are three dots on the chip. So it has to be the one in the middle which is different from the rest and smaller (see photo)
If you are worried about a good chip, digikey or mouser in the United States will have legit stuff. Considering that seems to be our best guess it might be worth buying there. I will not claim I always go there, the price difference from aliexpress to digikey is huge sometimes. But when I buy from China, I buy extras.
One more thing crossed my mind: When you plug in the USBasp and measure voltage with a DMM on the 2560 vcc and gnd pins, does it get power? I ask because, at least on my USBasp (which has a 10 pin connector, I use a 6 pin adapter) 3 of my ground pins are not connected. Inserting a photo that matches my pinout. This is probably standard, but its my last guess.
I have considered putting a power indicator LED on my boards that illuminates regardless of microcontroller status just to know if its getting power. Obviously that would consume power all the time, a consideration.
exaustgas:
If you are worried about a good chip, digikey or mouser in the United States will have legit stuff. Considering that seems to be our best guess it might be worth buying there. I will not claim I always go there, the price difference from aliexpress to digikey is huge sometimes. But when I buy from China, I buy extras.
One more thing crossed my mind: When you plug in the USBasp and measure voltage with a DMM on the 2560 vcc and gnd pins, does it get power? I ask because, at least on my USBasp (which has a 10 pin connector, I use a 6 pin adapter) 3 of my ground pins are not connected. Inserting a photo that matches my pinout. This is probably standard, but its my last guess.
I have considered putting a power indicator LED on my boards that illuminates regardless of microcontroller status just to know if its getting power. Obviously that would consume power all the time, a consideration.
I have voltage on all pins.
I also have an LED to know if the board received power and a 6-pin adapater
I think I will buy 2-3 atmega2560 from AliExpress. From digikey they cost like 3 times more than Ali and that is without even including shipping.