FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
6485 Discussions

I want to Erase CFM0,but it seems like flash didn't response.

KWang97
Beginner
540 Views

无标题.pngI want to Erase CFM0,but it seems like flash didn't receive my command. Why?

Below are code:

  CFM1 : CFM

    port map(

         clock => ssClk, 

         reset_n => ssRst,

         avmm_data_addr => slv17avmm_data_addr,

         avmm_data_read => slavmm_data_read,

         avmm_data_writedata => slv32avmm_data_writedata,

         avmm_data_write => slavmm_data_write,

         avmm_data_readdata => slv32avmm_data_readdata,

         avmm_data_waitrequest => slavmm_data_waitrequest,

         avmm_data_readdatavalid => slavmm_data_readdatavalid,

         avmm_data_burstcount => B"01",

       

         avmm_csr_addr => slavmm_csr_addr,

         avmm_csr_read => slavmm_csr_read,

         avmm_csr_writedata => slv32avmm_csr_writedata,

         avmm_csr_write => slavmm_csr_write,

         avmm_csr_readdata => slv32avmm_csr_readdata

      ); 

FlashErase : process( ssClk )

  begin

    if rising_edge( ssClk ) then

      slv32MSG_ID_Old <= slv32MSG_ID;

      case stFlashEraseState is

        when ST_ERASE_IDLE =>

          slEraseOK <= '0';

          if slv32MSG_ID = X"00001000" and slv32MSG_ID_Old /= X"00001000" then 

            stFlashEraseState <= ST_ERASE_UNPROTECT;

            slavmm_csr_write <= '1';

            slavmm_csr_addr <= '1';

            slv32avmm_csr_writedata <= X"F7FFFFFF";

          end if;

           

        when ST_ERASE_UNPROTECT =>

          stFlashEraseState <= ST_ERASE_START;

          slavmm_csr_write <= '1';

          slavmm_csr_addr <= '1';

          slv32avmm_csr_writedata <= X"F7FFFFFF";

                              

        when ST_ERASE_START =>

          stFlashEraseState <= ST_ERASE_WAIT;

          slavmm_csr_write <= '1';

          slavmm_csr_addr <= '1';

          slv32avmm_csr_writedata <= X"F7DFFFFF";

           

        when ST_ERASE_WAIT =>

          stFlashEraseState <= ST_ERASE_WAIT;

          slavmm_csr_write <= '0';

          slavmm_csr_read <= '1';

          slavmm_csr_addr <= '0';

          if slv32avmm_csr_readdata(1 downto 0) = B"00" and slv32avmm_csr_readdata(3) = '1' then 

            stFlashEraseState <= ST_ERASE_IDLE;

            slavmm_csr_read <= '0';

            slavmm_csr_write <= '1';

            slavmm_csr_addr <= '1';

            slv32avmm_csr_writedata <= X"FFFFFFFF";

            slEraseOK <= '1';

          end if;          

        when others =>

          null;

      end case;       

    end if;

  end process FlashErase;

 

 

0 Kudos
3 Replies
JohnT_Intel
Employee
361 Views

Hi,

 

  1. May I know how do you connect the clk to the On Chip Flash IP?
  2. Is it from internal Oscillator or clk pin?
  3. What is the clk frequency used?
  4. Could you read the status register (CSR_ADDR = 0x0) after you disable the write protection and after you execute sector erased?
0 Kudos
KWang97
Beginner
361 Views

Thanks a lot!

I have solved this and the problem is caused by wrong reset signal.

0 Kudos
JohnT_Intel
Employee
361 Views

Hi,

 

I am glad to hear that the issue has been resolved and is due to the reset signal not routed correctly.

0 Kudos
Reply