- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
:confused: I am working on a meter based on Cyclone III (using all logic on Quartus and display related using NIOS). i now want to store/change some value during run-time and recollect on consequent power ups. I am still a rookie in FPGA world. Kindly get me out of this. This is an important part of my product development.
thanks in advance santhoshLink Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to use non-volatile storage.
What does your Cyclone III configure itself from? An EPCS serial flash device? If you have not used all of the locations in the serial flash, you can store your data there. Otherwise you'll have to add some external memory, eg., serial flash, I2C flash, etc. Cheers, Dave- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Dave,
thanks for the reply, yes there is some space in the EPCS device i am using. Could you basically explain how i can go about storing some data (say a 12 bit value) in memory for future use and change it during runtime ??- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- thanks for the reply, yes there is some space in the EPCS device i am using. Could you basically explain how i can go about storing some data (say a 12 bit value) in memory for future use and change it during runtime ?? --- Quote End --- Read the data sheet for the EPCS device and it explains how you can read and write flash. Basically it involves a serial bit sequence involving a command and the data you want to write. Flash is erased in sectors. Since you only want to store a small amount of data, you'll want to be able to store multiple values before erasing the flash. Here's a simple scheme you can use; 1) Decide on the area in Flash you can write to (ideally a single sector of flash). 2) Erase it, so that its bytes are all 0xFF 3) Use two bytes for your 12-bit data, and decide whether you will store data in 16-bit big-endian or little-endian format. 4) Decide on a data format that you can distinguish from an erased 16-bit value. In your case, since you are only using 12-bit data, just use 12-bits of the 16-bits, and set the 4-bits of the MSB to zeros, i.e., in your code write_data(data & 0xFFF), where the mask sets the MSBs to zero. 5) When your code searches for the last valid value, it starts at the beginning of the flash sector where data is stored, loops through 16-bit values and looks for the first value where the MSB is set to 1. If the first entry in flash has its MSB set, then there is no value in flash, otherwise, the last value written is the value before the value with the MSB set. 6) When you go to write a new value, you use the same procedure to find an entry with the MSB set. If you reach the end of the data sector you have allocated for storing data, then you need to erase it, and write the value to the start of the flash. Simple eh? :) Cheers, Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you might have to save multiple items something a little more complex is worth the effort.
I used a 24bit 'tag' and 8 bit 'length' in one 32bit word, followed by 'length' data words. Update sequence: 1) Find the end and write in the new length (leaving the tag 0xffffff) 2) Write in the new data. 3) Modify the new tag. 4) Change the old tag to zero. That will survive most interrupted write sequences.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please advice what API's should i use to ERASE, WRITE and READ EPCS device ????? and how to find the address of the EPCS which i can use for User Area !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok guys.. i got it going... there are host of API's available in the controllers "altera_avalon_epcs_flash_controller.h" and flash "sys/alt_flash.h"
alt_epcs_flash_erase_block(p_epcs_fd,addr); alt_epcs_flash_write_block(p_epcs_fd, 0, addr, &def_ctr, sizeof(def_ctr)); alt_read_flash(p_epcs_fd, addr, &def_ctr_rd, sizeof(def_ctr_rd)); you can refer threads below... http://www.alteraforum.com/forum/showthread.php?t=27724 http://www.alteraforum.com/forum/showthread.php?t=18461
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page