My first time flashing/programming, lots of questions...

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

Hi,

I've got a ATTINY861V-10PU in a STK500 and am trying to write a simple program to turn on all LED's.

Q#1:What is the normal flow of usage in AVR4Studio? I have the code and choose Build-Rebuild All, then I Debug Start Debugging (I have AVR Simulator selected), then I click the AVR button, then Flash Use Current Simulator/Emulator Flash memory, then Program, then I hit the reset button on the STK500.

Is this right? it seems like a lot to go through. Is there an option to just compile, then program ???

Q#2:Why does the 861V need PB4/PB7 set to XT1/RST on PORTE? I found this in the STK500 ISP programming page. It makes it hard to use PORTB to drive LED's or connect to switches.

Q#3:I connected PORTA to my LED's. I then run this code:

#include

int main()
{

DDRA=255;

while(1)
{
PORTA=255;
}

}

When I press RESET I see all LED's blink just for a second and go out. WHY? Shouldn't they come on and stay on?

I appreciate any help!!!

Thanks,

Alan

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

Hi,

Also, erasing device and programming flash go FAST, but then it takes a long time "reading flash". Why is it reading??? Why does this step take much longer?

Thanks,

Alan

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

Quote:
Shouldn't they come on and stay on?
No because you are turning porta high which turns the leds OFF. Try outputting a zero on porta.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

alank2 wrote:
Hi,

Also, erasing device and programming flash go FAST, but then it takes a long time "reading flash". Why is it reading??? Why does this step take much longer?

Thanks,

Alan

Ok. My tired eyes judge a 4.5ms erase time as instant. Your young eyes perceive it as only "fast". Likewise if your actual program is only a few hundred bytes, it will only take say 50ms to program.

The program verification will only compare the bytes in the AVR with the few hundred bytes of program. So this will take less than 50ms.

Now if you want to READ the whole 8k of the chip, it will probably take the best part of a whole two seconds.

If your AVR is taking longer than this, it may be you are using an inappropriate ISP speed. My chips run at 8MHz so I can use 1.8MHz. A virgin chip runs at 1MHz so you want to choose 115kHz to be on the safe side.

I know that 10 seconds will be a large part of your life but as you get older you will just learn to accept it.

David.

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

Quote:

I know that 10 seconds will be a large part of your life but as you get older you will just learn to accept it.

lol--a lot shorter than removing the chips and baking in the UV tray.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Hi Everyone,

js wrote:
Quote:
Shouldn't they come on and stay on?
No because you are turning porta high which turns the leds OFF. Try outputting a zero on porta.

First, thank you for your help - I greatly appreciate the knowledge you are sharing!!

Yes, I found the other post about that last night. I have a "blinking" LED program, my first uC program running now. I don't quite get why they would make the LED's come on at 0 and off at 1, but I guess that is the way they designed it.

On the topic of the read, why does it read the entire flash back? It erases and programs so quickly, I guess I don't know why it reads as all perhaps to verify, but why not read the area that it programmed only?

Also, is there a way to compile directly to the hex file and then program right from there without having to start debugging on the simulator and programming via the method I was using in my original message?

Thanks,

Alan

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

Yes. You just use F7 to build the project then click on your programmer to program the HEX file.

Yes. You have to set the HEX file name for each project. If you used an external Makefile, make can do everything for you.

David.

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

Hi,

How do you set the HEX filename? Just go into the burner properties and put a filename in there? When I build, it doesn't make a HEX file...

Thanks,

Alan

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

Hi,

I found the hex file, it is in the default subdir...

Thanks for the help!!

Alan