|
| 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_Setup.png |
| 15 | + :height: 500 |
| 16 | + :width: 1000 |
| 17 | + |
| 18 | +Below figure shows the C7x signal chain: |
| 19 | + |
| 20 | +.. figure:: /images/AM62D_dsp_signal_chain_11.01.png |
| 21 | + :height: 80 |
| 22 | + :width: 1000 |
| 23 | + |
| 24 | +- CasadeBiquad Low-Pass Filter: |
| 25 | + |
| 26 | + - This filter is a three-stage, direct form 1 design with a low-pass cut-off frequency of 10KHz. |
| 27 | + |
| 28 | +- CasadeBiquad High-Pass Filter: |
| 29 | + |
| 30 | + - This filter is also a three-stage, direct form 1 design with a high-pass cut-off frequency of 2KHz. |
| 31 | + |
| 32 | +- Finite Impulse Response(FIR) Low-Pass Filter: |
| 33 | + |
| 34 | + - This filter is a 64-tap low-pass filter with a cut-off frequency of 8KHz. |
| 35 | + |
| 36 | +- Real Fast Fourier Transform(FFT) and Inverse Fast Fourier Transform(IFFT) Real: |
| 37 | + |
| 38 | + - Perform FFT and IFFT of a real signal. |
| 39 | + |
| 40 | +- Matrix Transpose: |
| 41 | + |
| 42 | + - Convert the data format between de-interleaved and interleaved formats within the signal chain. |
| 43 | + |
| 44 | +Hardware Prerequisites |
| 45 | +---------------------- |
| 46 | + |
| 47 | +- `AM62D-EVM <https://www.ti.com/tool/AUDIO-AM62D-EVM>`__ |
| 48 | + |
| 49 | +- Any audio device with output speaker and 3.5mm audio jack (Needed for running audio offload examples) |
| 50 | + |
| 51 | +- SD card (minimum 16GB) |
| 52 | + |
| 53 | +- USB Type-C 20W power supply (make sure to use type-C to type-C cable). |
| 54 | + |
| 55 | +- USB-to-UART cable for console access |
| 56 | + |
| 57 | +- PC (Windows or Linux) to flash image onto an SD Card |
| 58 | + |
| 59 | +- Ethernet cable for audio offload examples host utility |
| 60 | + |
| 61 | +- The ethernet expansion board `DP83867-EVM-AM <https://www.ti.com/tool/DP83867-EVM-AM>`__ |
| 62 | + |
| 63 | +- Host PC Requirements: |
| 64 | + |
| 65 | + - operating system: |
| 66 | + |
| 67 | + - Windows: Windows 11 64-bit |
| 68 | + |
| 69 | + - Linux: Ubuntu 22.04 64-bit or higher |
| 70 | + |
| 71 | + - Memory: Minimum 4GB RAM (8GB or more recommended) |
| 72 | + |
| 73 | + - Storage: At least 10GB of free space |
| 74 | + |
| 75 | +Software and Tools |
| 76 | +------------------ |
| 77 | + |
| 78 | +- TI Processor SDK Linux RT (AM62Dx) |
| 79 | + |
| 80 | +- MCU+ SDK for AM62Dx |
| 81 | + |
| 82 | +- `C7000-CGT <https://www.ti.com/tool/C7000-CGT#downloads>`__ compiler |
| 83 | + |
| 84 | +- `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>`__ |
| 85 | + |
| 86 | +- `TI Clang Compiler Toolchain <https://www.ti.com/tool/download/ARM-CGT-CLANG>`__ |
| 87 | + |
| 88 | +- CMake, GCC, make, git, scp, minicom, Python3 |
| 89 | + |
| 90 | +- `rpmsg-dma library <https://github.com/TexasInstruments/rpmsg-dma/tree/scarthgap>`__ |
| 91 | + |
| 92 | + |
| 93 | +EVM Setup |
| 94 | +--------- |
| 95 | + |
| 96 | +#. Cable Connections |
| 97 | + |
| 98 | + - The figure below shows some important cable connections, ports and switches. |
| 99 | + |
| 100 | + - Take note of the location of the "BOOTMODE" switch, this is used to switch between different boot modes like SD, MMC SD mode |
| 101 | + |
| 102 | + .. figure:: /images/AM62D_evm_setup.png |
| 103 | + :height: 600 |
| 104 | + :width: 1000 |
| 105 | + |
| 106 | +#. Setup UART Terminal |
| 107 | + |
| 108 | + - First identify the UART port as enumerated on the host machine. |
| 109 | + |
| 110 | + - Make sure that the EVM and UART cable connected to UART to USB port as shown in Cable Connections |
| 111 | + |
| 112 | + - In windows, you can use the "Device Manager" to see the detected UART ports |
| 113 | + - Search "Device Manager" in Windows Search Box in the Windows taskbar. |
| 114 | + |
| 115 | + - If you don't 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>`__. |
| 116 | + |
| 117 | + - For A53 Linux console select UART boot port (ex: COM34 in below screenshot), keep other options to default and set 115200 baud rate. |
| 118 | + |
| 119 | +#. Setup SDCard Boot Mode |
| 120 | + |
| 121 | + - This mode is used to boot applications via SD card on the EVM. |
| 122 | + |
| 123 | + - BOOTMODE [ 8 : 15 ] (SW3) = 0100 0000 |
| 124 | + |
| 125 | + - BOOTMODE [ 0 : 7 ] (SW2) = 1100 0010 |
| 126 | + |
| 127 | +.. figure:: /images/AM62D_evm_sdcard_boot_mode.png |
| 128 | + :height: 300 |
| 129 | + :width: 600 |
| 130 | + |
| 131 | +Steps to validate Audio DSP offload Demo |
| 132 | +---------------------------------------- |
| 133 | + |
| 134 | +#. Flash an SD card with the :file:`tisdk-default-image-rt-am62dxx-evm.rootfs.wix.xz` wic image. Please follow the instructions provided at :ref:`Create SD Card <processor-sdk-linux-create-sd-card>` guide. |
| 135 | + |
| 136 | +#. 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. |
| 137 | + |
| 138 | +#. Make sure the EVM boot mode switches are set properly for SD card boot as described earlier |
| 139 | + |
| 140 | +#. Connect the USB-C cable from the power adapter to one of the two USB-C ports on the EVM. |
| 141 | + |
| 142 | +#. Download Host Utility `audmon.py <https://github.com/TexasInstruments/rpmsg-dma/blob/scarthgap/example/audio_offload/host%20utility/audmon.py>`__. |
| 143 | + |
| 144 | +#. 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. |
| 145 | + |
| 146 | +#. Get the EVM ip address |
| 147 | + |
| 148 | + .. code-block:: console |
| 149 | +
|
| 150 | + root@am62dxx-evm:~# ifconfig |
| 151 | +
|
| 152 | +.. note:: |
| 153 | + |
| 154 | + EVM ip address is required for host utility to connect to demo application |
| 155 | + |
| 156 | +#. Run audio-dsp offload demo application from console |
| 157 | + |
| 158 | + .. code-block:: console |
| 159 | +
|
| 160 | + root@am62dxx-evm:~# rpmsg_audio_offload_example |
| 161 | +
|
| 162 | +#. On host machine launch the :file:`audiomon.py` utility either in IP mode or UART mode |
| 163 | + |
| 164 | + - IP Mode |
| 165 | + |
| 166 | + .. code-block:: console |
| 167 | +
|
| 168 | + # python audmon.py ip <EVM IP address> |
| 169 | + Ex: # python audmon.py ip 192.168.0.101 |
| 170 | + |
| 171 | + - UART mode |
| 172 | + |
| 173 | + .. code-block:: console |
| 174 | +
|
| 175 | + # python audmon.py uart <device serial port> |
| 176 | + Ex: # python audmon.py uart /dev/ttyUSB1 |
| 177 | +
|
| 178 | +#. :file:`audiomon.py` utility GUI will be launched and it will automatically connect to demo application which supports below features: |
| 179 | + |
| 180 | + - Real-time visualization of: |
| 181 | + |
| 182 | + - Frame-level average amplitude (dBFS) |
| 183 | + |
| 184 | + - latency tracking |
| 185 | + |
| 186 | + - Avg load |
| 187 | + |
| 188 | + - Input/output FFT spectrum (only in IP mode) |
| 189 | + |
| 190 | + - Command interface to toggle features (e.g., enabling/disabling FFT filter) |
| 191 | + |
| 192 | + - Ctrl+S based save for graphs and log summaries |
| 193 | + |
| 194 | + - Summary labels for min/max/avg stats per run |
| 195 | + |
| 196 | + - For more information refer: `README <https://github.com/TexasInstruments/rpmsg-dma/blob/scarthgap/example/audio_offload/host%20utility/README.md>`_. |
| 197 | + |
| 198 | +.. note:: |
| 199 | + |
| 200 | + Input/output audio spectrum plotting is only supported in ip mode. UART mode supports only metrics and command interface, not audio data streams. |
| 201 | + |
| 202 | +Below is sample snapshot: |
| 203 | + |
| 204 | +.. figure:: /images/AM62D_host_utility_snapshot.png |
| 205 | + :height: 600 |
| 206 | + :width: 1200 |
| 207 | + |
| 208 | +- For more information on demo application & it's configuration, refer: `DSP Offload Example <https://github.com/TexasInstruments/rpmsg-dma/blob/scarthgap/example/audio_offload/host%20utility/README.md>`__. |
| 209 | + |
| 210 | + |
| 211 | +How to build Audio DSP offload Demo |
| 212 | +==================================== |
| 213 | + |
| 214 | +Building Audio DSP offload wic image from Yocto |
| 215 | +----------------------------------------------- |
| 216 | + |
| 217 | +- To build the Audio DSP offload wic image, please refer :ref:`Processor SDK - Building the SDK with Yocto <building-the-sdk-with-yocto>` |
| 218 | + |
| 219 | +Building the Linux Demo binary from sources |
| 220 | +------------------------------------------- |
| 221 | + |
| 222 | +#. The source code for Audio DSP offload demo is available as part of the `rpmsg-dma <https://github.com/TexasInstruments/rpmsg-dma/tree/scarthgap>`__. |
| 223 | + |
| 224 | + .. code-block:: console |
| 225 | +
|
| 226 | + host# git clone https://github.com/TexasInstruments/rpmsg-dma.git -b scarthgap |
| 227 | +
|
| 228 | +#. 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>`. |
| 229 | + |
| 230 | +#. Prepare the environment for cross compilation. |
| 231 | + |
| 232 | + .. code-block:: console |
| 233 | +
|
| 234 | + host# source <path-to-linux-installer>/linux-devkit/environment-setup |
| 235 | +
|
| 236 | +#. Compile the sources |
| 237 | + |
| 238 | + .. code-block:: console |
| 239 | +
|
| 240 | + [linux-devkit]:> cd <path-to-rpmsg-dma-sources> |
| 241 | + [linux-devkit]:> cmake -S . -B build; cmake --build build |
| 242 | +
|
| 243 | + - This will build: |
| 244 | + |
| 245 | + - The example application :file:`rpmsg_audio_offload_example` |
| 246 | + |
| 247 | + - Transfer the generated files to evm sdcard: |
| 248 | + |
| 249 | + - The example binary :file:`rpmsg_audio_offload_example` to :file:`/usr/bin` |
| 250 | + |
| 251 | + - The configuration file :file:`dsp_offload.cfg` to :file:`/etc` |
| 252 | + |
| 253 | + - The sample audio file :file:`sample_audio.wav` to :file:`/usr/share/` |
| 254 | + |
| 255 | + - The C7 DSP firmware file :file:`dsp_audio_filter_offload.c75ss0-0.release.strip.out` to :file:`/usr/lib/` |
| 256 | + |
| 257 | + - Optional: |
| 258 | + |
| 259 | + - To build only the library or only the example, use: |
| 260 | + |
| 261 | + .. code-block:: console |
| 262 | +
|
| 263 | + cmake -S . -B build -DBUILD_LIB=OFF # disables library build |
| 264 | + cmake -S . -B build -DBUILD_EXAMPLE=OFF # disables example build |
| 265 | +
|
| 266 | +
|
| 267 | +Building the C7 Firmware from sources |
| 268 | +-------------------------------------- |
| 269 | + |
| 270 | +- 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