Shop OBEX P1 Docs P2 Docs Learn Events
EEPROM shiftout issues — Parallax Forums

EEPROM shiftout issues

achilles03achilles03 Posts: 247
edited 2005-02-11 03:41 in BASIC Stamp
I'm getting some goofy errors with writing data to an 8kbyte SPI eeprom. I've used it for other projects (page writes of 4 bytes), and it recorded data fine. But for one program, it appears to be recording the data incorrectly. The known values it SHOULD be recording are not correct, although some of the values are correct. My question is this: is this shiftout too many variables for the BS2 to shiftout correctly? Is there any limitations to the SHIFTOUT length? Or could it be something on the EEPROM's side? I had tried splitting it up into 2 writes, but got much the same result. Maybe 3 or 4 separate writes? Should I try another chip?

Any insight is appreciated!
Dave

READ 13, cycles.highbyte
READ 14, cycles.lowbyte
low CS
shiftout SIDATALINE,CLOCKPIN,msbfirst,[noparse][[/noparse]WREN\8]
high CS
low CS
shiftout SIDATALINE,CLOCKPIN,msbfirst,[noparse]/noparse]EDATAWRITE\8, cycles\16, temp\8, GPSD3(3)\8, GPSD1(0)\8, GPSD1(1)\8, GPSD1(2)\8, GPSD1(3)\8, GPSD2(0)\8, GPSD2(1)\8, GPSD2(2)\8, GPSD2(3)\8, alt\16
high CS
cycles=cycles+12

[noparse][[/noparse]and later on in the program...]

low CS
shiftout SIDATALINE,CLOCKPIN,msbfirst,[noparse][[/noparse]WREN\8]
high CS
low CS
shiftout SIDATALINE,CLOCKPIN,msbfirst,[noparse][[/noparse]EDATAWRITE\8, cycles\16, GPSD1(1)\8, GPSD1(0)\8, GPSD2(1)\8]
high CS
cycles=cycles+3
WRITE 13, cycles.highbyte
WRITE 14, cycles.lowbyte

Comments

  • achilles03achilles03 Posts: 247
    edited 2005-02-11 03:41
    Ha, nevermind, I figured it out.· The eeprom datasheet says this:

    "Up to 32 bytes of data can be sent to the 25XX640 before a write cycle is necessary.· The only restriction is that all of the bytes must reside in the same page.· A page address begins with XXX0 0000 counter and ends with XXX1 1111."

    I didn't pay attention to those last two sentences before.··It explains why some values were correct, while other ones weren't.· The incorrect values was data from previously·writes, which was not written over because some of the values in·the long·shiftout command didn't reside on the same page.

    Also, the reason this never popped up before is because all my other page writes of 4 bytes never occured accross pages, as 32 is a multiple of 4.

    Just FYI,
    Dave
Sign In or Register to comment.