OpenCores
URL https://opencores.org/ocsvn/spiflashcontroller/spiflashcontroller/trunk

Subversion Repositories spiflashcontroller

[/] [spiflashcontroller/] [trunk/] [doc/] [spi-registers.txt] - Diff between revs 2 and 4

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 4
Line 5... Line 5...
DIY calculator address space:
DIY calculator address space:
  $F038 : Tx data register (write)
  $F038 : Tx data register (write)
  $F018 : Rx data register (read)
  $F018 : Rx data register (read)
  $F039 : command register (write)
  $F039 : command register (write)
  $F019 : status register  (read)
  $F019 : status register  (read)
  $F03A : address mid register (write)
  $F03A : address low register (write)
  $F03B : address low register (write)
  $F03B : address mid register (write)
 
  $F03B : address high register (write)
 
 
The high address byte is fixed to $0F, denoting the last segment within
The high address byte is fixed to $0F, denoting the last segment within
the flash (8MBit type assumed).
the flash (8MBit type assumed).
 
 
 
 
These are the bits of the status register:
These are the bits of the status register:
  busy:     $01
  busy:     $01
  tx empty: $02
  tx empty: $02
  rx ready: $04
  rx ready: $04
 
  wait for data: $08
Other bits read as '0'.
Other bits read as '0'.
 
 
 
 
How to communicate with the SPI flash:
How to communicate with the SPI flash:
--------------------------------------
--------------------------------------
Line 104... Line 106...
           JZ      [WAIT]
           JZ      [WAIT]
; read the response
; read the response
           LDA     [SPI_RX]
           LDA     [SPI_RX]
 
 
3) issue the "Sector Erase" command:
3) issue the "Sector Erase" command:
           LDA     0
; symbolic constant
 
SECTOR     .EQU    $0F       ; sector number
 
             .
 
             .
 
             .
 
           LDA     SECTOR
           STA     [SPI_AHI]
           STA     [SPI_AHI]
 
           LDA     0
 
           STA     [SPI_AMID]
           STA     [SPI_ALO]
           STA     [SPI_ALO]
           LDA     SPI_SE
           LDA     SPI_SE
           STA     [SPI_CMD]
           STA     [SPI_CMD]
 
 
4) issue the "Read Data" command:
4) issue the "Read Data" command:
Line 128... Line 137...
             .
             .
 
 
; code:
; code:
           BLDX    BUFSIZE
           BLDX    BUFSIZE
           BSTX    [MAXBYTES]
           BSTX    [MAXBYTES]
           LDA     BUF
           LDA     SECTOR
           STA     [SPI_AHI]
           STA     [SPI_AHI]
 
           LDA     BUF
 
           STA     [SPI_AMID]
           LDA     BUF+1
           LDA     BUF+1
           STA     [SPI_ALO]
           STA     [SPI_ALO]
           LDA     SPI_RD
           LDA     SPI_RD
           STA     [SPI_CMD]
           STA     [SPI_CMD]
           BLDX    0
           BLDX    0
Line 163... Line 174...
 
 
Remarks:
Remarks:
--------
--------
The flash utilizes a 3 byte address (using 20 bits for the 8Mbit
The flash utilizes a 3 byte address (using 20 bits for the 8Mbit
M25P80 chip). The highest byte specifies the sector on which the PP, SE,
M25P80 chip). The highest byte specifies the sector on which the PP, SE,
RD, F_RD commands operate. Currently we use only the topmost sector
RD, F_RD commands operate. In the DIY Calculator we use only the topmost
(no. 0x0F). This is no restriction in size of memory since one sector
sector (no. 0x0F).
is 64KB in size. But it saves the additional high byte address register.
 
The high byte (0x0F) is hardwired inside the SPI Flash controller.
 
 
 
The PP, RD, and F_RD commands are special in that that the number of bytes
The PP, RD, and F_RD commands are special in that that the number of bytes
to be transferred is not known in advance. Therefore the dummy "NOP" command
to be transferred is not known in advance. Therefore the dummy "NOP" command
must be issued to the SPI Flash controller after all bytes are transferred
must be issued to the SPI Flash controller after all bytes are transferred
to terminate the active command and return the SPI Flash controller to its
to terminate the active command and return the SPI Flash controller to its

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.