Forum Discussion
Nios-V alt_epcq_controller_write() Problem
- 9 months ago
Hi Balerion,
Regading to avl_mem slave:
If you also place avl_mem slave in Peripheral Region, you can use the current altera_epcq_controller.c file as is.
However, you may want to place avl_mem slave in cacheable (non-Peripheral) region to take advantage of the cache for read accesses. In that case, cache maintenance needed for flash memory write operation in Nios V/g system. Here is a code example (= not fully validated) to achieve this attached (please replace the file extension from ".txt" to ".c"). At the end of the alt_epcq_controller_write_block() function, cache flush function call and error checking are added.
Thanks,
ShoH
Hi ShoH,
Before I try what you suggest I did another thing which is I used to call Public API's in order like:
For write operation:
alt_epcq_controller_lock(); // with related params to unlock all sectors
alt_epcq_controller_write(); // with related params to erase and write
alt_epcq_controller_lock(); // with related params to lock all sectors
I was doing that for every write operation.
then what I did is when initializing I'm opening the lock of all sector once then don't deal with any locking:
alt_epcq_controller_lock(); // with related params to unlock all sectors
SleepMs(20);
For Write operation:
alt_epcq_controller_write(); // with related params to erase and write
It seems, this solved my problem. I did some tests like writing and reading different size of data and comparing them none of them failed.
Thanks for help,
Balerion
Hi Balerion,
Regading to avl_mem slave:
If you also place avl_mem slave in Peripheral Region, you can use the current altera_epcq_controller.c file as is.
However, you may want to place avl_mem slave in cacheable (non-Peripheral) region to take advantage of the cache for read accesses. In that case, cache maintenance needed for flash memory write operation in Nios V/g system. Here is a code example (= not fully validated) to achieve this attached (please replace the file extension from ".txt" to ".c"). At the end of the alt_epcq_controller_write_block() function, cache flush function call and error checking are added.
Thanks,
ShoH
- Balerion9 months ago
Occasional Contributor
Hi ShoH,
Thanks for your response. I will be using that.
Balerion