Ezequiel Paolinelli

MCU keeps resetting

Discussion created by Ezequiel Paolinelli on May 5, 2008
Latest reply on May 5, 2008 by Ezequiel Paolinelli
Hi, i have a problem with a subroutine i'm using to storage data on gp32. Don´t know why but the mcu keeps resetting everytime that goes in there. I know that because one of the leds that indicates my program is running starts flashing. Here a put the subrutine that uses the data received from the spi module and then saves it into the ram, i´m supossed to receive 512 bytes, so I will fill my entire ram space.
ramstart          EQU          $0040
mov       #$00,CONFIG2
mov       #$11,CONFIG1  (LVI and COP disabled)
         clrh                   ;clears index register high
         clrx                   ;clears index register low
         clc                    ;clears carry bit
         brclr  3,SPSCR,*      
ALMAC1:  mov    #$FF,SPDR       ;send dummy byte
         brclr  7,SPSCR,*       ;wait
         lda    spdr            
         sta    ramstart,x      
         aix    #$01                 ;index register plus one
         cphx   #$01FF          ;already 512 byte?
         bne    ALMAC1           ;if not jump