Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
18 years ago

Cyclone development board and its P30 Flash

Dear Sir/Madam

I am trying to program the Intel's Flash P30 using my FPGA. Could you please help me out, as i am having not luck. What i would like to do is store 16-bit binary word at certain locations. I am using VHDL, and my FPGA is using 1 Mhz, so that timming is not really a issue. So in the first clock cycle i assert the following signal as show below.

we<='0';

ce <= '0';

rs <= '1';

oe<='1';

adv <= '0';

and then in the next clock cycle

we<='1';

ce<='1';

A <=(others=>'1');--- address

DQ<="0000000000001010";--bit stream

This is what i understood from the datasheet, this should add my 16-bit stream in the location.

And to read what i have input i would assert the following signal

ce <= '0';

oe <= '0';

we<='1';

adv<='0';

Please do get back, as i am slighly stranded in my university project.

My vhdl code is below, and inorder to check that some data is stored i try to read the data and assign the last 4 bits to the LED on the board, but as the data is bi directional it seems to be show the correct LED lightling up, but if i was to removing the part of the code that writes data and only run the part which reads from that location now led's light up.

Please do get back, as i am slighly stranded in my university project and my Uni dont no much about such devices.

IBRARY ieee;

USE ieee.std_logic_1164.all;

USE ieee.std_logic_arith.all;

ENTITY PT IS

PORT(

CLK_H : IN std_logic;

RS_H : IN std_logic;

A : OUT std_logic_vector (24 DOWNTO 0);

B : OUT std_logic_vector (3 DOWNTO 0);

adv : OUT std_logic;

ce : OUT std_logic;

clk : OUT std_logic;

oe : OUT std_logic;

rs : OUT std_logic;

we : OUT std_logic;

wt : OUT std_logic;

DQ : INOUT std_logic_vector (15 DOWNTO 0)

);

-- Declarations

END PT ;

-- hds interface_end

--

LIBRARY ieee;

USE ieee.std_logic_1164.all;

USE ieee.std_logic_arith.all;

ARCHITECTURE fsm OF PT IS

-- Architecture Declarations

TYPE STATE_TYPE IS (

s0,

s2,

s3,

s4,

s6,

s1

);

-- State vector declaration

ATTRIBUTE state_vector : string;

ATTRIBUTE state_vector OF fsm : ARCHITECTURE IS "current_state" ;

-- Declare current and next state signals

SIGNAL current_state : STATE_TYPE ;

SIGNAL next_state : STATE_TYPE ;

BEGIN

----------------------------------------------------------------------------

clocked : PROCESS(

CLK_H,

RS_H

)

----------------------------------------------------------------------------

BEGIN

IF (RS_H = '1') THEN

current_state <= s0;

-- Reset Values

ELSIF (CLK_H'EVENT AND CLK_H = '1') THEN

current_state <= next_state;

-- Default Assignment To Internals

END IF;

END PROCESS clocked;

----------------------------------------------------------------------------

nextstate : PROCESS (

current_state

)

BEGIN

CASE current_state IS

WHEN s0 =>

next_state <= s2;

WHEN s2 =>

next_state <= s3;

WHEN s3 =>

next_state <= s1;

WHEN s4 =>

next_state <= s6;

WHEN s6 =>

next_state <= s6;

WHEN s1 =>

next_state <= s4;

WHEN OTHERS =>

next_state <= s0;

END CASE;

END PROCESS nextstate;

----------------------------------------------------------------------------

output : PROCESS (

DQ,

current_state

)

BEGIN

-- Default Assignment

-- Default Assignment To Internals

-- State Actions

CASE current_state IS

WHEN s0 =>

-- A <=(others=>'1');

--DQ<="0000000000000000";

WHEN s2 =>

we<='0';

ce <= '0';

rs <= '1';

oe<='1';

adv <= '0';

WHEN s3 =>

we<='1';

ce<='1';

A <=(others=>'1');

DQ<="0000000000001010";

WHEN s4 =>

ce <= '0';

oe <= '0';

we<='1';

adv<='0';

WHEN s6 =>

B <= DQ(3 downto 0);

WHEN OTHERS =>

NULL;

END CASE;

END PROCESS output;

-- Concurrent Statements

clk<=clk_H;

END fsm;

Thanking you in advance

Yours Sincerely

Dharmesh Joshi

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Joshi,

    Can you go in and edit your intitial post and remove all the extra spaces?

    THanks,

    Avatar
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    1/ As I remember, you don't need to toggle CE & WE at the same time.

    2/ We did NOR flash Emulator for Spansion, STM, SST, Winbond, MXIC.

    All of them need to do following sequence if you're trying to write correctly:

    Reset -> Erase -> Program -> Check Ready Pin -> Verify(Read)

    Which means I have to following sequence

    (VHDL code just for telling you the seq, not really working)

    When Reset0=> D(7 downto 0)<="11110000"; CE<='0'; WE<='0'; --F0

    When Reset1=> WE<='1';

    When Erase=> -- depends on where and which kind of Erase you want, sequence is like program

    When Program0=> D(7 downto 0)<= "10101010";

    [/INDENT]A(10 downto 0)<="10101010101"; WE<='0'; --555/AA

    When Program1=> WE<='1';

    When Program2=> D(7 downto 0)<= "01010101";

    [/INDENT]A(10 downto 0)<="01010101010"; WE<='0'; --2AA/55

    When Program3=> WE<='1';

    When Program4=> D(7 downto 0)<= "10100000";

    [/INDENT]A(10 downto 0)<="10101010101"; WE<='0'; --555/A0

    When Program5=> WE<='1';

    When Program6=> D<="your data"; A<="your address"; WE<='0';

    When Program7=> WE<='1';

    -- Then, do Ready/Busy pin check

    -- And now you can read it

    I believe Intel's Strata Flash do so.

    Our Related Emulator: http://www.samedisk.com/en/forum/viewforum.php?f=5 (http://www.samedisk.com/en/forum/viewforum.php?f=5)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Dear Sir

    Thank you for your reply.

    I have made changed to my VHDL code but found that it does not improve what i am trying to do. If possible could you further guide, please do note, that i havent erased the flash as my code for my other design is also on that design and iam using the last memory address to save my 16-bit word. I am also using the same clock that drives the state machine for the flash. Please do not that the all signals on the flash are asserted low. My VHDL code is below:LIBRARY ieee;

    USE ieee.std_logic_1164.all;

    USE ieee.std_logic_arith.all;

    ENTITY PT IS

    PORT(

    CLK_H : IN std_logic;

    RS_H : IN std_logic;

    A : OUT std_logic_vector (24 DOWNTO 0);

    B : OUT std_logic_vector (3 DOWNTO 0);

    adv : OUT std_logic;

    ce : OUT std_logic;

    clk : OUT std_logic;

    oe : OUT std_logic;

    rs : OUT std_logic;

    we : OUT std_logic;

    wt : OUT std_logic;

    DQ : INOUT std_logic_vector (15 DOWNTO 0)

    );

    END PT ;

    LIBRARY ieee;

    USE ieee.std_logic_1164.all;

    USE ieee.std_logic_arith.all;

    ARCHITECTURE fsm OF PT IS

    -- Architecture Declarations

    TYPE STATE_TYPE IS (

    s0,

    s3,

    s4,

    s6,

    s1,

    s5,

    s7,

    s2,

    s8

    );

    ATTRIBUTE state_vector : string;

    ATTRIBUTE state_vector OF fsm : ARCHITECTURE IS "current_state" ;

    SIGNAL current_state : STATE_TYPE ;

    SIGNAL next_state : STATE_TYPE ;

    BEGIN

    clocked : PROCESS(

    CLK_H,

    RS_H

    )

    BEGIN

    IF (RS_H = '0') THEN

    current_state <= s0;

    -- Reset Values

    ELSIF (CLK_H'EVENT AND CLK_H = '1') THEN

    current_state <= next_state;

    END IF;

    END PROCESS clocked;

    nextstate : PROCESS (

    current_state

    )

    BEGIN

    CASE current_state IS

    WHEN s0 =>

    next_state <= s8;

    WHEN s3 =>

    next_state <= s1;

    WHEN s4 =>

    next_state <= s6;

    WHEN s6 =>

    next_state <= s6;

    WHEN s1 =>

    next_state <= s7;

    WHEN s5 =>

    next_state <= s3;

    WHEN s7 =>

    next_state <= s2;

    WHEN s2 =>

    next_state <= s4;

    WHEN s8 =>

    next_state <= s5;

    WHEN OTHERS =>

    next_state <= s0;

    END CASE;

    END PROCESS nextstate;

    output : PROCESS (

    DQ,

    current_state

    )

    BEGIN

    -- Default Assignment

    -- Default Assignment To Internals

    -- State Actions

    CASE current_state IS

    WHEN s0 =>

    rs <= '0';

    CE<='0';

    WE<='0';

    oe<='1';

    adv <= '1';

    B<=(others=>'1');

    WHEN s3 =>

    A <=(others=>'1');

    DQ<="0000000000001010";

    we<='0';

    adv <= '0';

    WHEN s4 =>

    oe <= '0';

    A <=(others=>'1');

    adv <= '0';

    WHEN s6 =>

    B <= DQ(3 downto 0);

    WHEN s1 =>

    we<='1';

    adv<='1';

    WHEN s5 =>

    we<='1';

    WHEN s7 =>

    DQ<="0000000000000000";

    we<='0';

    adv <= '0';

    A <=(others=>'1');

    WHEN s2 =>

    we<='1';

    adv<='1';

    WHEN s8 =>

    rs<='1';

    WHEN OTHERS =>

    NULL;

    END CASE;

    END PROCESS output;

    -- Concurrent Statements

    clk<=clk_H;

    END fsm;

    Please do advice me

    Thank You

    Regards

    Dharmesh Joshi
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The sequence is always

    Reset -> Erase -> Program -> Busy -> Verify

    The program sequence is

    Program0 ~ Program7 in my last reply