I have tried some more from flash now. One of the problems is that the compact flash isn't power cycled I think. When I run it from flash I can't mount the compact flash. When I run it from Nios IDE, I just take out the card and insert it again and it works.
A couple of other issues: What kind of performance have you got with reading from and writing to the compact flash? With the compact flash card I'm using I should be able to get up to 8 MB/s write speed. I get nowhere near this. I need to have 512 kbit/s writing speed, but I can't get this either. This is used in a datalogger, so I write a couple of bytes at the time. Actually 2 bytes * 8 channels * 4 kHz = 64 kB/s. I basically have a loop that write 2 byte to the spi and read 2 bytes from it. The spi slave is a ADC that can deliever 125 ksamples/s so it is not the bottelneck I think. These 2 bytes are written to a file. Is the fprintf function too slow to make this work? Is there any way to speed this up?
How many files can you have open? I have seen the setting in nios2configtool and it is set to 16 files. But when I try to open 4 files and writing to them, the program just hangs. I would like to have 8 files open and writing to each of them a stream of 8 kB/s. I don't feel this is such a large stream of data, but the program just don't work. I use only 1MB of RAM, but I didn't think that could have anything to do with it.
A couple of no-so-related issues: Sometimes when I run the program from Nios IDE and out on the dev. kit, the program runs once, and after it is finished, it runs a second time. The realtime clock just keeps ticking a the second run. How do I get rid of this?
I run eCos from ROMRAM and I have tried to get around the performance problem described above by writing the samples to a array and then flushing it to the disk. But I can't seem to be able to get the program functioning with a array of 8000 unsigned chars and above. I would like to have 32000 cyg_uint16 preferably, but this doesn't seem to work. I thought I had enough RAM with 1 MB of it, but maybe I should use the 16 MB more that I could access?
Ole