|
| 1 | +.. _AM62D-dsp-offload-from-linux-user-guide: |
| 2 | + |
| 3 | +AM62D DSP offload from Linux - User Guide |
| 4 | +========================================= |
| 5 | + |
| 6 | +Overview |
| 7 | +-------- |
| 8 | + |
| 9 | +This guide describes how to set up, build, and run audio DSP offload example by using the Texas Instruments AM62D audio evaluation module (EVM). |
| 10 | +This demo example shows how to offload 8ch audio filtering to C7x from Linux, input is 8-channel, 256 block size audio data in channel interleaved form. |
| 11 | +The output is the processed eight-channel, sample rate 48KHz and 256 block size audio data in channel interleaved form. |
| 12 | +Below figure shows how this demo works: |
| 13 | + |
| 14 | +.. figure:: /images/AM62D_DSP_offload_Demo.svg |
| 15 | + :height: 500 |
| 16 | + :width: 1000 |
| 17 | + |
| 18 | +- Step 1: Read sample audio |
| 19 | + - DSP offload example application read the 8-channel raw audio data from the SD card. |
| 20 | + |
| 21 | +- Step 2: Copy data to shared DMA Buffer (DDR) |
| 22 | + - Copy audio data to a shared DMA buffer located in DDR memory. |
| 23 | + |
| 24 | +- Step 3: Notify DSP using RPMSG (IPC) |
| 25 | + - A53 sends a control message via RPMsg (Remote Processor Messaging) to the C7x core. This message informs the C7x that new input audio data is available for processing in the shared DDR buffer. |
| 26 | + |
| 27 | +- Step 4: C7x reads from shared DMA Buffer into L2 SRAM |
| 28 | + - The C7x DSP copies the audio data from the DMA buffer (DDR) into its local L2 SRAM for processing. This operation minimizes access latency compared to reading directly from DDR. |
| 29 | + |
| 30 | +- Step 5: Signal chain execution on DSP |
| 31 | + - Below figure shows the C7x signal chain executed on C7x: |
| 32 | + |
| 33 | + .. figure:: /images/AM62D_dsp_signal_chain_audio_offload.png |
| 34 | + :height: 80 |
| 35 | + :width: 1000 |
| 36 | + |
| 37 | + - CasadeBiquad Low-Pass Filter: This filter is a three-stage, direct form 1 design with a low-pass cut-off frequency of 10KHz. |
| 38 | + |
| 39 | + - CasadeBiquad High-Pass Filter: This filter is also a three-stage, direct form 1 design with a high-pass cut-off frequency of 2KHz. |
| 40 | + |
| 41 | + - Finite Impulse Response(FIR) Low-Pass Filter: This filter is a 64-tap low-pass filter with a cut-off frequency of 8KHz. |
| 42 | + |
| 43 | + - Real Fast Fourier Transform(FFT) and Inverse Fast Fourier Transform(IFFT) Real: Perform FFT and IFFT of a real signal. |
| 44 | + |
| 45 | + - Matrix Transpose: Convert the data format between de-interleaved and interleaved formats within the signal chain. |
| 46 | + |
| 47 | +- Step 6: Processed data copied back to shared DMA Buffer (DDR) |
| 48 | + - Once DSP processing is complete, the output (filtered/processed audio) copied back into the same section of the shared DMA buffer. |
| 49 | + - C7x sends a control message via RPMsg (Remote Processor Messaging) to the A53 core. This message informs the A53 that processed output audio data available in the shared DDR buffer. |
| 50 | + |
| 51 | +- Step 7: A53 reads back processed data from DMA buffer |
| 52 | + - A53 copies the processed audio data from the shared buffer, send this to audio output and forward to a host for visualization. |
| 53 | + |
| 54 | +- Step 8: Audio output (Playback) |
| 55 | + - The processed 8-channel audio play to speakers (Ch 1–8). |
| 56 | + |
| 57 | +- Step 9: Host GUI utility (Over RJ45 or Serial) |
| 58 | + - A53 communicates with a Host PC GUI utility over Ethernet (RJ45) or Serial. |
| 59 | + - Live display of input/output spectrum (if using IP mode). |
| 60 | + - Latency graphing (measuring round-trip delay). |
| 61 | + - ON/OFF control for filters. |
| 62 | + - DSP/CPU load monitoring. |
| 63 | + |
| 64 | +Hardware Prerequisites |
| 65 | +---------------------- |
| 66 | + |
| 67 | +- `AM62D-EVM <https://www.ti.com/tool/AUDIO-AM62D-EVM>`__ |
| 68 | + |
| 69 | +- Any audio device with output speaker and 3.5mm audio jack (Needed for running audio offload examples) |
| 70 | + |
| 71 | +- SD card (minimum 16GB) |
| 72 | + |
| 73 | +- USB Type-C 20W power supply (make sure to use type-C to type-C cable). |
| 74 | + |
| 75 | +- USB-to-UART cable for console access |
| 76 | + |
| 77 | +- PC (Windows or Linux) to flash image onto an SD Card |
| 78 | + |
| 79 | +- Ethernet cable for audio offload examples host utility |
| 80 | + |
| 81 | +- The ethernet expansion board `DP83867-EVM-AM <https://www.ti.com/tool/DP83867-EVM-AM>`__ |
| 82 | + |
| 83 | +- Host PC Requirements: |
| 84 | + |
| 85 | + - operating system: |
| 86 | + |
| 87 | + - Windows: |__WINDOWS_SUPPORTED_LONG__| |
| 88 | + |
| 89 | + - Ubuntu: |__LINUX_UBUNTU_VERSION_LONG__| |
| 90 | + |
| 91 | + - Memory: Minimum 4GB RAM (8GB or more recommended) |
| 92 | + |
| 93 | + - Storage: At least 10GB of free space |
| 94 | + |
| 95 | +Software and Tools |
| 96 | +------------------ |
| 97 | + |
| 98 | +- TI Processor SDK Linux RT (AM62Dx) |
| 99 | + |
| 100 | +- MCU+ SDK for AM62Dx |
| 101 | + |
| 102 | +- `C7000-CGT <https://www.ti.com/tool/C7000-CGT#downloads>`__ compiler |
| 103 | + |
| 104 | +- `Code Composer Studio <https://software-dl.ti.com/mcu-plus-sdk/esd/AM62DX/11_00_00_16/exports/docs/api_guide_am62dx/CCS_PROJECTS_PAGE.html>`__ |
| 105 | + |
| 106 | +- `TI Clang Compiler Toolchain <https://www.ti.com/tool/download/ARM-CGT-CLANG>`__ |
| 107 | + |
| 108 | +- CMake, GCC, make, git, scp, minicom, Python3 |
| 109 | + |
| 110 | +- `rpmsg-dma library <https://github.com/TexasInstruments/rpmsg-dma/tree/scarthgap>`__ |
| 111 | + |
| 112 | + |
| 113 | +EVM Setup |
| 114 | +--------- |
| 115 | + |
| 116 | +#. Cable Connections |
| 117 | + |
| 118 | + - The figure below shows some important cable connections, ports and switches. |
| 119 | + |
| 120 | + - Take note of the location of the "BOOTMODE" switch for SD card boot mode. |
| 121 | + |
| 122 | + .. figure:: /images/AM62D_evm_setup.png |
| 123 | + :height: 600 |
| 124 | + :width: 1000 |
| 125 | + |
| 126 | +#. Setup UART Terminal |
| 127 | + |
| 128 | + - First identify the UART port as enumerated on the host machine. |
| 129 | + |
| 130 | + - Make sure that the EVM and UART cable connected to UART to USB port as shown in Cable Connections |
| 131 | + |
| 132 | + - In windows, you can use the "Device Manager" to see the detected UART ports |
| 133 | + - Search "Device Manager" in Windows Search Box in the Windows taskbar. |
| 134 | + |
| 135 | + - If you do not see any USB serial ports listed in "Device Manager" under "Ports (COM & LPT)", then make sure you have installed the UART to USB driver from `FTDI <https://www.ftdichip.com/drivers>`__. |
| 136 | + |
| 137 | + - For A53 Linux console select UART boot port (ex: COM34 in below screenshot), keep other options to default and set 115200 baud rate. |
| 138 | + |
| 139 | +#. Setup SD card Boot Mode |
| 140 | + |
| 141 | + - EVM SD card boot mode setting: |
| 142 | + |
| 143 | + - BOOTMODE [ 8 : 15 ] (SW3) = 0100 0000 |
| 144 | + |
| 145 | + - BOOTMODE [ 0 : 7 ] (SW2) = 1100 0010 |
| 146 | + |
| 147 | + |
| 148 | +Steps to validate audio DSP offload demo |
| 149 | +---------------------------------------- |
| 150 | + |
| 151 | +#. Flash an SD card with the :file:`tisdk-default-image-rt-am62dxx-evm.rootfs.wic.xz` image and follow the instructions provided at :ref:`Create SD Card <processor-sdk-linux-create-sd-card>` guide. |
| 152 | + |
| 153 | +#. Insert the flashed SD card to `AUDIO-AM62D-EVM <https://www.ti.com/tool/AUDIO-AM62D-EVM>`__, connect the 3.5mm jack headset/Speaker, Ethernet Cable and power on TI AUDIO-AM62D-EVM. |
| 154 | + |
| 155 | +#. Make sure the EVM boot mode switches position set for SD card boot as described earlier |
| 156 | + |
| 157 | +#. Connect the USB-C cable from the power adapter to one of the two USB-C ports on the EVM. |
| 158 | + |
| 159 | +#. Download Host Utility `audmon.py <https://github.com/TexasInstruments/rpmsg-dma/blob/scarthgap/example/audio_offload/host%20utility/audmon.py>`__. |
| 160 | + |
| 161 | +#. The EVM should boot and the booting progress should display in the serial port console. At the end of booting, the Arago login prompt will appear. Just enter "root" to log in. |
| 162 | + |
| 163 | +#. Get the EVM IP address |
| 164 | + |
| 165 | + .. code-block:: console |
| 166 | +
|
| 167 | + root@am62dxx-evm:~# ifconfig |
| 168 | +
|
| 169 | +.. note:: |
| 170 | + |
| 171 | + EVM IP address required for host utility to connect to demo application |
| 172 | + |
| 173 | +#. Run audio-dsp offload demo application from console |
| 174 | + |
| 175 | + .. code-block:: console |
| 176 | +
|
| 177 | + root@am62dxx-evm:~# rpmsg_audio_offload_example |
| 178 | +
|
| 179 | +#. On host machine launch the :file:`audiomon.py` utility either in IP mode or UART mode |
| 180 | + |
| 181 | + - IP Mode |
| 182 | + |
| 183 | + .. code-block:: console |
| 184 | +
|
| 185 | + # python audmon.py ip <EVM IP address> |
| 186 | + Ex: # python audmon.py ip 192.168.0.101 |
| 187 | + |
| 188 | + - UART mode |
| 189 | + |
| 190 | + .. code-block:: console |
| 191 | +
|
| 192 | + # python audmon.py uart <device serial port> |
| 193 | + Ex: # python audmon.py uart /dev/ttyUSB1 |
| 194 | +
|
| 195 | +#. :file:`audiomon.py` utility GUI automatically connect to demo application which supports below features: |
| 196 | + |
| 197 | + - Real-time visualization of: |
| 198 | + |
| 199 | + - Frame-level average amplitude (dBFS) |
| 200 | + |
| 201 | + - latency tracking |
| 202 | + |
| 203 | + - Avg load |
| 204 | + |
| 205 | + - Input/output FFT spectrum (only in IP mode) |
| 206 | + |
| 207 | + - Command interface to toggle features (e.g., enabling/disabling FFT filter) |
| 208 | + |
| 209 | + - Ctrl+S based save for graphs and log summaries |
| 210 | + |
| 211 | + - Summary labels for min/max/avg stats per run |
| 212 | + |
| 213 | + - For more information refer: `README <https://github.com/TexasInstruments/rpmsg-dma/blob/scarthgap/example/audio_offload/host%20utility/README.md>`_. |
| 214 | + |
| 215 | +.. note:: |
| 216 | + |
| 217 | + Input/output audio spectrum plotting is only supported in IP mode. UART mode supports only metrics and command interface, not audio data streams. |
| 218 | + |
| 219 | +Below is sample snapshot: |
| 220 | + |
| 221 | +.. figure:: /images/AM62D_host_utility_snapshot.png |
| 222 | + :height: 600 |
| 223 | + :width: 1200 |
| 224 | + |
| 225 | +- For more information on demo application and configuration, refer: `DSP Offload Example <https://github.com/TexasInstruments/rpmsg-dma/blob/scarthgap/example/audio_offload/host%20utility/README.md>`__. |
| 226 | + |
| 227 | + |
| 228 | +How to build audio DSP offload demo |
| 229 | +==================================== |
| 230 | + |
| 231 | +Building audio DSP offload image from Yocto |
| 232 | +----------------------------------------------- |
| 233 | + |
| 234 | +- To build the Audio DSP offload image, refer :ref:`Processor SDK - Building the SDK with Yocto <building-the-sdk-with-yocto>` |
| 235 | + |
| 236 | +Building the Linux demo binary from sources |
| 237 | +------------------------------------------- |
| 238 | + |
| 239 | +#. The source code for Audio DSP offload demo is available as part of the `rpmsg-dma <https://github.com/TexasInstruments/rpmsg-dma/tree/scarthgap>`__. |
| 240 | + |
| 241 | + .. code-block:: console |
| 242 | +
|
| 243 | + host# git clone https://github.com/TexasInstruments/rpmsg-dma.git -b scarthgap |
| 244 | +
|
| 245 | +#. Download and Install the AM62D Linux SDK from |__SDK_DOWNLOAD_URL__| following the steps mentioned at :ref:`Download and Install the SDK <download-and-install-sdk>`. |
| 246 | + |
| 247 | +#. Prepare the environment for cross compilation. |
| 248 | + |
| 249 | + .. code-block:: console |
| 250 | +
|
| 251 | + host# source <path to linux installer>/linux-devkit/environment-setup |
| 252 | +
|
| 253 | +#. Compile the source |
| 254 | + |
| 255 | + .. code-block:: console |
| 256 | +
|
| 257 | + [linux-devkit]:> cd <path to rpmsg-dma source> |
| 258 | + [linux-devkit]:> cmake -S . -B build; cmake --build build |
| 259 | +
|
| 260 | + - This will build: |
| 261 | + |
| 262 | + - The example application :file:`rpmsg_audio_offload_example` |
| 263 | + |
| 264 | + - Transfer the generated files to SD card: |
| 265 | + |
| 266 | + - The example binary :file:`rpmsg_audio_offload_example` to :file:`/usr/bin` |
| 267 | + |
| 268 | + - The configuration file :file:`dsp_offload.cfg` to :file:`/etc` |
| 269 | + |
| 270 | + - The sample audio file :file:`sample_audio.wav` to :file:`/usr/share/` |
| 271 | + |
| 272 | + - The C7 DSP firmware file :file:`dsp_audio_filter_offload.c75ss0-0.release.strip.out` to :file:`/usr/lib/` |
| 273 | + |
| 274 | + - Optional: |
| 275 | + |
| 276 | + - To build only the library or only the example, use: |
| 277 | + |
| 278 | + .. code-block:: console |
| 279 | +
|
| 280 | + cmake -S . -B build -DBUILD_LIB=OFF # disables library build |
| 281 | + cmake -S . -B build -DBUILD_EXAMPLE=OFF # disables example build |
| 282 | +
|
| 283 | +
|
| 284 | +Building the c7 firmware from sources |
| 285 | +-------------------------------------- |
| 286 | + |
| 287 | +- Please refer to the `MCU+ SDK Documentation <https://software-dl.ti.com/mcu-plus-sdk/esd/AM62DX/11_00_00_16/exports/docs/api_guide_am62dx/GETTING_STARTED_BUILD.html>`__ |
0 commit comments