Shop OBEX P1 Docs P2 Docs Learn Events
How to Read and write Serial EEPROM from Quickstart board...?? — Parallax Forums

How to Read and write Serial EEPROM from Quickstart board...??

RITESH KAKKARRITESH KAKKAR Posts: 254
edited 2011-09-06 17:00 in Propeller 1
Hello everyone,

How to program EEPROM from quick start board, as there is Serial program software of QS board...??

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-09-06 07:03
    The QuickStart board's EEPROM is the same as the EEPROM on other Propeller boards like the Protoboard or the Demo Board. You use the same software to read or write data to the EEPROM. The simplest is the "Basic I2C Driver" from the Propeller Object Exchange. Read the comments in the source code for simple examples and an explanation of how it works.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2017-07-06 04:00
    Ritesh,

    In this post there is a link to a thread about reading and writing to EEPROM.

    In this post there is a nice program to read the contents of an EEPROM and send it to a terminal through a serial link with the computer.

    In the program just mentioned the following code reads from the EEPROM.
    Eeprom.ToRam(@buffer, @buffer + _BufferSize - 1, eepromIndex)
    

    To write instead of read use the method "FromRam."

    My guess is you want to program an EEPROM from information on your computer? If so, you'd need a program on the computer to send the information to the QS and then the QS could write the EEPROM.

    If the information you want to write to the EEPROM could alternatively be included in the QS program byte adding it in the DAT section. Another alternative is to use the file statement to include information in the program from a different file.

    It would be helpful if you were more specific in what you want to do.

    Duane
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-09-06 09:25
    Hi,

    First, thanks for reply....!!

    OK, i have my old STB ( Satellite Set of Box) is is not working,etc...
    and now i am willing to read the program stored in PROM i.e. Serial one i know the code stored are in Binary ( i.e. Hex)
    this is my aim.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-09-06 09:38
    You will need to find out more about this PROM. Is it really serial? What kind of serial? Does it use I2C or SPI protocol? What voltage levels? If it uses +5V, you will need some kind of interface. If it's a +5V I2C PROM, then you should look at the thread on interfacing +5V logic to the +3.3.V Propeller (the link is "How to safely interface a 5V signal to the Propeller" in this "sticky thread").

    The "Basic I2C Driver" can handle I2C memories attached to any pair of Propeller I/O pins.
  • RITESH KAKKARRITESH KAKKAR Posts: 254
    edited 2011-09-06 09:58
    OK, here is the data sheet of PROM.....
    Data sheet 1
    Data sheet 2
  • Mike GreenMike Green Posts: 23,101
    edited 2011-09-06 10:06
    The datasheet you showed is for the same kind of EEPROM used for program storage with the Propeller. You can operate it at 3.3V and, when operated that way, it is compatible with the Propeller's I/O pins. As you may notice in the datasheet, you have to have pull-up resistors on the SCL and SDA lines. 4.7K will do fine, but you can use higher or lower values as well. If you set the address select pins (A2-A0) to some non-zero value, you could connect your EEPROM in parallel with the existing program EEPROM on your Propeller board. You could also connect SCL and SDA to any other available pair of I/O pins and leave A2-A0 connected to ground. Read the source code comments in the Basic I2C Driver for an example of how to use the routines to read from an EEPROM.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-09-06 12:43
    Ritesh,

    Mike's Basic I2C Driver uses a constant for the EEPROM address. You'd need to change the address to correspond to the chip you want to communicate with. The datasheet shows how to determine the address (page 5 section 2.1, page 9 and others also have address information).

    I'm attaching a version of a I2C driver (different than Mike's) that takes the address of the chip as a parameter in the "init" method.

    I think you should be able to modify the "QsEepromDump" code (there is a link to it in my earlier post) to use this modified driver.

    Here's code to the beginning of the driver.
    CON
      ' 24LC256 EEPROM constants
      SDA = 29                                       ' P29 = data line
      SCL = 28                                       ' P28 = clock line
      ACK = 0                                        ' Acknowledge bit = 0
      NACK = 1                                       ' (No) acknowledge bit = 1
      _BaseI2cAddress = %10100000
    VAR
      byte currentEepromI2cAddress
     
    PUB Init(address)
      '' address are the three bits determined by the pins 1, 2 and 3 of the EEPROM.
      '' The normal program EEPROM has all three pins pulled low giving it an address of zero (%000).
      '' If pin 2 where pulled high the address would be %010 (2).  
      address <<= 1                                         ' scoot the address over one bit
      currentEepromI2cAddress :=  _BaseI2cAddress + address
    

    See the comments in "Init" about detirming the address of your EEPROM.

    You'll also want to change "SDA" and "SCL" if you're using different pins on the Propeller to communicate with the other chip.

    Duane

    Edit: I see Mike explained a lot of this while I was typing.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-09-06 12:54
    @Duane,
    Not quite true about the Basic I2C Driver. As explained in the source code comments, the upper 3 bits of the 19 bit EEPROM byte address that you supply to the various routines is used for the device select code. This allows you to use 128K EEPROMs and multiple 64K EEPROMs as contiguous memory up to 512K. The first 64K EEPROM has addresses from $00000 to $0FFFF (A=%000). The second 64K EEPROM (or the 2nd half of a 128K EEPROM) has addresses from $10000 to $1FFFF (A=%001) and so on.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-09-06 13:42
    @Mike,

    I haven't used your "Basic I2C Driver" before. I've used an 128K EEPROM. I think I understand what you're saying about addresses $10000 to $1FFFF.

    I added a second (64K) EEPROM to one of my Proto Boards. I broke the "A0" pin in my attempt to solder it to Vdd so I pulled "A1" high instead (all the other address pins are pulled low (A0 is pulled low internally)). So with your driver, I'd access this EEPROM with memory locations $20000 to $2FFFF?

    If I didn't understand, you can just say "reread the object", which I will then do and wait to ask more questions until after I've tried to understand it on my own.

    Duane
  • caskazcaskaz Posts: 957
    edited 2011-09-06 16:16
    Hi.

    About 24LC1025(128kb);
    24LC1025 address map
    B0 A1 A0 eeprom-address
     0  0  0 00000 - 0ffff      1st eeprom   Not use because there is prop eeprom
     1  0  0 10000 - 1ffff      1st eeprom
    
     0  0  1 20000 - 2ffff      2nd eeprom
     1  0  1 30000 - 3ffff      2nd eeprom
    
     0  1  0 40000 - 4ffff      3rd eeprom
     1  1  0 50000 - 5ffff      3rd eeprom
    
     0  1  1 60000 - 6ffff      4th eeprom
     1  1  1 70000 - 7ffff      4th eeprom
    
    A0 A1 -- Chip Select Bits
    B0    -- Block Select Bits
    
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-09-06 17:00
    caskaz,

    Yes, I recently learned (I think from you), the 24LC1025 uses a different bit (and unused pin) to indicate the upper EEPROM than the AT24C1024 chip. The 128KByte chip I've used was the AT24C1024.

    Duane
Sign In or Register to comment.