Using the preprocessor.xls file, I've setup my bootloader to have 1024 words of memory, starting at address 0xc00. The chip runs off the interal RC oscillator at 8MHz, with a baud rate of 19200. I've changed the partcode from 0x77 to 0x76 in order for AVRDUDE to correctly detect it.
I've also modified the bootloader to write the OSCAL register at startup to the calibration value found using the stk500 tool in AVRStudio 4
AVRDUDE is then able to communicate with the bootloader via the UART, correctly reads the fuses, signature bytes, etc.
It appears to erase/write memory correctly, but the process fails when performing verify at the end of a .hex download.
avrdude: verification error, first mismatch at byte 0x0000
0x12 != 0xff |
When I use either the stk500 or the bootloader to read flash memory out to a file, I see all Fs (unprogrammed) until the bootloader section, which contains the correct hex data for my code. It seems that the bootloader is correctly interfacing to AVRDUDE, correctly reading flash memory, but is not writing it correctly.
I've checked the fuse and lock bit settings-- each appear to be correct:
Fuses: H = 0xD8 (bootsize = 1024, boot reset vector enabled)
L = 0xE4 (clk = 8mhz interal osc, startup = 6ck + 64ms)
Lock bits = 0xFF (no mem lock, no app section protection, no boot section protection)
I've also tried adding the following command to the main loop of the bootloader:
else if(val =='Z') { temp_int = 0xabcd; address = 0; _WAIT_FOR_SPM(); _PAGE_ERASE( address ); _WAIT_FOR_SPM(); _FILL_TEMP_WORD( address, temp_int); _WAIT_FOR_SPM(); _PAGE_WRITE( address << 1 ); _WAIT_FOR_SPM(); _ENABLE_RWW_SECTION(); sendchar('!'); sendchar('\r'); } |
Using a terminal program, I've sent the "Z" command and gotten the expected "!" and line feed, but see no change to the contents of memory when reading it back out.
Anyone know what might be going wrong here?
(AVRDUDE log file):
C:\WinAVR\bin\avrdude -p atmega8 -P com2 -c avr109 -v -v -U flash:w:main.hex avrdude: Version 5.0 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ System wide configuration file is "C:\WinAVR\bin\avrdude.conf" Using Port : com2 Using Programmer : avr109 AVR Part : ATMEGA8 Chip Erase delay : 10000 us PAGEL : PD7 BS2 : PC2 RESET disposition : dedicated RETRY pulse : SCK serial program mode : yes parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 ByteDelay : 0 PollIndex : 3 PollValue : 0x53 Memory Detail : Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- eeprom 4 10 128 0 no 512 0 0 9000 9000 0xff 0xff flash 33 6 64 0 yes 8192 64 128 4500 4500 0xff 0x00 lfuse 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00 hfuse 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00 lock 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00 calibration 0 0 0 0 no 4 0 0 0 0 0x00 0x00 signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00 Programmer Type : avr910 Description : Atmel AppNote AVR109 Boot Loader Connecting to programmer: . Found programmer: Id = "AVRBOOT"; type = S Software Version = 1.5; No Hardware Version given. Programmer supports auto addr increment. Programmer supports buffered memory access with buffersize=64 bytes. Programmer supports the following devices: Device code: 0x76 avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.00s avrdude: Device signature = 0x1e9307 avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed To disable this feature, specify the -D option. avrdude: erasing chip avrdude: reading input file "main.hex" avrdude: input file main.hex auto detected as Motorola S-Record avrdude: writing flash (2138 bytes): Writing | ################################################## | 100% 1.28s avrdude: 2138 bytes of flash written avrdude: verifying flash memory against main.hex: avrdude: load data flash data from input file main.hex: avrdude: input file main.hex auto detected as Motorola S-Record avrdude: input file main.hex contains 2138 bytes avrdude: reading on-chip flash data: Reading | ################################################## | 100% 1.17s avrdude: verifying ... avrdude: verification error, first mismatch at byte 0x0000 0x12 != 0xff avrdude: verification error; content mismatch avrdude done. Thank you. |
--
Matthew Fornero
[EMAIL PROTECTED]
(734)-846-4968
_______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list