This page gives an overview of the bare-metal driver support for the Octal SPI controller.
The octal SPI (OSPI) controller can access one or two flash devices using several different methods. The controller is located with the other flash memory controllers in the PMC. The I/O
interface is routed to the PMC MIO pin bank 0. OSPI is commonly used as a boot device. The controller provides multiple ways to read and write the flash memory:
• STIG/PIO read/write (software triggered instruction generator)
• Direct read/write with address remap
• Non-DMA indirect read/write via AXI slave interface
• DMA indirect read using AXI master interface
For more information, please refer Chapter 73: Octal SPI Controller in Versal TRM which includes links to the official documentation and resource utilization.
The source code for the driver is included with the Vitis Unified Software Platform installation, as well as being available in the Xilinx Github repository.
Driver Name | Path in Vitis | Path in Github |
---|---|---|
ospipsv | <Vitis Install Directory>/data/embedded/XilinxProcessorIPLib/drivers/ospipsv | https://github.com/Xilinx/embeddedsw/tree/master/XilinxProcessorIPLib/drivers/ospipsv |
Note: To view the sources for a particular release, use the rel-version tag in github. For example, for the 2020.1 release, the proper version of the code is: https://github.com/Xilinx/embeddedsw/tree/xilinx-v2020.1/XilinxProcessorIPLib/drivers/ospipsv |
The driver source code is organized into different folders. The table below shows the ospipsv driver source organization.
Directory | Description |
---|---|
doc | Provides the API and data structure details |
data | Driver .tcl , .mdd and .yaml files |
examples | Example applications that show how to use the driver features |
src | Driver source files, make and cmakelists file |
Note: AMD Xilinx embeddedsw build flow is changed from 2023.2 release to adapt to the new system device tree based flow. For further information, refer to the wiki page Porting embeddedsw components to system device tree (SDT) based flow - Xilinx Wiki - Confluence (atlassian.net).
The .yaml(in data folder) and CMakeLists.txt(in src folder) files are needed for the System Device Tree based flow. The Driver .tcl and .mdd files are for the older build flow which will be deprecated in the future.
For a full list of features supported by this IP, please refer Chapter 73: Octal SPI Controller in Versal TRM
Refer to the driver examples directory for various example applications that exercise the different features of the driver. Each application is linked in the table below. The following sections describe the usage and expected output of the various applications. These example applications can be imported into the Vitis IDE from the Board Support Package settings tab.
Examples Path:
https://github.com/Xilinx/embeddedsw/tree/master/XilinxProcessorIPLib/drivers/ospipsv/examples
Test Name | Example Source | Description |
---|---|---|
OSPI Polled mode example | This examples does basic read and write test from the flash device in Polled mode. | |
OSPI Interrupt mode example | This examples does basic read and write test from the flash device in Interrupt mode. | |
OSPI Non-blocking Polled mode example | This examples does basic read and write test from the flash device in Non-blocking Polled mode. |
This examples does basic read and write test from the flash device in Polled mode.
Expected Output
OSPIPSV Flash Polled Example Test FlashID = 0x2C 0x5B 0x1A 0x10 0x41 0x0 0x96 0x78 0x0 EraseCmd 0xDC WriteCmd: 0x12 ReadCmd 0xCC Successfully ran OSPIPSV Flash Polled Ex |
This examples does basic read and write test from the flash device in Interrupt mode.
Expected Output
OSPIPSV Flash Interrupt Example Test Execuing on the a72 FlashID = 0x2C 0x5B 0x1A 0x10 0x41 0x0 0x96 0x78 0x0 EraseCmd 0xDC WriteCmd: 0x12 ReadCmd 0xCC Successfully ran OSPIPSV Flash Interrupt Example |
This examples does basic read and write test from the flash device in Non-blocking Polled mode.
Expected Output
OSPIPSV Flash Polled non-blocking read Example Test FlashID = 0x2C 0x5B 0x1A 0x10 0x41 0x0 0x96 0x78 0x0 EraseCmd 0xDC WriteCmd: 0x12 ReadCmd 0xCC Successfully ran OSPIPSV Flash non-blocking read Ex |
NA
At frequency 133.33 MHz
DDR mode:
Read Speed: 253371 KBPS
SDR-PHY mode:
Read Speed: 128849 KBPS
At frequency 33.33 MHz
SDR NON-PHY mode:
Read Speed: 32625 KBPS
https://github.com/Xilinx/embeddedsw/blob/xlnx_rel_v2023.2/doc/ChangeLog#L715
None
https://github.com/Xilinx/embeddedsw/blob/xlnx_rel_v2022.2/doc/ChangeLog#L120
https://github.com/Xilinx/embeddedsw/blob/xlnx_rel_v2022.1/doc/ChangeLog#L64
https://github.com/Xilinx/embeddedsw/blob/xilinx_v2021.2/doc/ChangeLog#L300
https://github.com/Xilinx/embeddedsw/blob/xilinx_v2021.1/doc/ChangeLog#L459
https://github.com/Xilinx/embeddedsw/blob/xilinx-v2020.2/doc/ChangeLog#L456
https://github.com/Xilinx/embeddedsw/blob/xilinx-v2020.1/doc/ChangeLog#L78
https://github.com/Xilinx/embeddedsw/blob/xilinx-v2019.2/doc/ChangeLog#L64
https://github.com/Xilinx/embeddedsw/blob/xilinx-v2019.1/doc/ChangeLog#L118