Forum Discussion
Altera_Forum
Honored Contributor
15 years agohelp me please!!! alt_flash_open_dev return error
I use sst flash 39vf6401 on my borad.When I need to progamme the flash, I should add a CFI table .Then I can download the programme to the flash successfully.
But I can not open the flash while alt_flash_open_dev(). The return value of alt_flash_open_dev() is always wrong. If any one know something about it, please help me ,Thank you !15 Replies
- Altera_Forum
Honored Contributor
who can help me?
Please say someting - Altera_Forum
Honored Contributor
You've got all the C source for the code you are running - so you should be able to track down which test is failing - so what data is incorrect. No one else can know!
- Altera_Forum
Honored Contributor
if I use open epcs via alt_flash_open_dev(), I can get the right value, and I can read and write epcs memory successfully.
but I can't open my flash use alt_flash_open_dev() - Altera_Forum
Honored Contributor
Hi
Can you run the memory test - take altera example. It wil show whether you hvae problems with EPCS. Maybe it is some hw problem or pins connection- you have your custom board. You should check from the software side too - i remind you should use not reduced device drivers (or reduced, i don't remember exactly this should be on altera web-site). Aslo check if epcs device is initialized as the device in the alt_sys_init.c function. Let me know if you solved your problem. - Altera_Forum
Honored Contributor
Hi uilka_b (http://www.alteraforum.com/forum/member.php?u=10640)!
Thank you very much for you reply!!! In my project, the reset vector is define to a flash , and I can programe the flash through the nios flash programing. But I have to add CFI table for the SST flash. Can I say my flash was correctly used? I have seen some people say that if the reset vector is to one flash, this flash can not be open in nios by alt_flash_open_dev. Is that true? By the way, I can use the same code to open and control my epcs all correctly,(because I have not use the epcs as the boot loader flash?) Can you give me some advice about how to open my boot loader flash? Because the epcs flash is to slow to erase and write. Thanks again! - Altera_Forum
Honored Contributor
this page is a friend who cant open epcs device when reset vector is epcs controller
http://www.alteraforum.com/forum/showthread.php?t=21484 - Altera_Forum
Honored Contributor
In my opinion, there are two posibble reason for the fault of open my CFI flash.
1, I use my CFI flash as boot loader flash(reset vector=CFI flash) 2, my CFI flash need add a CFI table for programing, but when i use alt_flash_open_dev ,no CFI table was added automatically. - Altera_Forum
Honored Contributor
--- Quote Start --- In my opinion, there are two posibble reason for the fault of open my CFI flash. 1, I use my CFI flash as boot loader flash(reset vector=CFI flash) 2, my CFI flash need add a CFI table for programing, but when i use alt_flash_open_dev ,no CFI table was added automatically. --- Quote End --- delphicgp, sorry i mixed something up I thought you use EPCS memory. But anyway it doesn't matter. It looks like it is a case - if the reset vector is in the some specific flash you can't open it using open() function. Is it a question of the Altera's boot loader implementation? Maybe you need a custom boot loader then. I'm not sure how it works. Anyway, could you have your reset vector in EPCS and when use the CFI flash for the rest of the program? - Altera_Forum
Honored Contributor
--- Quote Start --- delphicgp, sorry i mixed something up I thought you use EPCS memory. But anyway it doesn't matter. It looks like it is a case - if the reset vector is in the some specific flash you can't open it using open() function. Is it a question of the Altera's boot loader implementation? Maybe you need a custom boot loader then. I'm not sure how it works. Anyway, could you have your reset vector in EPCS and when use the CFI flash for the rest of the program? --- Quote End --- delphicgp, no it is not the case. I had some time to create a design with CFI flash and SDRAM and I put the reset vector to the cfi_flash and i was able to test this flash using Altera memtest. The proof:
I use Terasic DE0 board as a hardware - you can check on their website how flash is connected. USelect Choice (a-b): b Enter the name of the CFI flash device to be opened, or just press <enter> to open "/dev/ext_flash" > /dev/cfi_flash -Successfully opened /dev/cfi_flash -Region 0 contains 8 blocks. -Checking Region 0 for erased blocks. -Block 1, at address 0x2000 identified. -Would you like to test this block? (y/n) y -Starting Flash Test. -Testing "alt_write_flash" and "alt_read_flash". pass 1 - passed. pass 2 - passed. -Testing "alt_erase_flash_block". passed. -Testing "alt_write_flash_block". passed. -Testing unaligned writes. passed. -Returning block 1 to its erased state. -Flash tests complete. -Closing flash device "/dev/cfi_flash". - Altera_Forum
Honored Contributor
--- Quote Start --- delphicgp, no it is not the case. I had some time to create a design with CFI flash and SDRAM and I put the reset vector to the cfi_flash and i was able to test this flash using Altera memtest. The proof:
I use Terasic DE0 board as a hardware - you can check on their website how flash is connected. U --- Quote End --- Thanks for your reply!!! I have never successfully open my CFI flash when I run memtest. Do you know why?Select Choice (a-b): b Enter the name of the CFI flash device to be opened, or just press <enter> to open "/dev/ext_flash" > /dev/cfi_flash -Successfully opened /dev/cfi_flash -Region 0 contains 8 blocks. -Checking Region 0 for erased blocks. -Block 1, at address 0x2000 identified. -Would you like to test this block? (y/n) y -Starting Flash Test. -Testing "alt_write_flash" and "alt_read_flash". pass 1 - passed. pass 2 - passed. -Testing "alt_erase_flash_block". passed. -Testing "alt_write_flash_block". passed. -Testing unaligned writes. passed. -Returning block 1 to its erased state. -Flash tests complete. -Closing flash device "/dev/cfi_flash".