suggestion on how to implement duel /quad spi interface


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: suggestion on how to implement duel /quad spi interface

    did not know that shiftin out did more than 8 bit at a time , nice to know ,

    i ll take a look at the how it may be done with the MSSP , be nice feature to have running when i get the flash chips that have the duel/ quad interface .
    project on hand does not need it but future ones will

    the example code i have on hand that uses the MSSP is as follows , suggestions on how this maybe changed



    Code:
     
    ' --- Hardware SPI / SSP register variables ---------------------------
       SSPEN	Var	SSPCON1.5	' SSP enable
        WCOL	Var	SSPCON1.7	' SSP write collision
        BF		Var	SSPSTAT.0	' SSP buffer full
        SSPIF	Var	PIR1.3		' SSP interrupt flag
    
    
    SPI_init:
    
    	        SSPSTAT = %00000000	    ' Sample at middle of data output time, Mode 1, 1: Transmit on idle to active clock transition.
    		SSPCON1 = %00010000	    ' SPI master mode, clock = Fosc/64, Mode 1, 1: Clock idle high.
    		SSPEN = 1		            ' Enable hardware SPI port.
    
    return
    
    
    
    Readbyte:
    	       SDC_data_in = SSPBUF	            ' Clear the buffer.
    		SSPIF = 0		                    ' Clear the interrupt flag.
    		SSPBUF = $ff		                ' Shift out a dummy byte.
    		While !SSPIF		                ' Wait for receive byte.
    		Wend
    		SDC_data_in = SSPBUF	            ' Get the byte.
    
    return
    
    writebyte:
    
    	        SDC_data_in = SSPBUF	        ' Clear the buffer.
    		SSPIF = 0	         	        ' Clear the interrupt flag.
    		SSPBUF = SDC_data_out	' Send the byte.
    		If (WCOL) Then Return	        ' Check for write collision.
    		While !SSPIF		        ' Wait for send to complete.
    		Wend
    return

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,627


    Did you find this post helpful? Yes | No

    Default Re: suggestion on how to implement duel /quad spi interface

    Hi Sheldon,
    I'm not sure but I think there might be some confusion going on here.
    Neither SHIFTIN/SHIFTOUT nor the MSSP module will be able to handle dual or quad SPI interface - period.
    If you're going to do it you'll have to bitbang it yourself which, again, is probably slower than doing it "normaly" with the MSSP module.

    The thing with dual and quad SPI is that it's getting closer to a parallell bus. With dual SPI there are two datalines and with quad SPI there are four (instead of one) that get sampled on the active edge of the clock. SHIFTIN/SHIFTOUT doesn't support it and the MSSP module only have one data line input so it's impossible.

    /Henrik.

Similar Threads

  1. 4-20mA using SPI Interface
    By gavo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th April 2013, 19:51
  2. LTC2400 SPI interface
    By designer salwar in forum mel PIC BASIC
    Replies: 1
    Last Post: - 2nd March 2011, 21:50
  3. SPI interface
    By malc-c in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 9th January 2011, 01:06
  4. LTC2400 SPI interface
    By PUGALENTHI.P in forum mel PIC BASIC
    Replies: 26
    Last Post: - 23rd July 2010, 15:57
  5. Using PBPro for SPI Interface
    By twincitian in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 22nd March 2007, 07:57

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