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
17 years agoExcellent.
I'm not familiar with the old ASMI functions, but I'd guess the functions take similar arguments. You could try this: alt_epcs_flash_read(p_epcs_fd, epcs_address, buffer_address, bytes_to_read); where: p_epcs_fd was initialised by the epcs_open() function earlier epcs_address is the address offset into your EPCS device that you want to start reading from buffer_address is a pointer to a suitable RAM buffer bytes_to_read is the number of bytes to read! So you could do this: alt_u8 buffer[16]; alt_epcs_flash_read(p_epcs_fd, 0, (void*)buffer, 16); to read the first 16 bytes of data into an array. You can probably work out how the erase_block and write_block functions work by looking in altera_avalon_epcs_flash_controller.c Note that the erase function erases the entire block (64k) containing the offset you pass to it. P.S. num_epcs_regs is just telling you there is one region (512k made up of 8*64k blocks).