USB AVR Prograrmmer, part 1300


I recently purchased your new AVR programmer and have some questions. I am using AVR Studio 4.17 and I am scratching my head on a couple of items.

ISP Frequency - I understand that the ISP frequency should be no more than 1/4 the target clock frequency but I have found it has to be less, more like 1/8 of the target frequency. For an MCU running 1mhz (the default for many AVRs), the ISP frequency should be able to go as high at 250khz but I can’t even get 115khz to work. At 56khz or lower it will program the chip.

The available ISP frequencies seem to vary depending the the target chip. Is this normal?

I used the configuration utility to set the ISP frequency but when I check it in AVR studio, the value is different. If it set it in AVR studio and read it back in AVR studio, it is consistent. Is this a bug in the config utility?

I am working with the developer of Bascom to build in support for this programmer. if we can iron out some of these items, he will be able to have native support for it. The Bascom users of the world will be happy to have a reasonably priced USB programmer :slight_smile:

Eddy Wright
Wright Hobbies LLC

Hello Eddy Wright,

In order to be compatible with AVR Studio, the Pololu USB AVR Programmer uses the same protocol as the AVRISP programmer. AVR Studio can not distinguish our programmer from the AVRISP. However, our programmer supports different frequencies than the AVRISP, so the frequency labels you saw in AVR Studio are wrong. For example, if you see “1.843 MHz” in AVR studio, it actually means 2000 kHz on our programmer. If you look at the table in Section 3.d of the user’s guide you can see the correspondence between those labels and the actual frequency used on the programmer. If you use our configuration utility, then you can set the frequency using the correct labels. As far as I know, there is no bug in our configuration utility or in the AVR Studio window for setting the ISP frequency. Both methods of setting the frequency will work, but if you are doing it in AVR studio you just have to remember that the labels are wrong.

When you tried setting the frequency to 115 kHz in AVR Studio, you were actually setting it to 750 kHz, so that’s why it didn’t work on your 1 MHz AVR.

The typical AVR data sheet will tell you that the SCK low time and SCK high time both have to be “> 2 CPU clock cycles for fck < 12 MHz, 3 CPU clock cycles for fck >= 12 MHz”. So if your AVR’s clock frequency is less than 12 MHz, the ISP frequency must be less than 1/4th of the clock frequency. If your AVR’s clock frequency is greater than or equal to 12 MHz then the ISP frequency must be less than 1/6th of the clock frequency.

I have never noticed that the ISP frequencies in AVR Studio vary depending on the target chip. What two target chips have you tried that have different ISP frequencies available in AVR Studio? If there are some chips that are incapable of higher clock speeds, I can imagine that AVR Studio wouldn’t let you select some of the higher frequencies: is that the case?

That’s cool that you are working to make Bascom work with our programmer! I don’t know if you have these already, but here are the documents describing the protocol: AVR068: STK500 Communication Protocol and command.h.

The ISP frequency is determined by a one-byte parameter called SCK_DURATION which can take any value between 0x00 and 0xFF. AVR Studio only lets you set this parameter to 6 different values. In the table below, you can see the correspondence between SCK_DURATION, the label in AVR Studio, and the actual frequency used on the programmer. All frequencies listed below are in units of kHz.

AVRISP Freq Label    Actual Freq  SCK_DURATION
-----------------    -----------  ------------
  1843               2000            0x00       
   460.8             1500            0x01      
   115.2              750            0x02     
    57.6              200            0x03  <- factory default, because it works for 1 MHz AVRs
     4.00               4.0          0x26
     1.21               1.5          0xFE

Let us know if you have any more questions, and good luck integrating the programmer in to Bascom!


Hi David,

Mark added more controls to the programmer options so I can now make your programmer work with Bascom using the native STK500 driver included with Bascom. I’m very happy!

I am a little confused why the frequencies of your programmer are different from the standard though. Software will set the sck duration byte based on what the STK500/AVRISP standard is which was the root cause of the problem with Bascom. Bascom was setting the sck_dur to 0x02 which would work with the AVRISPv2, but the 750khz of your programmer was too high. To get around this, Mark added the ability to skip setting the sck duration parameter and he added the ability to set the clock frequency which adjusts the sck duration value. Are the ISP frequency settings a result of the PIC’s clock speed or something else?

Thanks for your help, it cleared up the confusion.


Great! I’m glad I could help.

There is not much of a standard for what do with SCK_DURATION. According to page 31 of AVR068, the STK500 and AVRISP use different frequencies for the same values of SCK_DURATION. A value of 0x01 is 460 kHz on the STK500 and 230 kHz on the AVRISP. So 0x01 is the best setting to use for 1 MHz processors on the AVRISP, but on the STK500 it is too fast. At the time we were designing the programmer, we only really looked at AVR Studio and avrdude, and neither of those programs set the SCK_DURATION automatically, so we didn’t foresee this being a problem. If we had thought of it, maybe we would have changed the frequencies so that 0x02 is slow enough for 1 MHz AVRs. Now that Mark has added an option in Bascom for not setting SCK_DURATION, hopefully that won’t be a problem any more.

It would be even better if Mark added a feature in Bascom that either asks the user what type of programmer he is using, or determines it automatically, so that he can choose the best SCK_DURATION automatically. To automatically distinguish between the STK500 and the AVRISP/Pololu Programmer, he can issue the CMD_SIGN_ON command. Our programmer and the AVRISP both return “AVRISP_2” while the STK500 returns “STK500_2”. To distinguish our programmer from the AVRISP, there are some low-level Windows commands for device management that you can use to look at all the virtual COM ports and find out their USB product and vendor IDs. If the product ID is 0x0081 and the vendor ID is 0x1FFB and the COM port of the device matches the COM port that Bascom is connected to, then Bascom knows that it is talking to a Pololu USB AVR Programmer. I have some working C# code that does something very similar to this and I’d be happy to share it if you or Mark are interested.


Mark did add that option, see the screen shot attached. The driver now provides enough controls to manage variation among AVRISP clones, within reason of course.

Most would assume, as Mark did, that if it returns AVRISP, it is an AVRISP. The variation in ISP frequency caused some problems but it was not insurmountable. The differences in the 0x02 and 0x03 values were significant enough to cause the 1mhz chips to fail. Otherwise, the variation was insignificant. I will include a small note with the programmer (and on my web site) providing set up instructions for using it with Bascom. The simple answer is to check the “Do not set the ISP clock frequency” box and use the factory default setting. This will work with everything except the extremes like the 128k clock option of the Tiny13.

All in all, this is a neat little programmer at a great price. I find it ironic that it uses a PIC to program an AVR. :laughing: