In the previous article, it talked about how to use a single-point RT1170 as a talker and a single-point RT1170 as a listener, and connect the two boards directly to implement AVB endpoint testing. However, in actual use, many applications are multipoint to multipoint, but AVB switch is required. Therefore, based on the previous article, this article adds another listener endpoint and AVB switch to implement an AVB platform with one talker and two listeners.
Fig 1
The AVB switch can be a third-party AVB switch product. Of course, you can also consider using NXP's upcoming new product RT1180. This chip has AVB/TSN switch function, and our RT1180 supporting stack has also been released.
This article will use two AVB switches to do AVB testing: one uses the NXP official MIMXRT1180-EVK as an AVB switch, and the other uses the third-party product MOTU's AVB switch. The endpoints use three NXP MIMXRT1170-EVK boards, one for talker configuration and the other two for listener configuration.
For the configuration of RT1170 as endpoint, that is, talker and listener, you can refer to the previous article:
Here you can directly start quickly, take the avb_app.bin prepared in the stack and burn it directly to MIMXRT1170-EVK for talker and listener configuration. Of course, if there are some customized functions that modify the source code, you can also refer to the above article to recompile, generate the avb_app.bin file and then burn it.
Hardware:
MOTU AVB SWITCH(switch)
MIMXRT1180-EVK*1(switch)
MIMXRT1170-EVK*3(1: talker, 2: listener), hardware need to be modified, refer to the previous document
Software:
RT1170 AVB/TSN stack:
genavb_tsn-mcuxpresso-SDK_2_13_0-5_6_1: https://mcuxpresso.nxp.com/download/52643189c4d74a7b26b8e096ab28df0e
RT1180 AVB/TSN stack:
genavb_tsn-mcuxpresso-SDK_2_15_0-6_0_0 :
https://mcuxpresso.nxp.com/download/c584c33a8d4f55c29b5505b9be8f537a
Directly burn the files in avbstack:
genavb_tsn-mcuxpresso-SDK_2_13_0-5_6_1\binaries\genavb-avb_audio_app-evaluation-freertos_rt1176-5_6_1.tar\genavb-avb_audio_app-evaluation-freertos_rt1176-5_6_1\release\avb_app.bin
to the three MIMXRT1170-EVK development boards and enter the serial download mode to program:
Fig 2
The three boards are burned with the same code. After burning, let the board enter the internal boot mode and configure the talker and listener through the serial port. After the code is burned successfully, the onboard serial port will keep sending log information. You only need to enter INSERT on the keyboard to enter the shell command line state.
cd ..
ls
mkdir avb_app
write avb_app/mclock_role 0
mkdir avdecc
write avdecc/btb_mode 0
mkdir fgptp
write fgptp/gmCapable 1
mkdir port0
write port0/hw_addr 00:22:33:44:55:66
cd ..
ls
mkdir avb_app
write avb_app/mclock_role 1
mkdir avdecc
write avdecc/btb_mode 1
write avdecc/talker_id 0x00049f4455660000
The following are two SWITCH configuration connections:
Use MOTU AVB switch as the AVB switch connection block diagram:
Fig 3
The physical board connections are as follows:
Fig 4
For the dedicated AVB switch, no specific configuration is required, because you can think of it as a switch with AVB function, which can realize the forwarding function of AVB data. You only need to connect the 1G network port of a talker and the 1G network ports of two listeners to the network port of MOTU AVB SWITCH. Then as long as the functions of the talker and the listener are normal, the entire audio transmission can be normal. The talker is responsible for collecting the audio data information of the microphone and then forwarding it to the two listeners for playback. Of course, the two listeners need to be connected to the speakers respectively.
For the configuration of RT1180 AVB switch, there are two methods: quick start and self-compilation. If there is no change in the source code, you can directly use the bin file that comes with the stack. Here you need to pay attention to select the correct bin file. RT1180 has two cores: CM33 and CM7 cores. The CM33 image supports the TSN/AVB bridge function, that is, the switch, and the CM7 image supports the TSN endpoint function.
MIMXRT1180-EVK contains multi-network ports, the situation is:
Fig 5
Fig 6
Therefore, when using the AVB switch network port, you need to pay attention to using ENET0, 1, 2, and 3 ports.
The connection diagram of using MIMXRT1180-EVK as the AVB switch network port is as follows:
Fig 7
The actual connection diagram is as follows:
Fig 8
To implement the RT1180 code, you need to download the RT1180 M33 TSN bridge code to the MIMXRT1180-EVK board. If the source code of the AVB/TSN stack does not need to be modified, you can use the ready-made bin file for testing:
genavb_tsn-mcuxpresso-SDK_2_15_0-6_0_0\binaries\genavb-tsn_app-evaluation-freertos_rt1189_cm33-6_0_0\release\tsn_app.bin
There are many ways to burn, you can use tools or command line methods. The tool can be MCUBootutility or the official SEC tool. Here we choose to use the MCUBootutility tool, download link:
https://github.com/JayHeng/NXP-MCUBootUtility/releases/tag/v6.2.0
If you use the SEC tool to download, you can refer to the stack documentation:
genavb_tsn-mcuxpresso-SDK_2_15_0-6_0_0\doc\ NXP_GenAVB_TSN_MCUXpresso_User_s_Guide_6_0_rev0.pdf, chapter 11 Flash Image booting.
When use the MCUBootutility tool, it needs to do the modification:
\NXP-MCUBootUtility-6.2.0\src\targets\MIMXRT1189 \MIMXRT1189\bltargetconfig.py
Modify:
#flexspiNorMemBase0 = 0x38000000 # CM33 Secure
#flexspiNorMemBase0Ns = 0x28000000 # CM33 Non-Secure
To:
flexspiNorMemBase0 = 0x28000000 # CM33 Non-Secure
flexspiNorMemBase0Ns = 0x38000000 # CM33 Secure
Fig 9
Burn the tsn_app.bin to the RT1180 address 0x2800b000。
Let the MIMXRT1180-EVK board enter serial download mode,SW5:1-OFF,2-OFF,3-OFF,4-ON. Then, find another usb cable to connect J33 to do the code flash downloading. After the code is programmed, need to enter the internal boot mode for QSPI: SW5:1-OFF,2-ON,3-OFF,4-OFF.
This completes the burning of the app with AVB switch function. This code does not need to enter the shell to configure the filesystem like RT1170. For the RT1180 bridge code, after burning, the switch function will be built-in after restarting.
Of course, if you need to recompile your own project, you can directly refer to the stack documentation: NXP_GenAVB_TSN_MCUXpresso_User_s_Guide_6_0_rev0.pdf.
If you use Linux system to compile, the method is the same as RT1170, three steps:
(1) Patch the AVB stack for the RT1180 SDK
(2)add two soft links to the RT1180 AVB stack, one for the board SDK and the other for the AVB SDK source code. The structure is as follows:
Fig 10
(3) At last, build ./ build_release.sh
\genavb_tsn-mcuxpresso-SDK_2_15_0-6_0_0\genavb-apps-freertos-6_0_0.tar\genavb-apps-freertos-6_0_0\boards\evkmimxrt1180\demo_apps\avb_tsn\tsn_app\cm33\armgcc\ build_release.sh
Then, it will generate the according tsn_app.bin file.
I have always wanted to check the AVB network data packets, so I thought of the following method to do it. I also found a general network switch that can package some of the network ports to specific network ports. This method is used here just to check the basic packets. In principle, the general switch does not have the AVB physical layer function, so it should have some impact on the synchronization function. However, due to the limitation of the equipment, this article only has a basic understanding of the AVB data packet structure.
Prepare a switch with port mirror function: NETGERA plus switch ProSAFE GS105E.
Then configure the switch to mirror the data of ports 2 and 3 to port 1:
Fig 11
Then the entire AVB system connection diagram is as follows:
Fig 12
The physical connection diagram is as follows:
Fig 13
Open the entire system platform and let the system function run, that is, the talker endpoint has sound input and the amplifiers of the two listener endpoints have output. Open the wireshark software on the PC and capture the packets. The captured situation is as follows:
Fig 14
As you can see, there are many AVTP packets, and there are two destination addresses.
To analyze AVTP packets, you must first know what the standard AVTP packets are like. The standard packets have the following structure:
Fig 15
Next, open the wireshark software, configure the network port to be captured, and compare the captured data packets:
Fig 16
As you can see, the whole packet is basically captured, but the details, such as VLAN tag and IEC 61883 header, are not present. This is probably caused by the physical layer of ordinary switches cannot support AVB. However, the audio data above can still be seen, and it is indeed dual-channel, but the data is only transmitted through one channel. Therefore, for the RT1170 listener, although a dual-channel speaker is connected, the two speakers correspond to the left and right channels, but when listening, only one speaker channel has sound, and the other has no sound. This is consistent with the captured data packet. The source of this is that the stack code uses one channel for microphone acquisition, and although the audio is configured with two channels, there is actually only one channel with data.
So far, the architecture and test of the AVB switch&endpoint platform have been realized.
The test effect can be viewed in the video.