How do I use Nios® II to manipulate QSPI protection via the Altera Generic QUAD SPI Controller implemented in my MAX® 10 FPGA Development Kit design?

MAX Nios II

Category: Nios® II
tool:-
Device: MAX®10


Use the Nios® II HAL API alt_lock_flash() to set the values in the Micron N25Q512 datasheet Protected Area Sizes – Upper Area and Protected Area Sizes – Lower Area tables to determine the protection area. .
A summary of the alt_lock_flash() HAL API is as follows:

prototype
int alt_lock_flash(alt_flash_dev * flash_info, alt_u32 sectors_to_lock)

include


Lock a range of flash memory sectors.
Protect against writes and erases by passing a 32-bit unsigned integer value for the sectors_to_lock argument.
You can find the value for this argument in the data sheet for your flash device.

See the Embedded Peripherals IP User Guide for supported flash devices.
https://www.altera.com/en_US/pdfs/literature/ug/ug_embedded_ip.pdf
(See Altera Generic QUAD SPI Controller Core section Configuration Device Types)

argument

  • *flash_info: A pointer to a generic flash device structure.
  • sectors_to_lock: Block protection bits in EPCQ/QSPI ⇒ Bit4 | Bit3 | Bit2 | Bit1 | Bit0 TB | BP3 | BP2 | BP1 |


For more information on the alt_lock_flash() HAL API, see the Nios II Classic Software Developer's Handbook.
https://www.altera.com/en_US/pdfs/literature/hb/nios2/n2sw_nii5v2.pdf

Micron N25Q512 datasheet
https://www.micron.com/parts/nor-flash/serial-nor-flash/n25q512a13g1241e

reference
alt_flash.h - GitHub
https://github.com/conorpp/codesign-challenge-2015/blob/master/circle-modules-in-parallel/HAL/inc/sys/alt_flash.h




Experienced FAE
Free consultation is available.

From specific product specifications to parts selection, the Company FAE will answer your technical concerns free of charge. Please feel free to contact us.