[SOLVED] problem in writing FLASH memory of AVR via ISP

Status
Not open for further replies.

vinodstanur

Advanced Member level 3
Joined
Oct 31, 2009
Messages
751
Helped
114
Reputation
234
Reaction score
114
Trophy points
1,333
Location
Kerala (INDIA)
Activity points
7,054
I am trying to read and write FLASH and EEPROM of an AVR (atmega8) via ISP.
I had programmed a PIC16F877A which accepts 8 bit data from UART (hyperterminal) and send it to AVR via SPI at reset zero...

I have successfully enabled the ISP mode by sending
cmd(0xac, 0x53, 0, 0); also verified the return byte.

Now I can write and read back the EEPROM without any problem..
for example,
cmd(c0,00,11,AB) writes AB at 11 of eeprom
Now I could read it by
cmd(a0,00,11,xx)
NO PROBLEM UPTO THIS...

Now,
when I am tying to write and read the FLASH, I am always gettign 0xff while reading,,,

I used command 60,68 to write and 20,28 to read (lower byte and higher byte respectively)

But ALWAYS READING 0XFF even if I modify it...
what may be the problem ?
 

vinodstanur said:
when I am tying to write and read the FLASH, I am always gettign 0xff while reading,,,

I used command 60,68 to write and 20,28 to read (lower byte and higher byte respectively)
I haven't faced the ISP challenge yet, but I found this reference from ATMEL:
http://www.atmel.com/dyn/resources/prod_documents/doc0943.pdf

page 7:
 

The Flash is programmed one page at a time.

I conudn't understand how we write flash by one page at a time..
More over, I think it is not explained in data sheet and the ISP application note..
 

vinodstanur said:
I conudn't understand how we write flash by one page at a time..
More over, I think it is not explained in data sheet and the ISP application note..

Yes you are right in this reference it is not explained. There is a possibility that the page write proccess is MCU dependent. Maybe you could take a look at some AVR datasheets and find that out.
Just an assumption... :smile:
 
Last edited:

I just looked into the USBASP source code (isp.c) but still I couldn't makeout....

I can write and read EEPROM but not FLASH...
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…