Atmega32 and Arduino IDE

Hello guys,
I am trying to use Atmega32A with the Arduino IDE, as described here: http://www.instructables.com/id/Using-Atmega32-with-Arduino-IDE/. I am using USBasp programmer from eBay; it uploads the standard Blink sketch but reports an error: "avrdude: warning: cannot set sck period. please check for usbasp firmware update". After uploading, the Blink works, but the LED is blinking too slowly. I believe the problem is related to the clock frequency. The quartz resonator is 16MHz and the board chosen is "Atmega32-16MHz". How can I fix this problem?

Thanks.

Anton.

You need to do "burn bootloader" to set the fuses so it uses the crystal instead of the internal oscillator (by default, it uses internal oscillator divided down to 1mhz).

The cannot set sck period warning can be safely ignored.

Probably identical problem - jumper on USBasp:
http://forum.arduino.cc/index.php?topic=457283.0

When I try to do "burn bootloader", I got: "Error while burning bootloader: missing 'bootloader.tool' configuration parameter". Tried to use the jumper, the same result..

You might want to try MightyCore put out by hansibull. I just bootloaded 2 atmega16's last night and loaded the blink sketch on them. It went smoothly.

I

kprims:
You might want to try MightyCore put out by hansibull. I just bootloaded 2 atmega16's last night and loaded the blink sketch on them. It went smoothly.

GitHub - MCUdude/MightyCore: Arduino hardware package for ATmega1284, ATmega644, ATmega324, ATmega324PB, ATmega164, ATmega32, ATmega16 and ATmega8535

I tried MightyCore, and managed to bootload and upload the Blink. For some reason, the sketch started to work only when I removed the crystal and configured the setup for 1Mhz internal. The external 16Mhz still does not work.

I am using a Minimum System development board and I just exchanged a 8 Mhz crystal with a 16 Mhz crystal and uploaded the bootloader for the new crystal. Blink uploaded and working. Make sure you are using the 22 pF capacitors on the crystal and decoupling 100nF capacitors between Vcc and Gnd. You never know when you will need them. Most of the time my standalone stuff will work for bootloading without them and then a chip will show up that has to have them.

I am using the capacitors. Still, the blink works only on 1Mhz internal. Tried to program with and w/o the jumper on USBasp, no progress..

Burn the bootloader at 16 Mhz with the crystal mounted. Do you get an error message? If so, copy it and post. If burning the 16 Mhz bootloader is successful, then use upload using the programmer to load the Blink sketch. If you get an error when doing this, post the error. Use code tags </>.

Try another crystal. You must burn the bootloader to set the fuses. It won't work on 16 Mhz unless the fuses are set correctly.

Tried another crystal, got similar results. Then I changed the Usbasp driver from "libusbK(v3.0.7.0)" to "libusb-win32(v1.2.6.0) and now it works!

Thanks!

No, it does not work. The LED blinked as it should, then I uploaded another sketch and returned to blink. Now it does not work again. Changed driver for usbasp again, no progress. The LED is either off or constantly on or kinda blinks erratically several times. Here is the error that I am getting, regardless of the driver and other settings: "avrdude: warning: cannot set sck period. please check for usbasp firmware update".

You can safely ignore the "cannot set sck period" warning - it is not an error. The USBAsp firmware shipping on USBAsps you find on ebay/etc has automatically set the sck period for ages now, so that warning is completely bogus now.

I've been using ATmega32 with the 8MHz internal clock and mightyCore. It works fine...

As DrAzzy wrote this warning can be ignored. Could you provide detailed description what works and what not with outputs and schematics. I am little bit lost.

  1. You can load blink sketch with USBasp to ATmega on 1MHz internal clock. Yes or no? If yes, it is not USBasp problem.
  2. If you change the clock to external 16MHz crystal, it stops working. You have to write fuses for this change, right?
  3. Even you change crystal with another, it doesn't work. Right? Here were solved cases where somebody has a set of bad crystals.
    3a. Is your setting correct?
    3b. Does the crystal oscillating? Without oscilloscope you can check the voltage on XTAL1 pin with any cheap digital multimeter against to GND. It should be half of VCC (cca 2.5V if VCC=5V) if it is oscilating.

Budvar10:

  1. You can load blink sketch with USBasp to ATmega on 1MHz internal clock. Yes or no? If yes, it is not USBasp problem.

Yes, everything is fine with 1Mhz internal.

  1. If you change the clock to external 16MHz crystal, it stops working. You have to write fuses for this change, right?

I do "burn bootloader" after the change.

  1. Even you change crystal with another, it doesn't work. Right? Here were solved cases where somebody has a set of bad crystals.

I tried 3 crystals, two from the badge that I bought and one that was salvaged from the damaged Arduino Uno; no one of them works.

3a. Is your setting correct?

I suppose so; I followed the instructions on the website of MightyCore.

3b. Does the crystal oscillating? Without oscilloscope you can check the voltage on XTAL1 pin with any cheap digital multimeter against to GND. It should be half of VCC (cca 2.5V if VCC=5V) if it is oscilating.

That's a great idea; I have an oscilloscope and will check it (probably next week) and update.

Thanks!

  1. So the USBasp works fine.
  2. Same with the USBasp. In this step it looks like also the crystal works fine.

Could it be bad 22 pF capacitors? Mine are rather cheap, ceramic caps.

Yes, of course but if you have an oscilloscope as you mentioned, why not to check the clock signal.

Well, I started to connect the oscilloscope probe as Budvar10 suggested. While I connected just one wire from the ground of the circuit to the scope's ground, the LED started blinking! I found that the ground of the circuit was bad. I used pin 3 of the USBasp cable which is supposed to be ground (pls see the picture), however, with such a configuration, the circuit does not work. Tried to connect the ground to the pins 5, 7 and 9 -everything is working. The pin 3 of my programmer is not connected to the ground. Maybe this information could be useful for the newbies like me..

Um. Wouldn't "pin 1" normally be on the side of the connector with the color-striped wire? (opposite from your picture.)
I've noticed that a lot of programming connectors seem to have pin number opposite from what you'd expect by the way the able lies...