HRPNUG NXP Semiconductors Harpoon User's Guide Overview This document presents the Harpoon release 2.2 for i.MX 8M device family, using the Arm Cortex-A53 processor (Armv8-A architecture). Harpoon provides an environment for developing real-time demanding applications on an RTOS running on one (or several) Cortex-A core(s) in parallel of a Linux distribution, leveraging the 64-bit Arm architecture for higher performance.
HRPNUG NXP Semiconductors Harpoon User's Guide Figure 1. Harpoon solution architecture The i.MX 8M box shows the hardware partitioning between Jailhouse cells. The boxes in dark orange (group 1) show the main hardware blocks allocated to the Linux OS. The boxes in blue (group 3) show the main hardware blocks allocated to the RTOS.
HRPNUG NXP Semiconductors Harpoon User's Guide • CPU cores assigned to the cell • Interrupt lines assigned to the cell • Memory regions assigned to the cell • Virtual PCI devices used for communication between cells There is also a root cell configuration that describes the hardware prior to the hardware partitioning.
HRPNUG NXP Semiconductors Harpoon User's Guide 2.1 i.MX Yocto To build this release, fetch its Yocto manifest and get the meta-layers: $ mkdir yocto $ cd yocto $ repo init -u https://github.com/nxp-imx/imx-manifest -b imx- linux-kirkstone -m imx-5.15.71-2.2.0_harpoon-v2.xml $ repo sync Then, prepare the environment with the following command: $ DISTRO=fsl-imx-xwayland MACHINE=<machine>...
Page 6
HRPNUG NXP Semiconductors Harpoon User's Guide Figure 2. i.MX 8M Mini EVK Note: For more information to order the board, see https://www.nxp.com/design/ development-boards/i-mx-evaluation-and-development-boards/evaluation-kit-for-the-i- mx-8m-mini-applications-processor:8MMINILPD4-EVK Figure 3. i.MX 8M Nano EVK Note: For more information to order the board, see https://www.nxp.com/design/ development-boards/i-mx-evaluation-and-development-boards/evaluation-kit-for-the-i- mx-8m-nano-applications-processor:8MNANOD4-EVK.
HRPNUG NXP Semiconductors Harpoon User's Guide Figure 4. i.MX 8M Plus EVK Note: For more information to order the board, see https://www.nxp.com/design/ development-boards/i-mx-evaluation-and-development-boards/i-mx-8m-plus-evaluation- kit-enabling-power-measurement:8MPLUSLPD4-PEVK. 3.2 Audio use case hardware Harpoon audio application uses the I2S HiFiBerry audio card DAC+ ADC Pro.
Page 8
HRPNUG NXP Semiconductors Harpoon User's Guide Table 1. EVK - HiFiBerry transposition ...continued HiFiBerry Function I2C SDA I2C SCK I2S TX I2S clock I2S word select for RX and TX I2S RX Figure 6. Handmade transposer A complete setup, with a handmade transposer to respect above pinout, is shown as follows.
Page 9
HRPNUG NXP Semiconductors Harpoon User's Guide Figure 7. i.MX 8M Mini EVK with HiFiBerry audio card The audio card has both an ADC (PCM1863) to record audio and a DAC (PCM5122) for audio playback. Record is done through the audio jack (connector highlighted in 1 in the following figure) and playback is done through the RCA connectors (highlighted in 2).
HRPNUG NXP Semiconductors Harpoon User's Guide Both the PCM1863 and PCM5122 use i.MX I2S5. The I2S5 is the I2S clock master. Two oscillators (one for sampling frequencies multiple of 44,100 Hz, one for sampling frequencies multiple of 48,000 Hz) are present on the HiFiBerry card, and controlled by PCM5122 GPIOs.
Page 11
HRPNUG NXP Semiconductors Harpoon User's Guide Figure 10. LS1028A AVB/TSN network bridge Note: For more information to order the board, see https://www.nxp.com/design/qoriq- developer-resources/layerscape-ls1028a-reference-design-board:LS1028ARDB. The LS1028A RDB is used as a TSN bridge/switch in a TSN network to demonstrate the TSN Ethernet use case running from the inmate cell.
HRPNUG NXP Semiconductors Harpoon User's Guide Note: For more information to order the board, see https://www.nxp.com/design/ development-boards/i-mx-evaluation-and-development-boards/i-mx-rt1170-evaluation- kit:MIMXRT1170-EVK. The RT1170 is used as a TSN endpoint in a TSN network, exchanging packets with the i.MX 8MP board. Running Harpoon Reference Applications 4.1 Basic setup...
HRPNUG NXP Semiconductors Harpoon User's Guide • For i.MX 8M Plus (audio AVB): u-boot => setenv jh_root_dtb imx8mp-evk-harpoon-avb.dtb u-boot => run jh_mmcboot • For i.MX 8M Plus (industrial or rt_latency): u-boot => setenv jh_root_dtb imx8mp-evk-harpoon-industrial.dtb u-boot => run jh_mmcboot Note: This configuration is not persistent after a reboot.
HRPNUG NXP Semiconductors Harpoon User's Guide 4.3.4.1 Playing DTMF To start DTMF playback with default parameters (48000 Hz sampling rate): # harpoon_ctrl audio -r 0 The DTMF is played both to the Hifiberry RCA outputs as well as the onboard jack.
Page 17
HRPNUG NXP Semiconductors Harpoon User's Guide Audio pipeline with multiple sources/sinks and a routing element Figure 12. Audio pipeline When running the audio pipeline, the routes can be configured dynamically with the harpoon_ctrl command. This command uses source and sink indices to connect elements.
HRPNUG NXP Semiconductors Harpoon User's Guide codec) while a DTMF sequence is played on the left channel of SAI5's output and a 440 Hz sine wave on the right channel of SAI5's output (i.e., HiFiBerry's output): # harpoon_ctrl audio -r 3...
Page 19
HRPNUG NXP Semiconductors Harpoon User's Guide Table 5. Indices of source elements Index Source element Comment Sine wave, 440 Hz Software generated source SAI5, left channel Hardware source SAI5, right channel Hardware source SAI3, left channel Hardware source SAI3, right channel...
Page 20
HRPNUG NXP Semiconductors Harpoon User's Guide AVB Talker (blue box) connected to the AVB Listener (orange box) through Ethernet. Figure 14. AVB Audio setup 4.3.4.4.2 AVB Talker configuration The default AVB script needs to be modified to configure operations of the Talker entity as using a custom Media Application.
Page 21
HRPNUG NXP Semiconductors Harpoon User's Guide talker_mediaX.raw in the /home/media repository, with X being the stream number. Therefore, before executing the multi-stream application, some symbolic links needs to be created in the /home/media directory for associating the talker_mediaX.raw names; here is an example for stream #0: # cd /home/media # ln -s sample1_for_aaf.raw talker_media0.raw...
Page 22
HRPNUG NXP Semiconductors Harpoon User's Guide 4.3.4.4.4 AVB stream connection This section describes how to use AVDECC events to configure the stream output of the Talker to the input of the Listener. To do so, we may use the GenAVB AVDECC controller...
Page 23
HRPNUG NXP Semiconductors Harpoon User's Guide Entity ID = 0x49f070f840000 Model ID = 0x49f0000090001 Capabilities = 0x708 Association ID = 0x0 MAC address= 00:04:9F:07:0F:84 Local MAC address= 00:04:9F:07:0F:84 Talker: sources = 8 capabilities = 0x4801 Stream 0: name = Stream output 0...
HRPNUG NXP Semiconductors Harpoon User's Guide To disconnect a stream, use the command: # genavb-controller-app -d <talker_entity_id> <talker_unique_id> <listener_entity_id> <listener_unique_id> In the below example, the Listener's stream #0 is connected to the Talker’s stream #0: # genavb-controller-app -c 0x49f070f840000 0 0x49fddee100000 0...
HRPNUG NXP Semiconductors Harpoon User's Guide Figure 15. SMP Audio Pipeline with two threads and CPU cores To run the Zephyr audio SMP pipeline application, the following command can be run to generate an appropriate configuration file: # harpoon_set_configuration.sh zephyr audio_smp Note: Avoid changing the configuration while the Harpoon service is running (silent failure when restarting the service).
HRPNUG NXP Semiconductors Harpoon User's Guide /usr/share/harpoon/inmates/freertos/industrial_rpmsg.bin FreeRTOS binary of RPMSG based control channel Note: In the current release, the RPMsg based control channel is only supported under FreeRTOS on i.MX 8M Mini EVK. This application contains several use cases that can be started and stopped via the Harpoon Linux user space application, namely harpoon_ctrl/ harpoon_ctrl_rpmsg.
HRPNUG NXP Semiconductors Harpoon User's Guide The configuration file is stored under /etc/harpoon/harpoon.conf and the harpoon systemd service uses it to start Jailhouse and the industrial application: # systemctl start harpoon Once the harpoon service has been started, harpoon_ctrl/harpoon_ctrl_rpmsg is used to start or stop the industrial features with optional parameters.
HRPNUG NXP Semiconductors Harpoon User's Guide Type this command to start receiving CAN FD data on board B: # harpoon_ctrl can -n 1 -r 2 Type this command on board A to start transferring data: # harpoon_ctrl can -n 0 -r 2 4.4.3.2 Ethernet through MCUXpresso SDK API...
HRPNUG NXP Semiconductors Harpoon User's Guide INFO: ethernet_sdk_enet_run : PHY setup was finalized INFO: ethernet_sdk_enet_run : 30 frames ----> will be sent in 3 queues, and frames will be received in 3 queues. INFO: ethernet_sdk_enet_run : The frames transmitted from the...
Page 32
HRPNUG NXP Semiconductors Harpoon User's Guide 4.4.3.3.2 Setup preparation One of the TSN endpoint needs to be configured as “controller” and the other one as “IO device”. Both endpoints are connected to the TSN bridge. 4.4.3.3.2.1 i.MX RT1170 TSN Endpoint - IO Device (Optional) If using an i.MX RT1170 as the IO device, first flash the latest GenAVB/TSN Endpoint...
Page 33
HRPNUG NXP Semiconductors Harpoon User's Guide • Pdelay (propagation delay), Link status, AS capability and Port Role are printed for each port. Port(0): domain(0, 0): Role: Master Link: Up asCapable: Yes neighborGptpCapable: Yes delayMechanism: P2P Port(0): Propagation delay (ns): 334.29...
Page 34
HRPNUG NXP Semiconductors Harpoon User's Guide INIT 0.000000000 stack-freertos hw_timer_register : hw_timer(C06000C8) of clock id: 1 registered INIT 0.000000000 stack-freertos hw_timer_register : hw_timer(C0600110) of clock id: 1 registered INFO 0.000000000 stack-freertos hw_avb_timer_register_device : dev(C06003D0) , ref clock 24000000 Hz, min delay cycles 240 INFO 0.000000000 stack-freertos...
HRPNUG NXP Semiconductors Harpoon User's Guide To stop the Ethernet use case (to eventually restart it), the previous run must be stopped with the following command: # harpoon_ctrl ethernet -s 4.5 rt_latency application The rt_latency application is a simple benchmark application for real-time OS that...
Page 43
HRPNUG NXP Semiconductors Harpoon User's Guide Once the Harpoon service has been started, the following rt_latency trace is shown in the terminal emulator connected to the other serial port: Harpoon v2.1.0 main_task: running After booting, the rt_latency application waits for commands to be received.
HRPNUG NXP Semiconductors Harpoon User's Guide are required to build FreeRTOS based applications and repositories zephyr hal_nxp are required to build Zephyr based applications. Additionally, repository GenAVB_TSN is needed to build the industrial application. The west tool is used to fetch those repositories, along with harpoon-apps Git tree.
HRPNUG NXP Semiconductors Harpoon User's Guide • RTOS_APP is audio, industrial or rt_latency. • BOARD is evkmimx8mm for i.MX 8M Mini, evkmimx8mn for i.MX 8M Nano, evkmimx8mp for i.MX 8M Plus. • Build artefacts are available in the directory ddr_release/.
HRPNUG NXP Semiconductors Harpoon User's Guide When the toolchain is installed, different cross-compile variables must be set. This is done by sourcing script environment-setup-cortexa53-crypto-poky-linux. For example with default installation path: $ . /opt/fsl-imx-xwayland/5.15-kirkstone/environment-setup- armv8a-poky-linux The Harpoon control application can then be built: $ cd harpoon-apps/ctrl $ ./build_ctrl.sh...
HRPNUG NXP Semiconductors Harpoon User's Guide The DAC and ADC on the HiFiBerry card are controlled by the audio application. Control is done through I2C3 and data throughput through SAI5. 6.4.2 Source file creation This chapter gives some information on how to develop an application for Harpoon by using the audio application as an example.
HRPNUG NXP Semiconductors Harpoon User's Guide Table 11. Board specific code ...continued app_mmu.h Device memory to map with MMU (includes SAI and I2C). sai_clock_ Configuration of Audio PLLs, Audiomix (for i.MX 8M Plus) and SAI clocks. config.c Define configuration of each SAI instance.
HRPNUG NXP Semiconductors Harpoon User's Guide 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
NXP Semiconductors. In the event that customer uses the product for design-in and use in In no event shall NXP Semiconductors be liable for any indirect, incidental, automotive applications to automotive specifications and standards, punitive, special or consequential damages (including - without limitation - customer (a) shall use the product without NXP Semiconductors’...
Need help?
Do you have a question about the HRPNUG and is the answer not in the manual?
Questions and answers