zl程序教程

您现在的位置是:首页 >  其它

当前栏目

SPI-Flash页写实验

实验 Flash SPI
2023-09-14 09:10:03 时间

SPI-Flash页写实验

在这里插入图片描述

`timescale 1ns / 1ps
module flash_pp_ctrl(
        input wire sys_clk,//系统时钟,频率50MHZ 
        input wire sys_rst_n,//复位信号,低电平有效 
        input wire key,//按键输入信号 
        
        output reg cs_n,//片选信号 
        output reg sck,//串行时钟  
        output reg mosi //主输出从输入数据 
    );
 
parameter IDLE    = 4'b0001,//初始状态 
           WR_EN   = 4'b0010,//写状态 
           DELAY   = 4'b0100,//等待状态 
           PP      = 4'b1000;//页写状态 
parameter WR_EN_INST = 8'b0000_0110,//写使能指令 
           PP_INST    = 8'b0000_0010;//页写指令 
parameter SECTOR_ADDR = 8'b0000_0000,//扇区地址 
           PAGE_ADDR   = 8'b0000_0100,