STK500 Programming Problem

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

I am having problems programming the 8515 in the STK500. I can erase and reprogram the the flashing LED program from the factory (EXAMPLE) but nothing else. I am using AVR Studio 3.22 and everything seems to be connected properly and I get no error message when erase and enter a new program but I have not been able to get any other program to run.

In particular, I have been spending considerable time trying to get this program to run on the 8515 but after programming the output ports just stay ON and nothing happens. The program simulates fine within STK500 and one can see each output change state as desired but I have not been able to realize this is the actual part.

Below is the assembly program I am trying to run:

;*********************************************************************************
;This program increments 32 bits used to test LED display. Each character is
;selected and 16 segments are incremented. A pattern can be set based upon
;data input to seg1 and seg2.
;*********************************************************************************

.include "8515def.inc"
rjmp RESET ;Reset Handle

RESET:
.def seg1 = r16
.def seg2 = r17
.def dig1 = r18
.def dig2 = r19
.def count = r20
.def count2 = r21
.def tmp = r22
.def tmp1 = r23

ldi tmp,low(RAMEND)
out SPL,tmp
ldi tmp,high(RAMEND)
out SPH,tmp ;init Stack Pointer
ldi tmp,0xff
out DDRA,tmp ;Set PORTA as OUT
out DDRB,tmp ;Sets PORTB as OUT
out DDRC,tmp ;Sets PORTC as OUT
out DDRD,tmp ;Sets PORTD as OUT

INIT: ldi dig1,0x01
ldi dig2,0x01
ldi count2,0x08

digit1: out PORTC,dig1
rcall dly
rcall sweep
rol dig1
dec count2
cpi count2,0
brne digit1
clr dig1
out PORTC,dig1
ldi count2,0x08
ldi dig2,0x01

digit2: out PORTD,dig2
rcall dly
rcall sweep
rol dig2
dec count2
cpi count2,0
brne digit2
clr dig2
out PORTD,dig2

rjmp init
;******************************************************************************************
;SUBROUTINE- Shifts segment data first low byte and then high byte
;
;******************************************************************************************

sweep: ldi count,0x08
ldi seg1,0x01

sdata1: out PORTA,seg1
rcall dly
rol seg1
dec count
cpi count,0
brne sdata1
clr seg1
out PORTA,seg1
ldi seg2,0x01
ldi count,0x08

sdata2: out PORTB,seg2
rcall dly
rol seg2
dec count
cpi count,0
brne sdata2
clr seg2
out PORTB,seg2
ret

dly: ldi tmp, 0x0f
loop: dec tmp
cpi tmp,0
brne loop
ret

Is there something wrong with this code or is there something wrong with the STK500?

I would appreciate some input on this problem.

Thanks

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

I am not an expert yet but my suggestion would be to 1st reduce your program to a few lines (divide and conquer) and see if anything works. Also You may want to start the first line above the interrupt vectors table. Maybe there are some interrupts that are executing rogue code.

costas

admin's test signature
 

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

Thanks for the reply and the recommendations.

I was able to figure out what was going on after many trial and error sessions. The program does work as written however in order to get AVR Studio 3.22 to program this into the STK500, I needed to use the "BUILD And RUN" function. After this, I can then program the 8515 from the hex file generated. I guess with AVR Studio, just Assembling the program even though the project settings are set as hex code does not do it.

This was not obvious from the documentation for Studio 3.22. The documentation could be improved to provide more details on this.

I also had to increase the delay time so that the LED's are off long enough to verify the functioning of the program. I did this by excecuted th delay routine through multiple passes.

Once again thanks for the help.

Jim

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

I wonder if this is why I am having problems with my STK100code. It works fine on the emulator, but does strange things when 'blown' into a TINY11 chip.

Anybody other comments..

admin's test signature
 

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

Hi Jim, Rob,

Jim: This sounds strange! If you've set your Project Options to procuce a .hex file and then assemble your code, this file should be available in your project folder and you should be able to program your AVR with the STK500 software. The "build and run" will assemble your code, and then load the resulting file into the emulator (if present) or the AVR Studio simulator (if not). Under no known circumstances will "build and run" actually program the device!

Rob: I think your problem is another one altogether... I've received your mails and I'm working on it. What are your fuse settings for the ATtiny11?

Best regards,

Morten, AVR tech. support, Atmel FAE

admin's test signature