BasicMicro - Forums

www.basicmicro.com
It is currently Sun Sep 05, 2010 10:51 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: 25lc1024 eeprom
PostPosted: Sun Jul 18, 2010 10:28 am 
Offline
Guru

Joined: Sun Oct 05, 2008 9:40 am
Posts: 81
I would like to change a 25lc256 eeprom to a 25lc1024.

The only differance I can see is that the 1024 has a 24bit address with 7 msb dont care.

Any suggestions on how to implement an address pointer?


Top
 Profile E-mail  
 
 Post subject: Re: 25lc1024 eeprom
PostPosted: Sun Jul 18, 2010 3:32 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 692
Location: CA bay Area
The 25256 used
Code:
shiftout SI,SCK,MSBPRE,[address\16] ; sends address location for write

to write a 16-bit address to it.

You need 24-bits, so try
Code:
shiftout SI,SCK,MSBPRE,[address\24] ; sends address location for write

Just make the 7 MSB all zeros. You will have to define "address" as a 32-bit "Long" variable.

There is a forum post that contains the demo code for using an AT25256A EEPROM at
http://forums.basicmicro.net/atomnano-f485/app-note-using-a-32kx8-spi-eeprom-with-atoms-and-nanos-t9163.html
Try using the code in the attached PDF as a guide.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile E-mail  
 
 Post subject: Re: 25lc1024 eeprom
PostPosted: Mon Jul 19, 2010 3:39 pm 
Offline
Guru

Joined: Sun Oct 05, 2008 9:40 am
Posts: 81
Code:
shiftout SI,SCK,MSBPRE,[address\24] ; sends address location for write


Could not get this to work. Set address to long. When I looked at what was being sent I was getting the bytes in the wrong order.

Address variable MSB on left LSB to the right correct?

------------------------------------Address long var---------------------------------

Address.highbyte.highword _ Address.lowbyte.highword _ Address.highbyte.lowword _ Address.lowbyte.lowword

When I used shiftout.....[address\24] I got

Address.highbyte.highword _ Address.lowbyte.highword _ Address.highbyte.lowword

at eeproms si pin

I looked at using highbyte lowbyte ect.. to send the right bytes

Code:
address_temp = address.highword
address_temp2 = address_temp.lowbyte

address_temp = address.lowword

shiftout.....[address_temp2\8, address_temp\16]


I have not gone to far on this route. It seems like alot of variables are needed. It would be nice to do something like

address_temp = address.highword.lowbyte but I don't thik its possable.

My next aproach was to use 3 bytes and if\then to increment the bytes

So changing your example to this

Code:
   shiftout SI,SCK,MSBPRE,[0x03\8,cntr\8, cntr1\8, cntr2\8]        'Sends write command along with 24bit address


And adding this
''-------------------------Increments eeprom address by the constant increment--------------------------

Code:
if cntr2 = 255 then

     if cntr1 = 255 then
       cntr = cntr + increment
       cntr1 = 0
   
      else
       cntr1 = cntr1 + increment
       cntr2 = 0
   
   endif

  else
   cntr2 = cntr2 + increment

endif


And change this to write to the whole eeprom

Code:
IF cntr = 1 and cntr1 = 255 then _whoa ; reached last EEPROM cell?


This works. The way I visualize it is the eeprom is a book. 2 chapters, 512 pages and 256 lines per page.

cntr = chapters (7msb don't care last bit will be a 1 0r 0) chapter 0 pages 0 - 255 or chapter 1 pages 256 - 512
cntr1 = pages (0 to 255 per chapter)
cntr2 = lines (0 to 255 per page)

Have to make sure not to cross page as data will wrap around to line 0 of same page

On a side note I connected the eeprom so that SO and SI share a pin
Attachment:
eeprom.png
eeprom.png [ 8.66 KiB | Viewed 130 times ]


I have tried this using 5 different Nano pins for SO\SI

P3 - eeprom works
P4 - eeprom works
P5 - eeprom works
P8 - eeprom does not work
P9 - eeprom does not work


Top
 Profile E-mail  
 
 Post subject: Re: 25lc1024 eeprom
PostPosted: Mon Jul 19, 2010 3:53 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 692
Location: CA bay Area
Using "Help" from the Studio menu, open the users' manual. Go to page 133. This covers "ShiftIn". It shows a chart with settings that allow the user to change the edge on which the data is latched, and the order of bits sent, ie, LSB or MSB. You figured it out, but this chart may help you figure out how to redefine the command next time you get a device that doesn't agree with a demo code, thus saving you all this hoopla in the future.
Nice job, BTW. We should have you do an app note for this part! :D
Later.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile E-mail  
 
 Post subject: Re: 25lc1024 eeprom
PostPosted: Tue Jul 20, 2010 8:51 am 
Offline
Site Admin

Joined: Thu Mar 01, 2001 11:00 am
Posts: 317
Location: Temecula, CA
Just a suggestion but you can access the bytes of a long like this:

address.byte3,address.byte2,address.byte1,address.byte0

So since you needed 24bits of an address you coul dhave just sent

address.byte2,address.byte1,address.byte0

in your shiftout command and just incremented it by address = address + 1

The variable modifiers are:

bit#
lowbit
highbit
nib#
lownib
highnib
byte#
lowbyte
highbyte
word#
lowword
highword

Where # is an appropriate number(eg 0 to 3 for bytes of a long variable)

_________________
Nathan Scherdin
Visit BasicMicro

Datasheets:
Servo Controller - ARC32
Microcontroller - AtomPro
Motor Controller - Robo Claw
RC Lighting - Cylon LED


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO