- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi everyone, i meet some problems in max10 onchip flash UFM write and read
this is my code, it is only a test code, i want to test the write and read of UFM in debug mode. # include "alt_types.h"# include "altera_avalon_pio_regs.h"# include "system.h"# include <stdio.h># include <unistd.h> int main() { alt_u32 i=0; alt_u32 flash_status_reg1=0; alt_u32 flash_control_reg1=0; alt_u32 flash_data_reg1=0; alt_u16 j=0; alt_u16 a=0; while (1) { flash_status_reg1=IORD_32DIRECT(ONCHIP_FLASH_0_CSR_BASE,0x0); //read flash status it shows 0xfffffc00, which means the flash in idle, read failed, write failed, erase failed, and all the sectors pretection bit is 0(no protection) flash_data_reg1=IORD_32DIRECT(ONCHIP_FLASH_0_DATA_BASE,0x4000); //read UFM0's first 32bit, it shows 0xffffffff, (this may be right because i have erased the UFM0,UFM1 successful last time, ) flash_status_reg1=IORD_32DIRECT(ONCHIP_FLASH_0_CSR_BASE,0x0); //read flash status it shows 0xfffffc00, which means the flash in idle, read failed, write failed, erase failed, and all the sectors pretection bit is 0(no protection), does this shows the data read failed? why? flash_data_reg1=IORD_32DIRECT(ONCHIP_FLASH_0_DATA_BASE,0x4); //read UFM1's second 32bit, it shows 0xffffffff, (this may be right because i have erased the UFM0,UFM1 successful last time, ) flash_status_reg1=IORD_32DIRECT(ONCHIP_FLASH_0_CSR_BASE,0x0); //read flash status it shows 0xfffffc00, which means the flash in idle, read failed, write failed, erase failed, and all the sectors pretection bit is 0(no protection), does this shows the data read failed? why? flash_data_reg1=IORD_32DIRECT(ONCHIP_FLASH_0_DATA_BASE,0x8);//read UFM1's third 32bit, it shows 0xffffffff, (this may be right because i have erased the UFM0,UFM1 successful last time, ) flash_status_reg1=IORD_32DIRECT(ONCHIP_FLASH_0_CSR_BASE,0x0);//read flash status it shows 0xfffffc00, which means the flash in idle, read failed, write failed, erase failed, and all the sectors pretection bit is 0(no protection), does this shows the data read failed? why? flash_control_reg1=IORD_32DIRECT(ONCHIP_FLASH_0_CSR_BASE,0x4);//read flash control register it shows 0x3fffffff, IOWR_32DIRECT(ONCHIP_FLASH_0_CSR_BASE,0x4,flash_control_reg1&0x3f7fffff); // write to flash control register, disable the write protection of UFM1 flash_control_reg1=IORD_32DIRECT(ONCHIP_FLASH_0_CSR_BASE,0x4); //read flash control register it shows 0x3f7fffff, so write to flash control register successful IOWR_32DIRECT(ONCHIP_FLASH_0_DATA_BASE,0x0,0xab); // write to flash UFM1's first 32 bit , flash_status_reg1=IORD_32DIRECT(ONCHIP_FLASH_0_CSR_BASE,0x0); // check the status, it shows write failed or stuck in busy_write.... why this happen?is there any reference design about how to use the UFM? thanks!Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
here's a reference design for UFM for MAX 10 https://cloud.altera.com/devstore/platform/14.0.2/putting-altera-max-series-in-hibernation-using-user-flash-memory-an547/ Also, which version of quartus are you using?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
quartus 14.1
i have downloaded an547, i am trying to open it...- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i have downloaded an547 many weeks before, i tried for many times, can not open the reference design
i install the reference design, but i can not find the quartus project files in the folder. i have installed many reference designs, but i can not figure out this one. by the way, i have seen the folder, the m10_int_flash_mem.qsys just have a flash, no nios processor. i have read the max 10 user flash memory user guide.pdf, it do not tell me how to use the ufm in nios.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page