Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[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:
In some devices, there is no method to detect when the Flash write cycle has ended. For this
reason, the programmer presented in this application note waits N ms before attempting to send
another command to the interface (the delay N will depend on target device, and can be found in
the programming section of the datasheet). For some devices it is possible to use polling. When
a byte is being programmed into the Flash or EEPROM, reading the addressed location being
programmed will give a value M (often $FF). At the time the device is ready for a new byte, the
programmed value will read correctly. This can be used to determine when the next byte can be
written. When programming the value M polling will not work, and a delay N should be used
before writing the next value. Polled mode will decrease the time required to program a device
 

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

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top