- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
my system includes Flash,EPCS,etc,and has a EPCS controller.i want to read and write the EPCS in the nios.i tried to open the device using "alt_flash_open_dev()",but it's alway wrong--"can not open the device".so i used IORD()/IOWR(),and found Flash could be read/writen correctly,but EPCS couldn't be read/writen.Why?is anybody help me?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try building the Nios project and using the "memtest" program. Part of the memtest program can also test the EPCS. If Nios can see the EPCS device then it should be able to access it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if your target board is a customer board,first you'd add your board to the SOPC system.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is your flash (EPCS) empty? Try downloading your program to flash, then try to debug it again. I had the same problem. If the flash was empty, it would not open the EPCS device correctly.
Let me know if this was the case, Mike- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks ,and i found it's short of a header file called "sys/alt_flash_dev()".firstly i think we should initialize the device, in my nios program, there's an initializing sentence (javascript:showjdsw('jd_t','j_'))-"alt_sys_init()", if i did not include the header file-sys/alt_flash_dev(), there is a warning. and the device(epcs & ext_flash) can not be opend. i don't know why.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
include these files also, #include "altera_avalon_epcs_flash_controller.h" #include "sys/alt_flash.h"// used for EPCS #include "sys/alt_flash_dev.h"// used for EPCS# include "sys/alt_sys_init.h" you need to open the device using the name of the EPCS device, with the value stored in the system.h file, like below // open flash device pEPCS = alt_flash_open_dev(EPCS_CONTROLLER_NAME); this is what is located in the generated system.h header, #define epcs_controller_name"/dev/epcs_controller"- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi,
thanks very much, mike21, it's perfect!- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi,
how about the ext_flash? it's the same problem.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi,
sometimes, it can be opened, but it often can not be opened. i don't know why.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is the flash programmed and is the NIOS set to boot from flash?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes, the nios is set to boot from flash. and in the nios program when the nios program tries to open the flash, the system halted.why?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mike21, i have set the nios boot from flash, in sopc builder, i set the reset address to flash. in nios ii ide setting, i also set the .text and .rodata flash to flash.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi everybody,
iam using a nios II system generated from sopc builder.my system contains a CFI FLASH and SDRAM.Iam trying to simulate THE MEMTESTC.C exemple from the IDE.the sdram test is allright but the flash test is not. I have an error in Modelsim " -ERROR: Could not open flash i think that the problem is in the function alt_flash_open_dev witch don't recognize the flash i changed the code a little bit to be a ble to simulate static void TestFlash(int mode, int flash_type) { alt_flash_fd* fd; int number_of_regions; int block; int y=0; flash_region* regions; int ret_code = 0x0; // alt_u8 entry[4]; alt_u8 flashname[30];i replace this variable by CFI_FLASH_NAME printf("\n get flash name\n"); ret_code = GetFlashName(CFI_FLASH_NAME,CFI); printf("\n openning the falsh\n"); fd = alt_flash_open_dev(CFI_FLASH_NAME); if (fd) { printf(" -Successfully opened %s\n", CFI_FLASH_NAME); /* Get some useful info about the flash */ ret_code = alt_get_flash_info(fd, ®ions, &number_of_regions); if (!ret_code) { printf(" -Region 0 contains %d blocks.\n", regions->number_of_blocks); block = FlashFindErasedBlocks(fd, regions, number_of_regions, mode); /* If we're in TEST mode, ask if this block is okay to test. */ if(( mode == TEST ) && ( block != QUIT_WITHOUT_TESTING )) { printf(" -Block %d, at address 0x%X identified.\n", block, (regions->offset + (block * regions->block_size))); printf(" -Would you like to test this block? (y/n)"); //GetInputString(entry, sizeof(entry), stdin); y=1; // if ( entry[0] == 'y' && entry[1] == '\n' ) if(y==1) { /* Test that Flash! */ FlashRunTests(fd, block, regions); printf(" -Closing flash device \"%s\".\n",CFI_FLASH_NAME); alt_flash_close_dev(fd); } } } } else{ printf(" -ERROR: Could not open %s\n", CFI_FLASH_NAME); } } i tried a lot of things and i get the same result if somebody have an idea about how to solve this problem please HELP ME
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page