AVRISP, AVRStudio4.18 and ISP frequency

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was playing with AVRStudio4.18 + STK500 plugin, and an AVRISP (v2 firmware in the original AVRISP, NOT AVRISP MkII), when I noticed that it displays incorrectly the ISP Frequency. The ISP frequency range in the pulldown should go from some 900kHz down to 600Hz, half of what is the range of STK500 (1.8Mhz downto 1.2kHz). IIRC older version of Studio displayed this correctly.

The stk500.exe command line tool displays the frequency correctly.

Anybody else who could confirm/reject my suspicion, or any previous post here (I did search found nothing) before I complain at Atmel?

Thanks,

Jan Waclawek

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have lost the plot. AFIK stk500.exe only uses stk500v2 protocol. As such, it only drives a STK500 or AVRISP-2.

I have always assumed that the AVRISP-1 only understands stk500v1 protocol. Where did you get v2 firmware ?

You can certainly interrogate any of the programmers to see their current settings. These tend to be magic values.

It is up to your PC to translate the magic value into a human readable string. And 0x01 will mean a different frequency for each hardware. i.e. you have different drop-downs for each device. I would not lose too much sleep over an obsolete programmer. Just see what the real speeds are with a Logic Analyser.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
I have lost the plot. AFIK stk500.exe only uses stk500v2 protocol. As such, it only drives a STK500 or AVRISP-2.

I have always assumed that the AVRISP-1 only understands stk500v1 protocol. Where did you get v2 firmware ?


Some background.

There are 3 different hardwares - AVRISP and STK500 connect through RS-232, AVRISP MkII connects through USB. I am NOT going to talk about the MkII/USB one here - at the end of the day it is similar in function, but I don't have that one.

There were two makes of both AVRISP and STK500, originally with AT90S1200+AT90LS8535 later with ATTiny2313V+ATMega8535L; but those are basically the same chips and I believe the firmware is written in interchangeable manner. With the upgrade, the protocol was upgraded, too, marked as V2, and then in some materials both the upgraded AVRISP and STK500 were marked as V2. That is where the confusion starts - AVRISP V2 is the old RS-232 AVRISP with newer chips and V2 firmware; not to be confused with AVRISP MkII.

The AVRISP and STK500's "brain" part is identical except for the crystal - the STK500's is 7.3728MHz whereas AVRISP ticks exactly at half of that.

And of course there is more circuitry on STK500, among others there's an "identification" circuit, a PISO shift register, through which STK500 reads a 4-bit hardwired (set through jumpers/zero-ohm-resistors) "hardware version"; the respective data input pin on AVRISP is pulled up so it reads "hardware version" 0b1111.

They work out of the *same* firmware, which thanks to that "hardware version" "knows" what hardware does it drive. However, the SPI clock setting routine does not take advantage of that nformation, and the AVRISP's clock is half of STK500's clock for the same setting - see description of PARAM_SCK_DURATION in AVR068.

david.prentice wrote:
I would not lose too much sleep over an obsolete programmer.

In what respect is that programmer obsolete? It is still perfectly fit to program the vast majority of AVRs.

My motivation is, that I am working on a patch for avrdude, which currently displays the SCK pulse duration incorrectly for STK500v2/AVRISPv2. I was comparing the real ISP frequency the value displayed by AVRStudio4.18 to find out that for AVRISP it displays it incorrectly. I am quite sure that the older version of Studio displayed it correctly (I will check later it when I get home).

That's why I am asking anybody who has AVRISP to run whichever version of AVRStudio she/he may have and check the displayed ISP frequency range in the respective pulldown.

Thanks,

Jan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I see what you mean. I have just 'connected' my STK500 by selecting 'AVRISP' on the Studio4 dropdown.

It appears to work much the same as if I had 'connected' as STK500. So it offers 1.8MHz, 460k, 115k, ... as ISP frequencies. The magic 0x00, 0x01, 0x02, ... values.

Presumably the dropdown should have offered 920kHz, 57k, ... to correspond with the slower AVRISP system crystal.

I do not possess the hardware to check this out. Mind you, 920kHz seems rather a slow max frequency. If the V2 firmware chose to, it could do SPI at 1.8MHz (F_CPU/2 Master) and use an identical dropdown. The STK500's 1.8MHz is F_CPU/4.

So it comes down to what ISP freq is actually achieved.

You can test your AVRISP even without a Logic Analyser. 1.8MHz is too fast for a 4Mhz AVR but 920kHz should be fine. An 8MHz AVR will always work.

I just did an 'avrdude -c stk500v2 -B0.5'

Avrdude whinged and said it set ISP to 1.1us. The STK500 is actually set to 460kHz (2.2us). I had never noticed this !!

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You should have more faith in me, David... ;-)

Yes the AVRISP clocks the ISP at half the STK500 does, confirmed by scoping at the 0 setting, which is 960k for AVRISP and 1.8M for STK500.

Apparently, the separate option of AVRISP/STK500 in the programming interface of AVRStudio4.18 (and in your version - 4.19 is it?) is a fake. It simply invokes the same stuff. It should supposedly then behave differently based on the identification string returned by the programmer (which "knows" it through the "hardware version" I mentioned above). And it indeed does - AVRISP does not have the VTarget/Vref implemented in hardware, and AVRStudio notifies about that when you go to that tab - regardless of whether I entered through the STK500 or the AVRISP option in the pulldown. Just that it does not do the right thing for the ISP frequency.

At home, I have 4.13, and it does not have the separate options in the pulldown (there's only one, called "STK500 or AVRISP"), it displays the correct programmer's name at the head bar of the programming window; and it displays the ISP frequencies correctly. They must have scr^H^H^Hspoiled it meantime.

I'd still like to hear this confirmed from somebody who does have the AVRISP before I write to Atmel.

Thanks,

Jan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There seem to be several problems:

Studio 4.18 build 692:
1. AVRISP assumes v2 protocol. In fact it does not recognise a v1 protocol and whinges accordingly.
2. It offers 1.8M, 460k, ... dropdown even if it has detected AVRISP rather than STK500

Avrdude:
1. '-c avrisp' uses stk500v1 protocol regardless.
2. '-c stk500v2 -B0.5' will not permit 500ns period
3. '-c stk500v2 -B2' will assume the AVRISP choice of ISP frequencies.

Without having a real AVRISP, I do not know if the v2 firmware makes 1.8M, 460k, ... available on AVRISP hardware.

I simply compiled the ArduinoISP sketch for the serial line to run at 115200 baud. This means that Studio can identify the 'programmer'.

It is simple enough to fix the avrdude behaviour. e.g. differentiate between the sign-on strings, and choose SCK parameters accordingly.

Studio is another matter. Surely it is easier to live with a feature rather than ask Atmel to 'fix' it. They generally introduce more features in the process. It is better to deal with the devil you know.

I would prefer that they sat down and thought through
building their 'ToolChain' properly.

David.