How to configure SPI Flash? (in TLSPIFlash)


(Hyungyun Moon) #1

Hello,

I’m working on Freedom E300 Platform with arty-7 board.

Originally, SPI Flash operates by reading a byte with address + 1.

For eaxmple, read 0x87 at 0x20400000 addr, read 0xa9 at 0x20400001, read 0x19 at 0x20400002 …

I want to operate by reading 256 bytes with address + 0x100(+256).

If can not, reading 4 bytes with address +4 is fine too!!

Then How to configure the TLSPIFlash.scala??

SPIFlashParameter is shown as below.

trait SPIFlashParamsBase extends SPIParamsBase {
val fAddress: BigInt
val fSize: BigInt

val insnAddrBytes: Int
val insnPadLenBits: Int
lazy val insnCmdBits = frameBits
lazy val insnAddrBits = insnAddrBytes * frameBits
lazy val insnAddrLenBits = log2Floor(insnAddrBytes) + 1
}

case class SPIFlashParams(
rAddress: BigInt,
fAddress: BigInt,
rSize: BigInt = 0x1000,
fSize: BigInt = 0x20000000,
rxDepth: Int = 8,
txDepth: Int = 8,
csWidth: Int = 1,
delayBits: Int = 8,
divisorBits: Int = 12,
fineDelayBits: Int = 0,
sampleDelayBits: Int = 5,
defaultSampleDel: Int = 3
)
extends SPIFlashParamsBase {
val frameBits = 8
val insnAddrBytes = 4
val insnPadLenBits = 4

require(insnPadLenBits <= delayBits)
require((fineDelayBits == 0) | (fineDelayBits == 5), s"Require fine delay bits to be 0 or 5 and not $fineDelayBits")
require(sampleDelayBits >= 0)
require(defaultSampleDel >= 0)
}

Thank you for reading my questions.