Forum Discussion

Gyud0's avatar
Gyud0
Icon for Occasional Contributor rankOccasional Contributor
4 years ago

A write memory problem via Quad SPI mode in Generic Serial Flash Interface IP

Hey,

I'm using the Reference design Generic Serial Flash Interface IP on Quartus Prime 18.1 to access Micron MT25QL512Mb flash memory.

Via NIOS processor, I'm trying to write data to this flash unsuccessfully.

I do it in this order:

1)Entering Quad SPI mode (by enter_quad_mode function).

2)Entering to 4-Byte addressing mode (by enter_4byte_addressing_mode function).

3) Enabling the writing (by write_enable function).

4)Writing the data (by write_memory_quad function)

5) Reading the written data (by read_memory_quad function)

these are the functions:

1) void enter_quad_mode()

{ IOWR(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_CSR_BASE,0x7,0x00000035);

IOWR(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_CSR_BASE,0x9,0x00000000);

IOWR(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_CSR_BASE,0x8,0x1);

}

2) void enter_4byte_addressing_mode()

{ IOWR(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_CSR_BASE,0x7,0x000000B7);

IOWR(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_CSR_BASE,0x8,0x1);

IOWR(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_CSR_BASE,0xA,1);

}

3) void write_enable()

{

IOWR(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_CSR_BASE,0x7,0x00000006);

IOWR(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_CSR_BASE,0x8,0x1);

IOWR(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_CSR_BASE,0xA,1);

}

4) void write_memory_quad()

{

IOWR(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_CSR_BASE,0x4,0x00022222);

IOWR(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_CSR_BASE,0x0,0x101);

IOWR(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_CSR_BASE,0x6,7012);

IOWR(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_MEM_BASE,0x00000000,0xAA550000);

}

5) int read_memory_quad()

{

IOWR(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_CSR_BASE,0x4,0x00022222);

IOWR(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_CSR_BASE,0x0,0x00000101);

IOWR(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_CSR_BASE,0x5,0x00000A0C);

return IORD(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_MEM_BASE,0x00000000);

}

I'm using the function usleep(1000000) between each function I'm operating.

The received data (after I'm using the read_memory_quad function) is 0 instead of 0xAA550000.

this is the Device's datasheet (page 37):

https://media-www.micron.com/-/media/client/global/documents/products/data-sheet/nor-flash/serial-no...

I would like to get some help here,

Thanks

4 Replies