RT1170 AVB fresh tasting
1 Abstract
AVB (Audio Video Bridging) is the audio and video bridging technology. AVB is also a time-sensitive network. It is mainly used to solve audio and video transmission problems within the local area network: delay problems and synchronization problems.
AVB consists of a series of IEEE standards aimed at efficiently transmitting audio and video data in a local area network. The protocol of AVB is as follows:
Fig 1
AVB is mainly a link layer protocol and coexists with the traditional TCP/IP protocol.
AVB related protocols include:
gPTP (IEEE 802.1AS-2020): Precision time synchronization protocol
AVTP (IEEE 1722-2016): Audio and video transmission protocol
FQTSS (IEEE 802.1Q-2018, section 34): Credit Based Shaper protocol
SRP (IEEE 802.1Q-2018, section 35) :Stream Reservation Protocol
AVDECC (IEEE 1722.1-2013): Audio and video management protocol
EST (IEEE 802.1Qbv-2015)
FP (IEEE 802.3br-2016/IEEE 802.1Qbu-2016)
The topology diagram of AVB is as follows:
Fig 2
End Station:Listener andTalker
Listener: Node that accepts audio and video data
Talker: Node that outputs audio and video data
AV Bridge:AVB bridge
The purpose of this article is not to talk about the AVB protocol. As a first-time experience of AVB with RT1170, it mainly explains how to use the officially provided AVB/TSN protocol stack to implement the AVB audio data transmission function on the NXP MIMXRT1170-EVK board.。
2 .RT1170 AVB testing
2.1 Hardware prepare
2*MIMXRT1170-EVK REV C4,one is Talker,another is Listener.
Pin modification: remove R228, R234, R232, R229 resistor
Board default configuration:
J27:1-2
J5,J6,J7,J8:short connect
J38:5-6
SW1: 1-OFF,2-OFF,3-ON,4-OFF
SW2: 1-OFF,2-OFF,3-OFF,4-OFF,5-OFF,6-OFF,7-OFF,8-OFF,9-OFF,10-OFF
J11: code downloading and vcom port
J4 : 1G ENET, used for AVB communication
Fig 3
2.2 Software tool prepare
2.2.1 Related code
SDK_2_13_0_MIMXRT1170-EVK:
https://mcuxpresso.nxp.com/en/builder?hw=MIMXRT1170-EVK&rel=667
Download the corresponding SDK according to the system which you need to use (windows/linux). For example, download the Linux version for Linux, and download the windows version for windows. This article takes the Linux compilation system as an example, so download the SDK Linux version.
genavb_tsn-mcuxpresso-SDK_2_13_0-5_6_0.zip:
https://mcuxpresso.nxp.com/en/dashboard?download=84124a72b3f5916f99168a06ef287f2f
genavb_tsn-mcuxpresso-SDK_2_13_0-5_6_0 file includes:
Fig 4
Binaries:include RT1170 AVB/TSN bin file, RT1050 AVB bin file.
Doc:AVB/TSN stack related document, very important, recommend to read it at first.
Genavb-apps-freertos-5_6_0:GenAVB/TSN app examples
genavb-sdk –5_6_0.tar.gz GenAVB/TSN SDK supported configuration and device
.patch:GenAVB/TSN patch to RT1170,RT1050 SDK
2.2.2 Related software tool
Linux platform
CMake (>= 3.10.2, tested with 3.16.3)
make
unzip
patch
Windows platform
CMake (>= 3.10, tested with 3.22.1)
minGW-w64 (tested with 4.3.5)
7zip
Git with git bash (necessary for patch utility)
This document use the linux ubuntu platform, the software version is:
Fig 5
A small experience sharing, as the used Ubuntu version is lower, then the installed cmake version
is also low, when install the cmake 3.16.3, meet some issues, here share the experience:
At first, download cmake-3.16.3-Linux-x86_64.tar.gz:
https://github.com/Kitware/CMake/releases/download/v3.16.3/cmake-3.16.3-Linux-x86_64.tar.gz
unzip cmake-3.16.3-Linux-x86_64.tar.gz to get cmake-3.16.3-Linux-x86_64:
tar -zxvf cmake-3.16.3-Linux-x86_64.tar.gz
Add the linker to /usr/bin/cmake:
sudo ln -s /home/nxa07323/TSN_GENAVB/cmake-3.16.3-Linux-x86_64/bin/cmake /usr/bin/cmake
In /usr/bin/cmake path, use:ls -al, we can see the link information:
Fig 6
After the above operation, use : cmake –version
We can see the cmake version is cmake 3.16.3, which Fig 5 shows.
2.2.2 Code configuration
To build the AVB code, it also needs to use the RT1170 SDK, the steps are:
Unzip genavb_tsn-mcuxpresso-SDK_2_13_0-5_6_0.zip and SDK_2_13_0_MIMXRT1170-EVK_linux.zip
Fig 7
Enter SDK_2_13_0_MIMXRT1170-EVK_linux folder path, add
genavb_tsn-mcuxpresso-SDK_2_13_0-5_6_0/ mcuxpresso-sdk-SDK_2_13_0_MIMXRT1170-EVK-5_6_0.patch
Patch add commander is:
$ patch -p1 < path/to/mcuxpresso-sdk-SDK_2_13_0_MIMXRT1170-EVK-5_6_0.patch
The real operation command is:
patch -p1 < /home/nxa07323/avbdoc/genavb_tsn-mcuxpresso-SDK_2_13_0-5_6_0/mcuxpresso-sdk-SDK_2_13_0_MIMXRT1170-EVK-5_6_0.patch
Fig 8
Add the linker for the SDK and AVB SDK, the structure is:
genavb-apps-freertos-5_6_0
├── boards
│ ├── evkbimxrt1050
│ │ ├── demo_apps
│ │ └── mcu-sdk -> /path/to/SDK_2_13_0_EVKB-IMXRT1050 (required for RT1052)
│ ├── evkmimxrt1170
│ │ ├── demo_apps
│ │ └── mcu-sdk -> /path/to/SDK_2_13_0_MIMXRT1170-EVK (required for RT1176)
│ └── src
│ └── demo_apps
└── gen_avb -> /path/to/genavb-sdk-5_6_0
To the RT1170, it contains 2 link:
1)Add the SDK path for the avb sdk board level
$ cd path/to/genavb-apps-freertos-5_6_0/boards/evkmimxrt1170
$ ln -s path/to/SDK_2_13_0_MIMXRT1170-EVK mcu-sdk
The used situation:
For path /home/nxa07323/avbdoc/genavb_tsn-mcuxpresso-SDK_2_13_0-5_6_0/genavb-apps-freertos-5_6_0/boards/evkmimxrt1170
It needs to add the SDK path link: /home/nxa07323/avbdoc/SDK_2_13_0_MIMXRT1170-EVK_linux
Firstly, unzip the genavb-apps-freertos-5_6_0.tar.gz:
tar -zxvf genavb-apps-freertos-5_6_0.tar.gz
Fig 9
The commander is:
cd /home/nxa07323/avbdoc/genavb_tsn-mcuxpresso-SDK_2_13_0-5_6_0/genavb-apps-freertos-5_6_0/boards/evkmimxrt1170
ln -s /home/nxa07323/avbdoc/SDK_2_13_0_MIMXRT1170-EVK_linux mcu-sdk
Fig 10
We can see, in the path genavb_tsn-mcuxpresso-SDK_2_13_0-5_6_0/genavb-apps-freertos-5_6_0/boards/evkmimxrt1170, already add the SDK path with link, the name is: mcu-sdk.
2)Add the GENAVB/TSN SDK path link to AVB app top level
$ cd path/to/genavb-apps-freertos-5_6_0/
$ ln -s path/to/genavb-sdk-5_6_0 gen_avb
To /home/nxa07323/avbdoc/genavb_tsn-mcuxpresso-SDK_2_13_0-5_6_0/genavb-apps-freertos-5_6_0/
Add the AVB SDK path link:/home/nxa07323/avbdoc/SDK_2_13_0_MIMXRT1170-EVK_linux
Unzip genavb-sdk-5_6_0.tar.gz:
tar -zxvf genavb-sdk-5_6_0.tar.gz
Fig 11
Link commander:
cd /home/nxa07323/avbdoc/genavb_tsn-mcuxpresso-SDK_2_13_0-5_6_0/genavb-apps-freertos-5_6_0
ln -s /home/nxa07323/avbdoc/genavb_tsn-mcuxpresso-SDK_2_13_0-5_6_0/genavb-sdk-5_6_0 gen_avb
Fig 12
We can see, /home/nxa07323/avbdoc/genavb_tsn-mcuxpresso-SDK_2_13_0-5_6_0/genavb-apps-freertos-5_6_0 path link also added, the name is gen_avb.
2.3 code build
The build file path:
genavb_tsn-mcuxpresso-SDK_2_13_0-5_6_0/genavb-apps-freertos-5_6_0/boards/evkmimxrt1170/demo_apps/avb_tsn/avb_audio_app/armgcc
use build_release.sh file for the linux version.
Commander:
./build_release.sh
Fig 13
Result:
Fig 14
We can see, the avb_app.bin already be generated.
File path:
/home/nxa07323/avbdoc/genavb_tsn-mcuxpresso-SDK_2_13_0-5_6_0/genavb-apps-freertos-5_6_0/boards/evkmimxrt1170/demo_apps/avb_tsn/avb_audio_app/armgcc/release
Open avb_app.bin file:
Fig 15
We can see, the generated bin file’s RT1170 QSPI FCB.
2.4 Code programming
2.4.1 MSD downloading method
By referring the doc: genavb_tsn-mcuxpresso-SDK_2_13_0-5_6_0\doc\NXP_GenAVB_TSN_Stack_FreeRTOS_Eval_User_s_Guide-5_6_rev0.pdf,
It is recommended to use the MSD method and directly copy app_avb.bin to the MSD of EVK. However, in the actual test, since there is no information for successful burning progress after copying, it is easy to cause problems. For example, after copying the bin file to the MSD disk (it seems that the copy has been completed), reset or power off the board, but the burning has not actually been completed. At this time, there will be a problem that the code has not been successfully burned, and AVB cannot be successfully run. Therefore, if you use the MSD method, after copying to the MSD, it is best to wait for a period of time to ensure that the code is successfully burned, such as 30s.
Fig 16
However, after many tests, the MSD method cannot perform chip mass erase. For example, some filesystem configurations of AVB have been made, but the code needs to be re-downloaded for reconfiguration. It is found that even if app_avb.bin is burned again, the previous AVB configuration is still exists, so if you need a new system file configuration, it is recommended to perform a full chip erase first and then use this method to burn, or directly use the serial download mode to burn.
In addition, some customers may update EVK's opensda version, and sometimes the updated opensda may not have MSD. In this way, it is also recommended to use the following serial download MCUBootutility method to burn.
2.4.2 MCUBootutility downloading method
At first, EVK enter the serial download mode:
SW1:1-OFF,2-OFF,3-OFF,4-ON
Use two USB cable to connect the J11 and J20 SDP, then power off and power on the board or reset the board to enter the serial download mode.
MCUBootutility tool download link:
https://github.com/JayHeng/NXP-MCUBootUtility/releases/tag/v5.3.0
Tool related document:
https://github.com/JayHeng/NXP-MCUBootUtility
Use the generated avb_app.bin file, and burn it to the MIMXRT1170-EVK board:
Fig 17
It should be noted here that from Figure 15 you can see that the bin file stores the FCB starting from 0, but for the MIMXRT1170 chip, the FCB storage is offset by 0X400, so the burning position of avb_app.bin needs to start from 0X30000400. Follow the 7-steps in Figure 17 to burn the bin file.
After burning in this way, change SW1 of EVK to: 1-OFF, 2-OFF, 3-ON, 4-OFF, which is the internal boot mode.
AVB testing requires two MIMXRT1170-EVK development boards. The codes burned on the two boards are the same, avb_app.bin is burned in both.
After restarting and testing, you will find that the old filesystem has also been cleared. At this time, you can configure a new system file again.
2.5 talker listener configuration
Two MIMXRT1170-EVK board, one as AVB Talker, another as AVB Listener.
Because the programmed app is the same, then just need to use the filesystem to configure which EVK is talker, which is listener.
This document use 2 EVK, and with the back-to-back method, the connection is:
Fig 18
Talker: collect the Mic audio data, then transfer to the Listener through the AVB network
Listener:receive the talker audio data, play the talker mic audio data through Audio Out J33
2.5.1 Talker filesystem configuration
Talker related configuration commander is:
----------------------------------------
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
-----------------------------------------------
The description for the talker configuration:
avb_app/mclock_role=0, Media Clock Master.
avdecc/btb_mode=0, avdecc back-to-back mode
fgptp/gmCapable=1,gPTP grand master
port0/hw_addr=00:22:33:44:55:66, configure the hardware address
For hw_addr, it should be noted that the first byte must be 00. The author previously configured it as 11, but the communication was always unsuccessful.
Through EVK's J11 serial port configuration, after powering on, you can see that the terminal prints a lot of data. First, you need to enter the shell and press the ISERT key. At this time, the terminal will appear >>. For specific shell commands, you can view the documentation:
NXP_GenAVB_TSN_Stack_FreeRTOS_Eval_User_s_Guide-5_6_rev0.pdf,
Chapter 6.1.1 Filesystem commands
The mainly used commander is:
write: write a file with a given string
cat: print the content of a file
ls: list all files and directories in the current directory
rm: remove a file or a directory (if it is empty)
cd: change directory
pwd: print working directory
mkdir: create a directory
The following picture is for the shell entry and the file system configuration:
Fig 19
According to the Talker command mentioned above, configure the talker file system:
Fig 20
Until now, the talker filesystem is configured.
2.5.2 Listener filesystem configuration
Listener related commander is:
-------------------------------
cd ..
ls
mkdir avb_app
write avb_app/mclock_role 1
mkdir avdecc
write avdecc/btb_mode 1
write avdecc/talker_id 0x00049f4455660000
------------------------------------------
The description for the listener configuration:
avb_app/mclock_role =1, Media Clock Slave.
avdecc/btb_mode=1, avdecc fast-connect back-to-back mode
avdecc/talker_id =0x00049f4455660000,for fast connect mode configure the talker entity id。
Entity id configuration rule is:
eui[0] = 0x00;
eui[1] = 0x04;
eui[2] = 0x9f;
eui[3] = mac_addr[3];
eui[4] = mac_addr[4];
eui[5] = mac_addr[5];
eui[6] = 0x00;
eui[7] = 0x00;
mac_addr is determined by the hw_addr, eg, talker configure the hw_addr to:
00:22:33:44:55:66, this is the mac_addr[0-5]
Then talker_id:
eui[0] = 0x00;
eui[1] = 0x04;
eui[2] = 0x9f;
eui[3] = mac_addr[3]=44;
eui[4] = mac_addr[4]=55;
eui[5] = mac_addr[5]=66;
eui[6] = 0x00;
eui[7] = 0x00;
talker_id =0x00049f4455660000。
Next, configure the Listener file system:
Press the computer's insert button to enter shell mode, and then do the filesystem configuration commander input:
Fig 21
Until now, the Listener filesystem configuration is finished.
2.6 Test Result
Let's start the connection test. Find a network cable to connect two MIMXRT1170-EVK boards, which is the 1G network port J4 of the Talker and the listener. Listener's J33 is inserted into the earphone to listen to the microphone audio data sent from the talker board.
Connection picture is as follows:
Fig 22
The test result is, when two board power on, after the short time sync, the audio sound collected from the Talker microphone can be heard in the Listener's headphones, indicating that the RT1170 AVB communication is working.
Partial log diagrams are given below. The complete logs of talker and listener can be viewed in the attachment.
Fig 23
Fig 24
Fig 25
Fig 26
3.Summarization
After several testing, we can realize the RT1170 AVB audio transfer function. If the customer don’t want to build the project, just want to do the simple testing, they also can use the AVB/TSN stack’s generated bin file, the path is:
\genavb_tsn-mcuxpresso-SDK_2_13_0-5_6_0\binaries\genavb-avb_audio_app-evaluation-freertos_rt1176-5_6_0.tar\genavb-avb_audio_app-evaluation-freertos_rt1176-5_6_0\release\ avb_app.bin
This document is just the AVB tasting, for the deeper knowledge, will learn and share it later.
Meet issues during the testing:
1). The cmake install during the linux build, which can be found from chapter 2.2.2 Related software tool
2). The printf log is messing, in Tera Term, use the 115200 baudrate to printf, the default printf log is miss order, it is difficult to the detail content, just like this:
Fig 27
Solution:
Fig 28
Fig 29
After the above configuration, we can see the log is in order.
3). Board programming, at first use the MSD to download the code, but didn’t wait the 30s, then do the power off or the reset, it always causes MSD burning failure, and the generated avb_app.bin , didn’t find the FCB location is not do the 0x400 offset when use the mcubootutility,
It also meet issues. So when use the mcubootutility, need to burn from 0x30000400, please refer to chapter 2.4 Code programming
4). Talker filesystem configuration for port0/hw_addr, the first bytes should be 0X00, if none 0, it will have the AVB communication issues, after modify the first byte to the 0X00 in hw_addr, the issue is solved.
記事全体を表示