News:

Let's find out together what makes a PIC Tick!

Main Menu

ISSI PSRAM and dSPic

Started by Wimax, Sep 01, 2022, 10:09 PM

Previous topic - Next topic

Wimax

Hello !

Have any of you used or are using IS66WVS1M8BLL-104NLI PSRAM memory from ISSI ?
That's an interesting high speed SPI/QDI 8Mx8 bit RAM, but the datasheet is not very clear in some parts.

Wimax

Hello Everybody,

Tried it and it runs like a charm! The only "pain" is page management, which, for example, on the 23LC1024 can be avoided using the sequential mode.
Otherwise it is a beauty: 3.3 V power supply, 1 MB in a slim package, fast access, and low cost.

top204

Well done. It is always a satisfaction when something works by learning and doing. :-)

I would be very useful for you to share your code listings with the users of the forum, so they can use the device in a program. I will then place it in the forum's Wiki, and with your permission, on the Positron web site.

Wimax

#3
Hi Les ! ;D

I hope I did not make any mistakes because I extracted the code from a larger programme and adapted it.
The code uses the SPI_24.inc library, but it is not strictly necessary, it reads the chip's status register and transmits the data to the serial. Immediately afterwards it accesses the chip again and writes the value '100' into the RAM in blocks of 1024 bytes.
At the end it starts a read cycle, storing the pages in an array.

The code is very simple, but can be useful to familiarise with the chip.
This IC allowed me to greatly simplify the hardware because I had already developed some code using the Microchip 23LC1024, but to get 1 MB I would have had to use eight devices and a multiplexer.
On the other hand, the 23LC1024 has automatic address incrementing throughout the RAM and this is a very useful and fast function if you have to write or read repetitively, for instance within an interrupt routine.
In addition, the 23LC1024 is available in a PDIP package, which is very useful for breadboard tests; the ISSI comes in SOIC-8 and is considerably less manageable, I had to develop a small dedicated PCB to use it.


'****************************************************************
'*  Name    : ISS_RAM_TEST.BAS                                  *
'*  Author  : [Max]                                             *
'*  Notice  :                                                   *
'*          : All Rights Reserved                               *
'*  Date    : 29/10/2022                                        *
'*  Version : 1.0                                               *
'*  Notes   :                                                   *
'*          :                                                   *
'****************************************************************

' Test code for IS66WVS1M8BLL-104NLI PSRAM 1MB SPI RAM

Device= 24FJ64GA002

Declare Xtal= 29.48

CLKDIV = 0 ' CPU peripheral clock ratio set to 1:1
OSCCON.Byte1 = %00010000 ' Enable 4 x PLL '

' For external oscillator with PLL

Config Config1 = JTAGEN_OFF, GCP_OFF, GWRP_OFF, BKBUG_OFF,_
COE_OFF, ICS_PGx1, FWDTEN_OFF, WINDIS_OFF,_
FWPSA_PR128, WDTPOST_PS256
Config Config2 = IOL1WAY_OFF, IESO_OFF, FNOSC_PRIPLL,_
FCKSM_CSDCMD,OSCIOFNC_OFF, POSCMOD_HS


' Set COM Port
Declare Hserial_Baud = 38400 ' USART1 Baud rate
Declare HRSOut1_Pin = PORTB.8 ' Pin to be used for TX with USART1
Declare HRSIn1_Pin = PORTB.9  ' Pin To be used For RX with USART1

PPS_Output(cOut_Pin_RP8, cOut_Fn_U1TX) ' Map UART1 TX pin to RP8
PPS_Input(cIn_Pin_RP9, cIn_Fn_U1RX) ' Map UART1 RX pin to RPI9

$define CS_RAM PORTA.1
Include "SPI_24.inc" 

Dim FL As Byte           ' Stores 1 byte from RAM
Dim Mr[1024] As Byte     ' Stores 1024 bytes from a RAM page
Dim k As Dword ' Stores RAM Address in decimal format
Dim adr As Dword ' RAM address
Dim n As Word ' Index

' Init HW_SPI

SPI_Init()

'' IS66WVS1M8BLL-104NLI default operating mode is 1024 byte pages burst mode
'' use this code to toggle to 32 byte pages burst mode 


'Low CS_RAM   
'SPI1_Write(0xc0)
'High CS_RAM 



' Assume default 1024 Byte pages burst mode

' This part only for RAM Diagnostic
     HRSOutLn "Read status register"
     adr=0
     Low CS_RAM
     SPI1_Write(0x9f)   ' Status register
     SPI1_Write(adr.Byte2)
     SPI1_Write(adr.Byte1)
     SPI1_Write(adr.Byte0)

     For n=1 To 8
     FL=SPI1_Read()
     HRSOutLn Hex FL   ' Writes RAM Chip info's
     Next
     High CS_RAM
     HRSOutLn "Done"
     DelayUS 100
 ' End       


' Writes all RAM using 1024 bytes long pages

For k=0 To 1048575 Step 1024  ' Initial addresses 

     Low CS_RAM   ' Device selection
     
         SPI1_Write(0x02)  ' Write command
         SPI1_Write (k.Byte2) ' Address byte2
         SPI1_Write (k.Byte1) ' Address byte1
         SPI1_Write (k.Byte0) ' Address byte0
         
          For n=0 To 1023  ' Scan the page
            SPI1_Write(100)     ' Writes 100
          Next
         
     High CS_RAM   ' Latch & Close
 
 Next
 

DelayUS 100


For k=0 To 1048575 Step 1024    ' Reads all RAM within 1024 bytes long pages
               
    Low CS_RAM     ' Device selection
   
        SPI1_Write(0x03)  ' Read command
        SPI1_Write(k.Byte2)  ' Address byte2
        SPI1_Write(k.Byte1)  ' Address byte1
        SPI1_Write(k.Byte0)  ' Address byte0
       
            For n=0 To 1023
                Mr[n]=SPI1_Read()   ' Mr[] stores 1024 bytes
            Next
            ' Here Mr[] holds a 1024 byte page
           
    High CS_RAM  ' Latch & Close


Next


End

Proc SPI_Init()
 
SPI1_Open(cSPI_MODE0 & cSEC_PRE_2_1 & cPRI_PRE_1_1, cSPI_ON & cSPI_IDLE_ON & cSPI_RX_OVFLOW_CLR & cSPI_MODE8 & cFIFO_BUFFER_DISABLE & cSCK_PIN_ON & cSDO_PIN_ON & cSPI_SMP_ON & cSPI_CKE_ON & cCLK_ACTIVE_HIGH & cSPI_MASTER_ON)
   

    PPS_Input(cIn_Pin_RP12, cIn_Fn_SDI1)               ' SDI1 Data Input Connected to RB12
    PPS_Output(cOut_Pin_RP6, cOut_Fn_SCK1OUT)          ' SPI1 Clock Output Connected to RB6
    PPS_Output(cOut_Pin_RP14, cOut_Fn_SDO1)             'SPI1 Data Output Connected to RB14


EndProc