Quote Originally Posted by Darrel Taylor View Post
I've never seen a serial EEPROM with a 256 byte page buffer. Which one are you using?

> Even with the page feature I would need a ~10ms pause every 256 bytes to have the time to write the 256 bytes array into serial eeprom using the page write. That's why I have to keep the 10ms interval between character from hyperterminal. Any idea? Did I miss something?

Well, first off ... the Page Write Buffer is just that, A Buffer. Buffering the whole page in the PIC before writing it to the Page Write Buffer, isn't very efficient. The purpose of the buffer on the PIC should only be to collect incoming data during the time when it can't send it to the EEPROM's buffer because it's in a write cycle. How big that buffer needs to be, depends on the baud rate of the incoming data (also unknown at this point) and how long the EEPROM takes to write. But for sure it's less than 256 bytes.

> I'm chosing 452 or 242 because Norm made an application based on this microcontroler ...

The 2520/4520 will do everything the 252/452 can. And more.

> About USART, do I need to poll a bit? The program executes the next instruction once the HSERIN is done, no??

If you want the program to stop dead in it's tracks every time, sure, go for it.
Personally, I'd rather let the program continue on doing other things like buffer maintenance and figuring out how many bytes to write to the Page buffer at a time.
<br>
About the serial EEPROM buffer, maybe I missed something.
It is a Microchip 25AA1024. Assume we use a 10MIPS PIC (=100ns inst cycle). From what I've read, you send the WRITE/PP instruction (8 bits = 8 clock cycles) then 24 bits address (=24 clock cycles) then up to 256 bytes (= 256*8 clock cycles) then you bring the CS_ pin high to enable the self-timed write cycle that can, in the worst case, be 10ms (that's why I will need to poll the WIP bit before starting the next page write).
So I beleive sending the page to the eeprom takes roughly ~ (1+3+256)*8*100 ns = 208Us then we can go back to storing the next 256 incoming bytes, one every 1ms (256ms to fill the 'buffer array' for the next page).

"The purpose of the buffer on the PIC should only be to collect incoming data during the time when it can't send it to the EEPROM's buffer because it's in a write cycle"
-> That's exactly how my 256 bytes buffer in PIC RAM is used.

"How big that buffer needs to be, depends on the baud rate of the incoming data (also unknown at this point) and how long the EEPROM takes to write"
-> What? We will get 1 byte every 1ms... no? Or you mean the speed at which the BITS arrive in the PIC? I consider the situation where the transfer is immediate (it should be at 115kb) and a 1ms interval between each byte. So it will take more thant 256ms to transfer 256bytes. Do you agree?

"But for sure it's less than 256 bytes."
-> Why so?

"If you want the program to stop dead in it's tracks every time, sure, go for it.
Personally, I'd rather let the program continue on doing other things like buffer maintenance and figuring out how many bytes to write to the Page buffer at a time."
-> I'm sorry but I don't understand. Why would the program stop dead??? You mean the program will be idle while the HSERIN is getting its 8 bits of data? Right?
In this case, yes, I might check the bit so I gain the time during which HSERIN is getting the bits (it shoud logicaly take 8.7Us per bit at 115000 bps so about 70Us for 8 bits... not much you can do during such a short period)... I could lower the baud rate maybe.