Forum Discussion
Altera_Forum
Honored Contributor
14 years agoHow to use an EPCS Flash
Hallo together,
I'm actually trying to save data from NIOS II into an EPCS64 device. My system contains an EPCS controller. But now the confusion is complete, there are so many files for using an flash... and I'm not sure which to use. There are: - altera_avalon_epcs_flash_controller.h - sys\alt_flash.h - epcs_commands.h And all these headers include different read/write functions. Then I tried an example from the Internet to start.
static alt_flash_fd* epcs16_dev_ptr;
static flash_region *p_epcs_reg_info;
static int num_epcs_regs;
void epcs_open(void)
{
epcs16_dev_ptr = alt_flash_open_dev(EPCS_FLASH_CONTROLLER_NAME);
if (epcs16_dev_ptr == NULL)
{
alt_printf("** Can't open flash device **\n\n");
return;
}
alt_epcs_flash_get_info(epcs16_dev_ptr, &p_epcs_reg_info, &num_epcs_regs);
return;
} But to open the EPCS flash always fails. Is there something else to configure in the EPCS controller before start? Which header and functions are the right? Greets Sim47 Replies
- Altera_Forum
Honored Contributor
--- Quote Start --- I suppose that at least it breaks at all other timer init... Anyway you can place also a breakpoint at jtag uart init and see if it stops also there. Just a hint: I see a watchdog, did you disabled it when you debug your device? Because if for example you reset your device if it not refreshed correctly, probably your debugging is fake. Anyway initialization of device is required. As a last option, you could call ALTERA_AVALON_EPCS_FLASH_CONTROLLER_INSTANCE and ALTERA_AVALON_EPCS_FLASH_CONTROLLER_INIT within your main()... :cry: Ciao --- Quote End --- Yes I disabled it. I did so, an you see the result in attachment... it stops, but not at the bp. Strange!? What is ALTERA_AVALON_EPCS_FLASH_CONTROLLER_INSTANCE? I've never read it. - Altera_Forum
Honored Contributor
Now I set also breakpoints in function static int alt_epcs_flash_query(alt_flash_epcs_dev* flash)... But it never reaches one of them.
Any ideas?? - Altera_Forum
Honored Contributor
I suppose that at least it breaks at all other timer init... Anyway you can place also a breakpoint at jtag uart init and see if it stops also there.
Just a hint: I see a watchdog, did you disabled it when you debug your device? Because if for example you reset your device if it not refreshed correctly, probably your debugging is fake. Anyway initialization of device is required. As a last option, you could call ALTERA_AVALON_EPCS_FLASH_CONTROLLER_INSTANCE and ALTERA_AVALON_EPCS_FLASH_CONTROLLER_INIT within your main()... :cry: Ciao - Altera_Forum
Honored Contributor
- Altera_Forum
Honored Contributor
- Altera_Forum
Honored Contributor
Did you try placing the breakpoint within alt_sys_init()?
- Altera_Forum
Honored Contributor
I use the main.c in attachment. Very simple.
Is there any point I miss?? Disabling the reduced driver option has no effect. Greets - Altera_Forum
Honored Contributor
You have not to call it, it is called once alt_sys_init() function is called. Try putting a breakpoint at the beginning of alt_sys_init(), it is called before your main().
Ciao - Altera_Forum
Honored Contributor
--- Quote Start --- It's quite strange that if you put a breakpoint within alt_epcs_flash_init() it doesn't break... I tried that and I got break there. I'm sure you verified it, but just to be absolutely sure, use the IDE as editor and check that is defined part of ALTERA_AVALON_EPCS_FLASH_CONTROLLER_INIT macro with alt_epcs_flash_init and not the other; if it is, there is no possibility that you can't break there. Just as an attempt you could try disabling small driver. As you would agree with me, without initialization device is not registered (alt_flash_device_register) and cannot be opened. I think that once you get a correct initialization of device it will start working. :) Ciao --- Quote End --- Yes to all your points :) I set 3 break points in this function, then I started in Debug mode and Eclispe starts at the main(). Then I click run and it runs... never comes to bp. When should this macro be called?? Had I to call this macro? - Altera_Forum
Honored Contributor
It's quite strange that if you put a breakpoint within alt_epcs_flash_init() it doesn't break... I tried that and I got break there.
I'm sure you verified it, but just to be absolutely sure, use the IDE as editor and check that is defined part of ALTERA_AVALON_EPCS_FLASH_CONTROLLER_INIT macro with alt_epcs_flash_init and not the other; if it is, there is no possibility that you can't break there. Just as an attempt you could try disabling small driver. As you would agree with me, without initialization device is not registered (alt_flash_device_register) and cannot be opened. I think that once you get a correct initialization of device it will start working. :) Ciao