0
\$\begingroup\$

I need to write data into my external EEPROM 25AA320A using Attiny2313. I know how to write one byte at a time. For example, spieeprom_write (200, 7); with 200 being the starting address on EEPROM, and 7 is the data i want to write into the EEPROM.

my questions are: 1. what is the next address that i can write to? 2. is 7 considered to be a byte? 3. how do i perform a page write? I know one page is 32 bytes for my EEPROM.

Thanks, it would be great if you can provide some examples.

\$\endgroup\$
3
  • \$\begingroup\$ What is spieeprom_write()? \$\endgroup\$ Commented Nov 5, 2013 at 4:43
  • \$\begingroup\$ spieeeprom_write() is a function that performs the write to EEPROM instruction. I need to feed it with address and data. \$\endgroup\$
    – user29542
    Commented Nov 5, 2013 at 17:34
  • \$\begingroup\$ Okay. But it's obscuring the answers to 1 and 3. \$\endgroup\$ Commented Nov 5, 2013 at 17:35

1 Answer 1

1
\$\begingroup\$

Well, one address generally hold one byte, so if you write to address 200 then the next byte you can write to address 201 and so on.

As for what is considered a byte and what is not, generally the write call only accepts bytes so whatever you give it will be converted to a byte. If the compiler doesn't like that, you will probably get some sort of an error when you compile it. A byte can be either 0 through 255 or -128 through 127.

For writing a page, just write 32 bytes. If you want to use specific page write commands that the chip supports but the library doesn't support, you're out of luck unless you write your own library or find one that does.

\$\endgroup\$
2
  • \$\begingroup\$ thanks Alex. One more question, how much delay do i need to put in between each byte write? where do I find this info in the datasheet?? \$\endgroup\$
    – user29542
    Commented Nov 6, 2013 at 3:32
  • \$\begingroup\$ Looks like Twc for your EEPROM is max. 5 milliseconds. So you would need to wait 5 ms between writes. Now, if you can do page writes, this means it's 5 ms every 32 bytes. A page write is formed by leaving CS low until after 32 bytes have been written. Do you know if the library you are using supports this? \$\endgroup\$ Commented Nov 6, 2013 at 6:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.