NR_SA_Tutorial_COTS_UE.md 7.35 KB
Newer Older
1 2 3 4 5 6 7 8 9
<table style="border-collapse: collapse; border: none;">
  <tr style="border-collapse: collapse; border: none;">
    <td style="border-collapse: collapse; border: none;">
      <a href="http://www.openairinterface.org/">
         <img src="./images/oai_final_logo.png" alt="" border=3 height=50 width=150>
         </img>
      </a>
    </td>
    <td style="border-collapse: collapse; border: none; vertical-align: center;">
10
      <b><font size = "5">OAI 5G NR SA tutorial with COTS UE</font></b>
11 12 13 14
    </td>
  </tr>
</table>

15
**Table of Contents**
16

17
[[_TOC_]]
18 19

#  1. Scenario
20
In this tutorial we describe how to configure and run a 5G end-to-end setup with OAI CN5G, OAI gNB and COTS UE.
21 22 23

Minimum hardware requirements:
- Laptop/Desktop/Server for OAI CN5G and OAI gNB
24
    - Operating System: [Ubuntu 24.04 LTS](https://releases.ubuntu.com/24.04/ubuntu-24.04.1-desktop-amd64.iso)
25 26 27 28 29 30
    - CPU: 8 cores x86_64 @ 3.5 GHz
    - RAM: 32 GB
- Laptop for UE
    - Operating System: Microsoft Windows 10 x64
    - CPU: 4 cores x86_64
    - RAM: 8 GB
31
    - Windows driver for Quectel MUST be equal or higher than version **2.4.6**
32 33
- [USRP B210](https://www.ettus.com/all-products/ub210-kit/), [USRP N300](https://www.ettus.com/all-products/USRP-N300/) or [USRP X300](https://www.ettus.com/all-products/x300-kit/)
    - Please identify the network interface(s) on which the USRP is connected and update the gNB configuration file
34 35 36 37 38 39 40 41 42
- Quectel RM500Q
    - Module, M.2 to USB adapter, antennas and SIM card
    - Firmware version of Quectel MUST be equal or higher than **RM500QGLABR11A06M4G**


# 2. OAI CN5G

## 2.1 OAI CN5G pre-requisites

43 44
Please install and configure OAI CN5G as described here:
[OAI CN5G](NR_SA_Tutorial_OAI_CN5G.md)
45 46


47
## 2.2  SIM Card
48
Program UICC/SIM Card with [Open Cells Project](https://open-cells.com/) programming tool [uicc-v3.3](https://open-cells.com/d5138782a8739209ec5760865b1e53b0/uicc-v3.3.tgz).
49 50

```bash
51
sudo ./program_uicc --adm 12345678 --imsi 001010000000001 --isdn 00000001 --acc 0001 --key fec86ba6eb707ed08905757b1bb44b8f --opc C42449363BBAD02B66D16BC975D77CC1 -spn "OpenAirInterface" --authenticate
52 53 54 55 56 57 58 59 60
```


# 3. OAI gNB

## 3.1 OAI gNB pre-requisites

### Build UHD from source
```bash
61
# https://files.ettus.com/manual/page_build_guide.html
62
sudo apt install -y autoconf automake build-essential ccache cmake cpufrequtils doxygen ethtool g++ git inetutils-tools libboost-all-dev libncurses-dev libusb-1.0-0 libusb-1.0-0-dev libusb-dev python3-dev python3-mako python3-numpy python3-requests python3-scipy python3-setuptools python3-ruamel.yaml
63 64 65

git clone https://github.com/EttusResearch/uhd.git ~/uhd
cd ~/uhd
66
git checkout v4.7.0.0
67 68 69 70
cd host
mkdir build
cd build
cmake ../
71
make -j $(nproc)
72 73 74 75 76 77 78 79 80 81 82 83 84 85
make test # This step is optional
sudo make install
sudo ldconfig
sudo uhd_images_downloader
```

## 3.2 Build OAI gNB

```bash
# Get openairinterface5g source code
git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git ~/openairinterface5g
cd ~/openairinterface5g
git checkout develop

86
# Install OAI dependencies
87
cd ~/openairinterface5g/cmake_targets
88 89 90
./build_oai -I

# Build OAI gNB
91
cd ~/openairinterface5g/cmake_targets
92
./build_oai -w USRP --ninja --gNB -C
93 94
```

95
# 4. Run OAI CN5G and OAI gNB
96 97 98 99

## 4.1 Run OAI CN5G

```bash
100 101
cd ~/oai-cn5g
docker compose up -d
102 103 104 105
```

## 4.2 Run OAI gNB

106 107
### USRP B210
```bash
108
cd ~/openairinterface5g/cmake_targets/ran_build/build
109 110 111
sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --sa -E --continuous-tx
```
### USRP N300
112
```bash
113
cd ~/openairinterface5g/cmake_targets/ran_build/build
114
sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.fr1.273PRB.2x2.usrpn300.conf --sa --usrp-tx-thread-config 1
115
```
116

117 118
### USRP X300
```bash
119
cd ~/openairinterface5g/cmake_targets/ran_build/build
120
sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.fr1.273PRB.2x2.usrpn300.conf --sa --usrp-tx-thread-config 1 -E --continuous-tx
121 122
```

123 124
# 5. Run UE
## 5.1 Testing with Quectel RM500Q
125

126
### 5.1.1 Setup Quectel
127 128 129
With [PuTTY](https://the.earth.li/~sgtatham/putty/latest/w64/putty.exe), send the following AT commands to the module using a serial interface (ex: COM2) at 115200 bps:
```bash
# MUST be sent at least once everytime there is a firmware upgrade!
130
AT+CGDCONT=1,"IP","oai"
131 132 133 134 135 136 137 138 139
AT+CGDCONT=2
AT+CGDCONT=3

# (Optional, debug only, AT commands) Activate PDP context, retrieve IP address and test with ping
AT+CGACT=1,1
AT+CGPADDR=1
AT+QPING=1,"openairinterface.org"
```

140
### 5.1.2 Ping test
141 142
- UE host
```bash
143
ping 192.168.70.135 -t -S 12.1.1.2
144 145 146 147 148 149
```
- CN5G host
```bash
docker exec -it oai-ext-dn ping 12.1.1.2
```

150
### 5.1.3 Downlink iPerf test
151 152 153 154 155 156 157 158 159 160
- UE host
    - Download iPerf for Microsoft Windows from [here](https://iperf.fr/download/windows/iperf-2.0.9-win64.zip).
    - Extract to Desktop and run with Command Prompt:
```bash
cd C:\Users\User\Desktop\iPerf\iperf-2.0.9-win64\iperf-2.0.9-win64
iperf -s -u -i 1 -B 12.1.1.2
```

- CN5G host
```bash
161
docker exec -it oai-ext-dn iperf -u -t 86400 -i 1 -fk -B 192.168.70.135 -b 100M -c 12.1.1.2
162
```
163

164 165
# 6. Advanced configurations (optional)

166 167
See also the [dedicated document on performance tuning](./tuning_and_security.md).

168
## 6.1 USRP N300 and X300 Ethernet Tuning
169

170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
Please also refer to the official [USRP Host Performance Tuning Tips and Tricks](https://kb.ettus.com/USRP_Host_Performance_Tuning_Tips_and_Tricks) tuning guide.

The following steps are recommended. Please change the network interface(s) as required. Also, you should have 10Gbps interface(s): if you use two cables, you should have the XG interface. Refer to the [N300 Getting Started Guide](https://kb.ettus.com/USRP_N300/N310/N320/N321_Getting_Started_Guide) for more information.

* Use an MTU of 9000: how to change this depends on the network management tool. In the case of Network Manager, this can be done from the GUI.
* Increase the kernel socket buffer (also done by the USRP driver in OAI)
* Increase Ethernet Ring Buffers: `sudo ethtool -G <ifname> rx 4096 tx 4096`
* Disable hyper-threading in the BIOS (This step is optional)
* Optional: Disable KPTI Protections for Spectre/Meltdown for more performance. **This is a security risk.** Add `mitigations=off nosmt` in your grub config and update grub. (This step is optional)

Example code to run:
```
for ((i=0;i<$(nproc);i++)); do sudo cpufreq-set -c $i -r -g performance; done
sudo sysctl -w net.core.wmem_max=62500000
sudo sysctl -w net.core.rmem_max=62500000
sudo sysctl -w net.core.wmem_default=62500000
sudo sysctl -w net.core.rmem_default=62500000
sudo ethtool -G enp1s0f0 tx 4096 rx 4096
```

## 6.2 Real-time performance workarounds
191
- Enable Performance Mode `sudo cpupower idle-set -D 0`
192
- If you get real-time problems on heavy UL traffic, reduce the maximum UL MCS using an additional command-line switch: `--MACRLCs.[0].ul_max_mcs 14`.
193
- You can also reduce the number of LDPC decoder iterations, which will make the LDPC decoder take less time: `--L1s.[0].max_ldpc_iterations 4`.
194

195
## 6.3 Uplink issues related with noise on the DC carriers
196
- There is noise on the DC carriers on N300 and especially the X300 in UL. To avoid their use or shift them away from the center to use more UL spectrum, use the `--tune-offset <Hz>` command line switch, where `<Hz>` is ideally half the bandwidth, or possibly less.
197 198 199

## 6.4 Lower latency on user plane
- To lower latency on the user plane, you can force the UE to be scheduled constantly in uplink: `--MACRLCs.[0].ulsch_max_frame_inactivity 0` .