4.1.3.1.9. CSL OSPI Example¶
This example application demonstrates the OSPI flash read and write. It has 2 variants -
For SOCs having OSPI flash like J721E : performs DAC mode non-DMA OSPI Flash Write followed by OSPI Flash read at 133MHz RCLK and 166MHz RCLK for various transfer sizes (16B/32B/64B/128B/256B/512B/1024B).
For SOCs having XSPI flash like J7200 : performs INDAC mode OSPI Flash Write followed by OSPI Flash read at 133MHz RCLK and 166MHz RCLK for various transfer sizes (16B/32B/64B/128B/256B/512B/1024B).
It also prints the throughput measurement of various size transfers. The application compares the destination buffer with the source buffer to verify if the transfers were successful.
4.1.3.1.9.1. Building OSPI example¶
To build the OSPI example app in PDK, use the following command:
$ make -s -j8 csl_ospi_flash_app BOARD=<BOARD> CORE=<CORE>
The example app binary file can be found at the following location:
<pdk>/packages/ti/binary/csl_ospi_flash_app/bin/<BOARD>/csl_ospi_flash_app_<CORE>_release.xer5f
This command will build the OSPI Flash example app (csl_ospi_flash_app
) on baremetal.
Adjust the command according to your specific requirements,
such as selecting a different board or core if needed. By default, the release mode is built.
You can specify build mode by adding BUILD_PROFILE=debug
in the instruction.
4.1.3.1.9.2. Supported SOCs¶
j721e
j7200
j721s2
j784s4
4.1.3.1.9.3. Supported cores¶
mcu1_0
4.1.3.1.9.4. Hardware Connections¶
none
4.1.3.1.9.5. Running OSPI example¶
After building the example, follow the given steps to run the test:
Launch a CCS debug session, load and run
csl_ospi_flash_app_<CORE>_release.xer5f
binary file to the respective core for which the binary is built. Alternatively, the example application can be loaded using any other boot method such as MMC/SD.Logs will be printed on the MCU UART port 1. Below is an example of the log when running csl_ospi_flash_app on J721E on mcu1_0 core:
Binary: <pdk>/packages/ti/binary/csl_ospi_flash_app/bin/<BOARD>/csl_ospi_flash_app_<CORE>_release.xer5f
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 Time taken to read GTC Timer ticks = 555 ns (111 ticks) OSPI RCLK running at 133333333 Hz. OSPI flash test DAC at 133MHz RCLK - Read/Write 16 Bytes OSPI Write 16 bytes complete. Config Time: 279498315 ns Transaction Time: 168550 ns OSPI Read 16 bytes complete. Config Time: 365800655 ns Transaction Time: 780 ns OSPI flash test DAC at 133MHz RCLK - Read/Write 16 Bytes have passed OSPI RCLK running at 166666666 Hz. OSPI flash test DAC at 166MHz RCLK - Read/Write 16 Bytes OSPI Write 16 bytes complete. Config Time: 277898735 ns Transaction Time: 168390 ns OSPI Read 16 bytes complete. Config Time: 364196800 ns Transaction Time: 1165 ns OSPI flash test DAC at 166MHz RCLK - Read/Write 16 Bytes have passed OSPI RCLK running at 133333333 Hz. OSPI flash test DAC at 133MHz RCLK - Read/Write 32 Bytes OSPI Write 32 bytes complete. Config Time: 279346245 ns Transaction Time: 333375 ns OSPI Read 32 bytes complete. Config Time: 365808390 ns Transaction Time: 1400 ns OSPI flash test DAC at 133MHz RCLK - Read/Write 32 Bytes have passed OSPI RCLK running at 166666666 Hz. OSPI flash test DAC at 166MHz RCLK - Read/Write 32 Bytes OSPI Write 32 bytes complete. Config Time: 279746405 ns Transaction Time: 333275 ns OSPI Read 32 bytes complete. Config Time: 366209350 ns Transaction Time: 2290 ns OSPI flash test DAC at 166MHz RCLK - Read/Write 32 Bytes have passed OSPI RCLK running at 133333333 Hz. OSPI flash test DAC at 133MHz RCLK - Read/Write 64 Bytes OSPI Write 64 bytes complete. Config Time: 279424255 ns Transaction Time: 666230 ns OSPI Read 64 bytes complete. Config Time: 366219100 ns Transaction Time: 2650 ns OSPI flash test DAC at 133MHz RCLK - Read/Write 64 Bytes have passed OSPI RCLK running at 166666666 Hz. OSPI flash test DAC at 166MHz RCLK - Read/Write 64 Bytes OSPI Write 64 bytes complete. Config Time: 277880035 ns Transaction Time: 666165 ns OSPI Read 64 bytes complete. Config Time: 364675435 ns Transaction Time: 4565 ns OSPI flash test DAC at 166MHz RCLK - Read/Write 64 Bytes have passed OSPI RCLK running at 133333333 Hz. OSPI flash test DAC at 133MHz RCLK - Read/Write 128 Bytes OSPI Write 128 bytes complete. Config Time: 280029480 ns Transaction Time: 1327965 ns OSPI Read 128 bytes complete. Config Time: 369488735 ns Transaction Time: 5190 ns OSPI flash test DAC at 133MHz RCLK - Read/Write 128 Bytes have passed OSPI RCLK running at 166666666 Hz. OSPI flash test DAC at 166MHz RCLK - Read/Write 128 Bytes OSPI Write 128 bytes complete. Config Time: 280599770 ns Transaction Time: 1332330 ns OSPI Read 128 bytes complete. Config Time: 370064675 ns Transaction Time: 9085 ns OSPI flash test DAC at 166MHz RCLK - Read/Write 128 Bytes have passed OSPI RCLK running at 133333333 Hz. OSPI flash test DAC at 133MHz RCLK - Read/Write 256 Bytes OSPI Write 256 bytes complete. Config Time: 280312505 ns Transaction Time: 2664130 ns OSPI Read 256 bytes complete. Config Time: 371108600 ns Transaction Time: 10630 ns OSPI flash test DAC at 133MHz RCLK - Read/Write 256 Bytes have passed OSPI RCLK running at 166666666 Hz. OSPI flash test DAC at 166MHz RCLK - Read/Write 256 Bytes OSPI Write 256 bytes complete. Config Time: 280264245 ns Transaction Time: 2664095 ns OSPI Read 256 bytes complete. Config Time: 371059990 ns Transaction Time: 18410 ns OSPI flash test DAC at 166MHz RCLK - Read/Write 256 Bytes have passed OSPI RCLK running at 133333333 Hz. OSPI flash test DAC at 133MHz RCLK - Read/Write 512 Bytes OSPI Write 512 bytes complete. Config Time: 279870880 ns Transaction Time: 5327885 ns OSPI Read 512 bytes complete. Config Time: 373329495 ns Transaction Time: 20715 ns OSPI flash test DAC at 133MHz RCLK - Read/Write 512 Bytes have passed OSPI RCLK running at 166666666 Hz. OSPI flash test DAC at 166MHz RCLK - Read/Write 512 Bytes OSPI Write 512 bytes complete. Config Time: 279086685 ns Transaction Time: 5327900 ns OSPI Read 512 bytes complete. Config Time: 372547445 ns Transaction Time: 36470 ns OSPI flash test DAC at 166MHz RCLK - Read/Write 512 Bytes have passed OSPI RCLK running at 133333333 Hz. OSPI flash test DAC at 133MHz RCLK - Read/Write 1024 Bytes OSPI Write 1024 bytes complete. Config Time: 281470005 ns Transaction Time: 10656590 ns OSPI Read 1024 bytes complete. Config Time: 382262085 ns Transaction Time: 40880 ns OSPI flash test DAC at 133MHz RCLK - Read/Write 1024 Bytes have passed OSPI RCLK running at 166666666 Hz. OSPI flash test DAC at 166MHz RCLK - Read/Write 1024 Bytes OSPI Write 1024 bytes complete. Config Time: 281680235 ns Transaction Time: 10655530 ns OSPI Read 1024 bytes complete. Config Time: 382469995 ns Transaction Time: 72260 ns OSPI flash test DAC at 166MHz RCLK - Read/Write 1024 Bytes have passed All tests have passed. Done