
# NB-IoT Testing Guideline
[TOC]
## Environment
- OS: Ubuntu16.04
- eNB: develop-nb-iot (677bbab27b0d1d3ca0ad54e7c32748dc64a0a690)
- EPC: Nokia LTEBox
- UE: Quectel BC95 UE Module
- Configuration File

## Testing Step for NB-IoT eNB
### STEP 1 : Build environment & NB-IoT eNB ==(Ubuntu16.04)==
```bash
### clone the eNB/UE source code
$ git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git
### checkout branch to tag 2020.w03
### (the lte-softmodem we used is in the lte_build_oai file
### which does not exist in the latest develop brnach)
$ cd ~/openairinterface5g
$ git checkout 2020.w03
$ cd ~/openairinterface5g/cmake_targets
### build first time
$ sudo ./build_oai -I
### after build -I change branch to develop-nb-iot
$ git checkout develop-nb-iot
### build NB-IoT eNB
$ sudo ./build_oai -I --eNB -w USRP
```
### STEP 2 : Modify eNB's config file
```bash
$ cp ~/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band28.tm1.25PRB.usrpb210.conf ~/nbiot.conf
```
* eutra_band = 28 ;
* dowlink_frequency = 780000000L ;
* uplink_frequency_offset = -55000000 ;
* MME ip address= "ltebox ipaddress"
* eNB ip address= "your NB-IoT ip address"
### STEP 3 : Run NB-IoT eNB
```shell=
oai@oai:~/openairinterface5g/cmake_targets$ cd lte_build_oai/build
### run the eNB by your config file (e.g. 0409-oai.conf)
oai@oai:~/openairinterface5g/cmake_targets/lte_build_oai/build$ sudo ./lte-softmodem -O ~/nbiot.conf
```
## Testing Step for UE Module (BC95-B28)
### STEP 1 : Install UE Logviewer
### STEP 2 : Install AT COMMAND tool (Q Navigator)
1. Download the Q Navigator.rar file
2. Unzip the file to get the folder then start

3. Set serial port parameter

- port choose the **Main port**
- baudrate is 9600
- databits is 8

4. Disable the 'Automatic initialization' then press the botton as follow

5. Get the UE module information

### STEP 3 : Run UE Logviewer
- Click "**connect**" pop-up dialog box, select the **protocol.bin** file in evk folder, and the log will be automatically showed. (Please note that the module should be powered on before connection.)
- "UE Port Selector" choose the **Debbug port**, and click "connect" & select the protocol.bin file on Uelogviewer
- filter for NB-IoT msg
- RRC_DEBUG_ASN: to see the meaage in RRC layer of UE side
- NAS_DBG_NAD_MSG: to see the meaage in NAS layer of UE side
- RACH: to see the rach procedure in UE side
- there have a lot of messages in UElogviewer, fileter the specific message that you need
### STEP 4 : Run AT COMMAND tool (Q Navigator)
- Press QCOM to go into control page

- Press botton to execute

- AT command used for testing NB-IoT
- **AT+NRB**
Reboot the module
- **AT+NEARFCN=0,9448**
Lock the frequency between UE & eNB
- BC95 AT commands Manual
- Disable scrambling(use **AT+NCONFIG=?** to confirm)
- **AT+NCONFIG=CR_0354_0338_SCRAMBLING,FALSE**
- **AT+NCONFIG:CR_0859_SI_AVOID,FALSE**
*Tips: Use 'save as script' and 'load script' to change different command quickly*
## Testing Result
- Attach Complete

- Ping to 8.8.8.8 from UE

- Ping each other between UE and EPC

- Use UDP socket send data from UE

## Testing Step for UE Module (BC95-G)
> https://hackmd.io/IomG9C49RsuugK1XFIkJ0A?view
## Issue
### PHY Decoding error
- cmake_targets/CMakeLists.txt

The latest commit is already set the NB_IOT_CRC_REVOVERY to TRUE and the eNB can recovery the decoded error uplink message. Modify the NB_IOT_CRC_REVOVERY from True to False for reveaing the issue.