Fast External Memory


Closed Thread
Results 1 to 36 of 36

Hybrid View

  1. #1
    Join Date
    Feb 2010
    Location
    USA, New England
    Posts
    164


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by hankshone View Post
    Thanks Paul for your shared codes!!! It is great.
    I did the same test, but used PIC16LF877(3.0V) and FM25V10(3.0V,1Mbit). I think the communication is the same, only with some minor modifications. I spent almost one day on it,still get no result yet.... Can you help me to check if there is anything wrong with it?
    Thanks!
    One Mbit? Now I have chip envy.

    It looks like you need to add "FM_CS=1" right before the line "IF Disp = 1 THEN". The F-RAM never gets un-selected after the read.

    It couldn't be that simple, could it? If that's not it please provide detail about what it is and is not doing correctly. If all else fails make sure it works using SHIFTIN and SHIFTOUT. If that fails as well use an o-scope to confirm ALL of the pins on the F-RAM are in their proper states.

    Best Regards,
    Paul

  2. #2
    Join Date
    May 2009
    Posts
    21


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by prstein View Post
    One Mbit? Now I have chip envy.

    It looks like you need to add "FM_CS=1" right before the line "IF Disp = 1 THEN". The F-RAM never gets un-selected after the read.

    It couldn't be that simple, could it? If that's not it please provide detail about what it is and is not doing correctly. If all else fails make sure it works using SHIFTIN and SHIFTOUT. If that fails as well use an o-scope to confirm ALL of the pins on the F-RAM are in their proper states.

    Best Regards,
    Paul
    Thanks Paul:-)
    Really it is not quite easy. Last time it took me several days to find out the problem with SHIFTIN SHIFTOUT. I am sure the chip is working with those commands. But you know it is too slow... That's why I am switching to use the the hardware SPI to make it faster...
    I will test it see what I can get..

  3. #3
    Join Date
    May 2009
    Posts
    21


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by prstein View Post
    One Mbit? Now I have chip envy.

    It looks like you need to add "FM_CS=1" right before the line "IF Disp = 1 THEN". The F-RAM never gets un-selected after the read.

    It couldn't be that simple, could it? If that's not it please provide detail about what it is and is not doing correctly. If all else fails make sure it works using SHIFTIN and SHIFTOUT. If that fails as well use an o-scope to confirm ALL of the pins on the F-RAM are in their proper states.

    Best Regards,
    Paul
    Still with no results... The reads I get for the four variables are all zeros. I mean X1 to X4.It seems like there are response from SDO. But never get anything in SDI from the os-scope. It is weird...

  4. #4
    Join Date
    Jul 2003
    Location
    USA - Arizona
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    This may help for HW SPI (From 877A datasheet):
    "Any write to the SSPBUF register during transmission/reception of data will be ignored and the write collision detect bit, WCOL (SSPCON<7>), will be set. User software must clear the WCOL bit so that it can be determined if the following write(s) to the SSPBUF register completed successfully."

    The following:
    WriteSPI (read-modify-write):
    WCOL=0
    Rx_buff=SSPBUF ' CLEAR THE BUFFER
    SSPIF=0 ' CLEAR THE INTERRUP FLAG
    SSPBUF=tx_buff ' SEND THE BYTE
    IF(wcol) THEN RETURN
    WHILE(!SSPIF)
    WEND
    SSPIF=0;
    RETURN

    ReadSPI:
    rx_buff=SSPBUF ' Clear the buffer
    SSPIF=0 ' Clear the interrup flag
    SSPBUF=0 ' Shift out a dummy byte What is this?
    while(!sspif) ' wait for receive byte
    wend
    rx_buff=SSPBUF ' Get the byte
    return
    Can be changed to this:
    WriteSPI (write-receive-read):
    SSPIF=0 ' CLEAR THE INTERRUP FLAG
    WCOL=0 ' CLEAR COLLISION BIT BEFORE WRITING TO SPI
    SSPBUF=tx_buff ' SEND THE BYTE
    WHILE(!SSPIF) ' WAIT FOR 8-BITS TO BE CLOCKED-OUT/CLOCKED-IN - THIS HAPPENS SIMULTANEOUSLY
    WEND
    Rx_buff=SSPBUF ' STORE RECEIVED DATA
    SSPIF=0 ' CLEAR THE INTERRUP FLAG
    RETURN

    ReadSPI:
    SSPIF=0 ' CLEAR THE INTERRUP FLAG
    WCOL=0 ' CLEAR COLLISION BIT BEFORE WRITING TO SPI
    SSPBUF=0 ' SEND/CLOCK-OUT DUMMY BYTE TO CLOCK-IN RECEIVED BYTE
    WHILE(!SSPIF) ' WAIT FOR 8-BITS TO BE CLOCKED-OUT/CLOCKED-IN - THIS HAPPENS SIMULTANEOUSLY
    WEND
    Rx_buff=SSPBUF ' STORE RECEIVED DATA
    SSPIF=0 ' CLEAR THE INTERRUP FLAG
    return

Similar Threads

  1. External memory routines?
    By John_Mac in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th April 2009, 02:13
  2. external Memory
    By jerryf in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 29th November 2008, 02:06
  3. PBP/PBPL and external memory
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 11th November 2007, 05:31
  4. PBP External Memory Bus Support
    By ALFRED in forum mel PIC BASIC
    Replies: 4
    Last Post: - 25th December 2006, 08:42
  5. external memory
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 15th April 2006, 00:51

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts