Avr Studio 4 , Windows 10 and AVRISP mkll

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

I have recently downloaded and installed AVR Studio 4.19 build 730 and had some initial difficulties with it locking up when I "Select Platform and Device", but a post in a forum led me to fix that by downloading some sort of .xml file. I can now Build and Run and step through my old programs just fine. I was also able to find a rolled back Jungo driver that fixed my problem with an ICE50.

 

My problem is with the AVRISP mkll. Device manager looks like what's immediately below when the mkll USB cable is connected to the PC. But if I select the AVRISP mkll Upgrade in the AVR Studio Tools menu and apply the jumper to get the LED to blink orange/red, AVR Studio says Error: No AVRISP mkll in boot mode found...  And when I select Program AVR and Connect AVRISP mkll USB, I get the "Connect Fail - Select AVR Programmer" message at the top of the return of the "Program AVR" screen. I'm guessing there's some sort of problem with the USB driver?

 

Your help would be appreciated.

 

 

 

 

 

Christopher Paul

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

ChristopherRPaul1 wrote:
I was also able to find a rolled back Jungo driver that fixed my problem with an ICE50.

...

I'm guessing there's some sort of problem with the USB driver?

Which USB driver?  (Jungo, WinUSB.sys)

A guess is eventually a Jungo will become non-functional due to Windows 10 USB updates.

Hopefully Atmel USB drivers 7.0.888 will correct the issue with AVRISP mkII.

https://www.avrfreaks.net/forum/studio-419-build-730-windows-10#comment-2448071 in Studio 4.19 build 730 on Windows 10 | AVR Freaks

 


WinUSB (Winusb.sys) | Microsoft Docs

 

"Dare to be naïve." - Buckminster Fuller

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

I have installed Atmel USB drivers 7.0.888. I have also installed the latest MSXML file that another post said that Avr Studio 4.19 requires.

 

AVR studio can no longer find or communicate with any hardware, all of which is Atmel-original.  Here is a list of the hardware I have that it can't communicate with:

 

JTAG ICE

ICE50 (RS-232 or USB)

AVRISP mkII

 

Your help would be appreciated.

Christopher Paul

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

No further ideas on your issue.

Hopefully an operator of AVR Studio 4.19 on Windows 10 will aid.

 

"Dare to be naïve." - Buckminster Fuller

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

Is there a later version of avr studio or of atmel studio that supports STK500 and also support either ICE50 or JTAG ICE? One that people don't have problems with getting to work with Windows 10?

 

Christopher Paul

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

ChristopherRPaul1 wrote:
Is there a later version of avr studio or of atmel studio that supports STK500 and also support either ICE50 or JTAG ICE?
No

Atmel Studio 7 has STK500 and Microchip has STK500 in-stock; otherwise, legacy tools aren't in it other than tools that are somewhat recent EOL.

Don't know what's in AVR Studio 5 and Atmel Studio 6.

 

STK500 | Atmel Studio 7

https://www.microchipdirect.com/product/search/all/ATSTK500

AVR and SAM Downloads Archive | Microchip Technology

 

"Dare to be naïve." - Buckminster Fuller

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

Is there a later version of avr studio or of atmel studio that supports STK500 and also support either ICE50 or JTAG ICE?

Download & use Studio 7 & open it up....under tools, select add target You can select the port your STK500 serial-USB adapter is at  (com1...com2...etc)...works fine!

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

"Dare to be naïve." - Buckminster Fuller

Last Edited: Fri. Oct 25, 2019 - 05:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


I have Studio7 open now in latest WIN10 & using my mkII, just fine....Here's what WIN10 is saying about it:

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

Thanks to all who posted. I have landed on Atmel Studio 7 in a Win 10 system and can communicate with the STK500.

 

I have a question that has confounded me and two other colleagues. I've simulated the attached in which I've programmed a timer 0 overflow interrupt. Interrupts are occurring and the cycle counter is advancing exactly the the amount I expect it to. Here's the problem: The active interrupt vector is External Interrupt 2! We can't figure out what's going on. Help would be appreciated.

Attachment(s): 

Christopher Paul

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

What chip are you using? Is it a mega16?  

Double check the IRQ list (see chip datasheet)...different chips use various lists...having the wrong list of IRQ's leads to mysterious disaster.  Also, some chips use IRQ jmp & some use rjmp....take a minute to ensure these are correct.

 

Use different registers in your IRQ, not the same as your main variables

 

also define

    .def zero=r2            ;used everywhere as zero as needed

 

at reset do: clr zero

 

then later you can say:

 

add meat_low, pounds   ;take care of low byte

adc meat_high, zero ; handle carry into high byte

 

 

   

also you MUST save the sreg:

 


TIM0_COMPA:	push ZL		;save ZL register during interrupt
		in ZL, sreg	;save CPU status bits during interrupt
		push ZL
		push mycat  ;save this one as well, used in this IRQ

YOUR IRQ CODE GOES HERE
YOUR IRQ CODE GOES HERE

                pop mycat   ;bring it back
	        pop ZL
	        out sreg, ZL	;return with pre-interrupt status bits
	        pop ZL		;return ZL to pre-interrupt value
	        reti			;return from timer0 compareA interrupt routine

 

Also, if you are simulating, ensure the simulator is set for the same chip type.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Fri. Oct 25, 2019 - 11:35 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for your reply.

 

To demonstrate my problem, I wanted to submit code that is as simple as possible. In the general case, of course I agree with your push and pop recommendations (except, what is “mycat”?) With the simplicity of what I submitted, the lack of push and pop doesn’t matter – my non interrupt code is

                tight_loop:          rjmp tight_loop

Just to be certain, adding push and pop did not fix the problem.

 

I am using the mega16 and have ensured that the simulator is set to this. I have compared the interrupt vector table 18 in http://ww1.microchip.com/downloads/en/devicedoc/doc2466.pdf with that of the m16def file (that I included at the start of the .asm file I submitted) with that of the assembled .lss file with that of my code. They are all identical.

 

But I found my problem – at each interrupt vector, I wrote “rjmp label” when I should have written” jmp label”. Stupid! Sorry to have bothered you.

Christopher Paul

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

Also, some chips use IRQ jmp & some use rjmp....take a minute to ensure these are correct

No bother---That can get you every tyme!!! 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

I'm trying to use timer1 in a mega16 to make a PWM, but I can get neither PD5 nor PD4 to do anything but sit at logic 0. Here's my code. What am I doing wrong?

Attachment(s): 

Christopher Paul

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

Your ASM code looks fine to me.

I suggest that you add some appropriate comments.

 

This is what CodeVision Wizard produces:

// Port D initialization
// Function: Bit7=In Bit6=In Bit5=In Bit4=Out Bit3=In Bit2=In Bit1=In Bit0=In 
DDRD=(0<<DDD7) | (0<<DDD6) | (0<<DDD5) | (1<<DDD4) | (0<<DDD3) | (0<<DDD2) | (0<<DDD1) | (0<<DDD0);
// State: Bit7=T Bit6=T Bit5=T Bit4=0 Bit3=T Bit2=T Bit1=T Bit0=T 
PORTD=(0<<PORTD7) | (0<<PORTD6) | (0<<PORTD5) | (0<<PORTD4) | (0<<PORTD3) | (0<<PORTD2) | (0<<PORTD1) | (0<<PORTD0);

// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: 8000.000 kHz
// Mode: Fast PWM top=ICR1
// OC1A output: Disconnected
// OC1B output: Non-Inverted PWM
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer Period: 4.0961 ms
// Output Pulse(s):
// OC1B Period: 4.0961 ms Width: 2.0481 ms
// Timer1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=(0<<COM1A1) | (0<<COM1A0) | (1<<COM1B1) | (0<<COM1B0) | (1<<WGM11) | (0<<WGM10);
TCCR1B=(0<<ICNC1) | (0<<ICES1) | (1<<WGM13) | (1<<WGM12) | (0<<CS12) | (0<<CS11) | (1<<CS10);
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x80;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x40;
OCR1BL=0x00;

// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=(0<<OCIE2) | (0<<TOIE2) | (0<<TICIE1) | (0<<OCIE1A) | (0<<OCIE1B) | (0<<TOIE1) | (0<<OCIE0) | (0<<TOIE0);

David.

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

David, thank you for your reply. But the quality of comments aside, I'm not getting an output. The PD4 and PD5 pins remain at logic zero. There is no PWM signal.

Christopher Paul

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

There is no PWM signal.

Are you looking at it with a scope? ...is everything connected ok, the scope set ok?  

First forget pwn, just make a loop to toggle the pin...is that showing up on the scope...then try working the pwm.

 

You only show about half the bits & registers...that is a recipe for something to be forgotten.  set all of the registers, so you never take any setting for granted.  

Note: some bits move to other registers, depending on the chip, just to cause confusion--always double-check their whereabouts.  I like to print the datasheet register descriptions pages & "fill in" with my settings...easier to spot any issue. 

Some registers in bigger chips can't be reached using in/out & need lds/sts instead.  Unfortunately, this won't show up an an error, other than things won't work. You have to look at the datasheet to find the addresses ...or...

   These macros avoid that issue:

     ldi XL, 0xC3

     OUTREG TCCR1A, XL    ....need need to worry about addressing range

 

; usage: InReg reg, addr
.macro InReg
    .if @1 < 0x40
        in @0, @1
    .elif ((@1 >= 0x60) && (@1 < SRAM_START))
        lds @0,@1
    .else
       .error "InReg: Invalid I/O register address"
    .endif
.endmacro
; usage: OutReg addr, reg
.macro OutReg
    .if @0 < 0x40
        out @0, @1
    .elif ((@0 >= 0x60) && (@0 < SRAM_START))
        sts @0,@1
    .else
       .error "OutReg: Invalid I/O register address"
    .endif
.endmacro

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Mon. Oct 28, 2019 - 01:48 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am using the AS7 simulator.

 

I checked whether I was using OUT and IN appropriately, and I was. But I replaced those instructions with your macros just to be sure. Nothing changed.

 

Please see attached. One definite problem is that simulator is showing that the OCR1A and OCR1B registers are NOT being set - they remain at 0. Any idea why?

 

On another note, I have modified the code to both program the PD4 and 5 bits as PWM outputs (set the COM1A1 and COM1B1 bits) AND toggle them by writing to portd. The simulator shows that the pins toggle just fine. But what I find strange is that setting COM1A1 and COM1B1 is supposed to disable the ability to control the output by writing to portd. Maybe the simulator portd always shows the internal portd register and NOT the part's output pin, which should track OC1A and OC1B with my code, not the internal portd register? I can find no way to get the simulator to reference OC1x. 

Attachment(s): 

Christopher Paul

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

When I program and run the part itself with an STK500, the PWM's work as expected. 

 

I cannot see a way to monitor the OCR1x bits with the Simulator. And I don't know why the simulator doesn't show the values I programmed in the OCR1A and OCR1B registers. Any ideas?

 

Christopher Paul

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

Using the I/O View with the Simulator - - Simulator

...

In some cases, read and write access go to different hardware locations. The effect of this may be that attempting to change a register/bitfield has no visible effect even if the register is actually written (like the USART UDR register in many devices), or that the effect is delayed by one or more cycles (like registers with double buffering).

...

[Note 1]

Bugs or shortcomings in the simulator I/O mapping only affects the debugger view of the register, not the function of the model. An application running on the target will not be affected by such bugs.

...

 

"Dare to be naïve." - Buckminster Fuller

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

I am using the AS7 simulator.

I never or very very rarely use the simulator (like 2 times every 5 years), and when I do I don't expect anything other than "code" & simple ports to run...So no ADC, Uarts, timers, TWI, EEPROM, etc would I even consider trying.  Why not use the actual chip?  

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

Considering that the simulator demonstrably departs from the part's behavior, why not indeed?

 

Because none of the three emulators that I have, which worked fine with AVR Studio 4 (which is a bear to deal with on Win 10), are supported by AS7.

Christopher Paul

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

ChristopherRPaul1 wrote:
Because none of the three emulators that I have, which worked fine with AVR Studio 4 (which is a bear to deal with on Win 10), are supported by AS7
The simulator in AS7 is "sim2" from AS4 (just with new parts models). Ergo you would see this in AS4 too (assuming the part model is available there).

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

Emulators act differently from simulators, no?

Christopher Paul

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

By "Emulator" do you mean purpose-made silicon to replace a chip?

Or something like JTAG, debugWIRE that talks to an OCD peripheral built in to the MCU?

 

I suspect that the "special silicon" was never feature-free.   (but I have never used those contraptions)

 

There are certain limitations of the JTAG OCD and the dW OCD.

 

From memory,  early AS4.xx had a crap Simulator.   Later versions had a "more accurate" Simulator.

For example.   Neither attempted to simulate the TWI peripheral.

 

AS7.0 Simulator is "pretty good".    I think that it even simulates PWM on the OCnx pins.

From memory,   AS4.18 Simulator did not attempt PWM.    (however I can't test this without AS4.18)

 

Your code in #1 looked fine to me.   I can run it on hardware if you like.

I don't think it is fair to expect obsolete software (AS4.18) to match current software.

A valid topic.   But only if you make it clear what is hardware and what is Simulation (and which version)

 

David.

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

To me, an emulator is a piece of hardware that acts like a physical microprocessor, or has direct access to the registers of a physical microprocessor. It deals with electrical signals that can be seen on a 'scope. In my case, this includes the ICE50 and JTAG ICE. But a simulator is a piece of code that runs on a PC and is not involved with 'scope signals - for instance, the simulators (no hardware connected to the PC) in Avr Studio 4.18 or AS7.

 

I was unable to get AS7 to simulate the timer1 PWM in the ATmega16. Even when I programmed for PWM operation, Portd in the simulator responded to "out portd" commands, ignoring OC1x, which I could not find a separate indication of. But perhaps I missed it. If it exists and if you know where to find it, I'd appreciate hearing about it.

 

I have no expectation that Avr Studio 4.18 simulators match AS7 simulators. But it is not unreasonable for me to expect AS7 to support Atmel hardware that I bought and which worked on Avr Studio 4.18. But I guess I'll have to pound salt on that one.

 

The code works just fine when I program an ATmega16 with it.

 

As always, thanks for your help and comments.

Christopher Paul

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

Why would you need to use an emulator or simulator all, just to set up a PWM wave on an output pin?

Why can't you just use the actual chip--that give an exact performance? As you will find, that often saves more time than the alternative!

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

You have intrigued me.   I will try your code in the AS7.0 Simulator.

 

David.

 

Ok.   PORTD.4 (OC1B) does not get simulated.   But Timer,  PWM period, ... all work fine.

    DDRD.3 = 1;                    //handy pin to toggle
    while (1) {
        // Place your code here
        if (TIFR & (1<<OCIE1B)) { //compare flag is simulated
            TIFR = (1<<OCIE1B);   //clear it
            PORTD.3 ^= 1;         //toggle pin
        }
    }

You can watch Timer1 registers,  PORTD registers in the I/O window.   Cycles, Stop Watch, Registers in the Processor Status Window.

 

My memory has obviously failed me.    I am sure that I found PWM or CTC toggle being simulated on the OCnx PORT registers on one model of AVR / Xmega at some time in the past.

 

David.

Last Edited: Tue. Oct 29, 2019 - 04:43 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am, unfortunately, periodically subject to "Stupid Programmer Tricks", even when I try assiduously not to be. Simulators/emulators are invaluable in helping me recover from my own unintended chicanery.

Christopher Paul

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

Thanks for looking, David. This has been educational for me in discovering one extent to which I cannot depend on even Atmel's State of the Art simulator.

Christopher Paul

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

I'd  be intrigued to know what happens in AS4 sim2, it clearly doesn't work right in AS7

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

Several peripheral applications of AVR studio 4.18 have crashed my Win 10 PC, so I will not be pursuing any more investigations of it.

Christopher Paul