Hi,
Trying to get a bootloader going. One on the first steps is to writing
the FLASH is to fill the temp buffer in the Atmel Mega64 I'm using.
; void fill_temp_buffer (unsigned int data, unsigned int adr);
; bits 7:1 in adr addresses the word in the page... (2=first word,
4=second word etc..)
_fill_temp_buffer::
_write_page::
XCALL __WAIT_SPMEN__
MOV R31,R19
MOV R30,R18 ;move adress to z pointer (R31=ZH R30=ZL)
The call __WAIT_SPMEN__ is this:
__WAIT_SPMEN__:
LDS R27,SPMCR ; load SPMCR to R27
SBRC R27,0 ; check SPMEN flag
RJMP __WAIT_SPMEN__ ; wait for SPMEN flag cleared
RET
When the Mega64 does the LDS R27,SPMCR it reads 0x41 from the SPMCR.
This would indicate that these bits are SET:
Bit 6 - RWWSB: Read-While-Write Section Busy
Bit 0 - SPMEN: Store Program Memory Enable
I'm in the bootloader memory area (Above 0xE000) and I haven't done
anything to set the SPMEN bit. What does happen the WAIT_SPMEN loops
forever because the SPMEN bit never goes low. From my reading of the
SPEC sheet this should happen. Is their a reason why this is happening?
I've looked at three different examples of bootload code and they are
all similar in this area.
Suggestions???
Regards, Bob BryantMessage
SPM Problem...
2004-03-31 by Bryant, Bob
Attachments
- No local attachments were found for this message.