Serial Programming, help reading EEPROM

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use a ATtiny84A. It has 512 byte EEPROM.

 

I need help when reading the EEPROM through Serial Programming.

 

With the "Read EEPROM Memory" instruction I can only read byte 0 to 255.

 

How do I read the rest (byte 256 - 511)?

 

I guess I need to use the  "Load EEPROM Memory Page (page access)" instruction to load a page address?

 

From datasheet

 

From datasheet

This topic has a solution.
Last Edited: Thu. Nov 29, 2018 - 01:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was just looking at this (Dean's implementation of "AVRISPmkII" in LUFA):

 

https://github.com/abcminiuser/l...

 

And it seems to me that the way it extends the address is by using a Load Extended Address Byte (0x4D) first if it is required.

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I found some assembly code in AN_0943 that shows that the adr MSB shall be inserted in the byte before the adr LSB. The same was also true for writing to EEPROM.

 

;;**** Read Data Memory ****

w13:	
	cpi	u_data,0x64	; 'd' Read data memory
	brne	w14
	ldi	s_data,0xa0	;	wrser(0xA0);	// SPI write (byte 1)
	rcall	wrser
	mov	s_data,addrh	;	s_data = addrh;
	rcall	wrser		; wrser(s_data);	// SPI write (byte 2)
	mov	s_data,addrl	; wrser(addrl);		// SPI write (byte 3)
	rcall	wrser
	rcall	rdser		; putc(rdser());	// Send data (byte 4)
	mov	u_data,s_data
	rcall	putc

readaddrinc:
	ldi	temp1,0x01	; Auto increment address				!!!!
	clr	temp2
	add	addrl,temp1
	adc	addrh,temp2

	rjmp	waitcmd		; goto waitcmd();

 

And I found the following protocol in the ATMega16 datasheet:

 

From datasheet

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Funny you should say that - I did wonder if this was a documentation error in the t85 datasheet.

 

It seems that Atmel/Microchip are actually getting worse recently with peppering their most recent datasheets with errors!

 

Presumably the table they show was written for "small" 0..256 byte EEPROM devices and they did not consider the possibility of >256 ?

Last Edited: Thu. Nov 29, 2018 - 02:13 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
I did wonder if this was a documentation error in the t85 datasheet.

OP here is using '84A, right?

 

But '85 is even more confusing...

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Last Edited: Thu. Nov 29, 2018 - 02:13 PM