|
|
View previous topic :: View next topic |
Author |
Message |
antiwingates
Joined: 31 May 2010 Posts: 5
|
write a 64K xmodem file to a 24c512 using i2c on a PIC16F690 |
Posted: Thu Dec 09, 2010 11:13 am |
|
|
Hi folks.
I am not able to do a full write of a 64KB .bin file of a 24c512 i2c eeprom using a XMODEM 128 protocol.
Write work fine until 0x2000h (8192bytes) address, the pic hang-up.
If i comment the 4 lines with write_ext_eeprom the file is received fine, but of course isn't write.
here is the code:
Code: | void receive(void)
{
byte c=0,a=0;
if(rxchar<3)//SOH + BLOQ + C-1
buffer1[rxchar]=getc();
if ((rxchar>=3) && (rxchar<35))
buffer2[rxchar-3]=getc();
if ((rxchar>=35) && (rxchar<67))
buffer3[rxchar-35]=getc();
if ((rxchar>=67) && (rxchar<99))
buffer4[rxchar-67]=getc();
if ((rxchar>=99) && (rxchar<131))
buffer5[rxchar-99]=getc();
if (rxchar==131)
chk=getc();
rxchar++;
switch (buffer1[0]) {
case SOH:
if (rxchar>131) // we have whole frame
{
c=~buffer1[1];
if (buffer1[2]==c) //checksum of no.frame correct
{
for (c=0;c<32;c++)
{ a+=buffer2[c];
a+=buffer3[c];
a+=buffer4[c];
a+=buffer5[c];
}
if(a==chk) //Checksum data correct
{
for (c=0;c<32;c++)
{
write_ext_eeprom(page+c, buffer2[c]);
write_ext_eeprom(page+c+32, buffer3[c]);
write_ext_eeprom(page+c+64, buffer4[c]);
write_ext_eeprom(page+c+96, buffer5[c]);
}
page+=128; //pages of buffers
rxchar=0; //Number of bytes of the frame
putc(ACK);
}
else
{
putc(NAK); //retransmit frame chksum error
}
}//chk.frame correct
else
putc(NAK); //retransmit frame header error
}
break;
case EOT:
putc(ACK);
rx=0;
break;
case CAN:
putc(ACK);
break;
}
}
|
any idea??? |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Thu Dec 09, 2010 1:11 pm |
|
|
Since you say that it works 'fine' for the first 8KB then ...
Off the top of my head, I'd say the function write_ext_eeprom is limited to 8KB, perhaps a 'page' worth of data.
Would have to look at it in detail to see though. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|