Forum Discussion
Altera_Forum
Honored Contributor
17 years agoHow to write in EPCS
Hello, I am a newbie with Nios II. I'm doing a robotic project with a Cyclone and an EPCS4 flash memory. I've added an EPCS controller in my SOPC Builder system. I has to read...
Altera_Forum
Honored Contributor
14 years ago --- Quote Start --- Hello, I am a newbie with Nios II. I'm doing a robotic project with a Cyclone and an EPCS4 flash memory. I've added an EPCS controller in my SOPC Builder system. I has to read/write some information in EPCS flash memory. I've tried to use the "epcs_command.h" header, but it doesn't work. My software program stay blocked for example on this line : device_id = epcs_read_device_id(epcs_flash_controller_0_base); This is the same thing for the other functions from this header. I read a lot of post on this forum, but I don't find any satisfying answer. Would you help me please ? If you don't use epcs_command.h, what functions and headers are you used to use ? Thanks a lot. mig --- Quote End --- It's been a while, so you probably don't care anymore; however, I recently ran into this problem as well, so I thought I would post a solution... The short answer is that instead of this: device_id = epcs_read_device_id(epcs_flash_controller_0_base); you need to do this: device_id = epcs_read_device_id(epcs_flash_controller_0_base+
epcs_flash_controller_0_register_offset);
This was definitely not clear from the Altera documentation I found; however, when using the functions in <epcs_commands.h>, the parameter 'alt_u32 base', is not what it seems (at least not to me)... With other peripherals, you simply take the peripherals base address as defined in <system.h>. For the EPCS commands, you need to offset this base address by the register offset, also found in <system.h> (in the definition of the EPCS Flash controller, probably below the BASE value). Hope this helps someone!