5G OpenAir first run

version: update July, 23rd 2020

Tutorial to run 5G OpenAir, from current develop branch.

OAI 5G is very partial, only a fixed scheduler, for one UE, no network entry (no radio network entry, no upper layers network entry).

We can use “phy-test” mode, that hard code a permanent UL and DL shared channel (means a data channel dedicated to one UE in 3GPP jargon).

Of course there is no core network in this very special “phy-test” mode and some upper layer pieces are still 4G (PDCP for example).

Please read the 4G tutorial for more information on how to make initial installation of OpenAir.

Then, you can compile and run 5G tests

To compile:

./build_oai --gNB --nrUE

Run the gNB in one windows

sudo ./nr-softmodem -O ../../../ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf --parallel-config PARALLEL_SINGLE_THREAD --rfsim --phy-test --rfsimulator.serveraddr server --noS1 -d

If you use the same machine for the UE, we have the same IP address problem as in 4G (see our post rf-simulator-and-oai-ue-tutorial)

so, create a new Linux namespace as in this tutorial

In the namespace, run

sudo ./nr-uesoftmodem -d --rrc_config_path . --nokrnmod --phy-test --rfsim --rfsimulator.serveraddr --noS1

If it runs fine, you should see this graph:

If the graph doesn’t show working PDSCH, restart the UE as there is a random bug in UE initial synchronization.

Then, open one more text window and set it in the UE network name space

sudo ip netns exec ueNameSpace bash

It is now possible to ping the gNB output interface

ping -I oaitun_ue1 -s 1000

Sends in both directions packets of 1000 bytes.

Ping also checks the packet content is the same.

What is today available on top of this simple tutorial:

  • If you make IP routing configuration, any IP traffic can get through the pair UE+gNB
  • if you run the UE on another machine, it is also fine (no need of network namespaces)
  • Ettus RF board may also work, if the machine is fast enough

31 thoughts on “5G OpenAir first run”

  1. Hi Laurent,

    I have this setup working over the air with 2 x300s, I few things I see and would like to improve:

    1. When using ssh interface, I can have synchronization between nrUE and gNB. But when using the ubuntu terminal I can see I have performance issues, Underuns and Lates. I followed your suggestions on how to improve real time and every thing seems ok but still issues using the ubuntu terminal with and without the scope (-d). Obviously, it performs better without the scope but after few seconds I got performance issues anyway. I rather use the ubuntu terminal and able to use scope because I will be able show the channels decoding instead SSH with no scope option.

    2. I would like to modify the code so the system can recover after PBCH decoding fail 100 times. I tried to modify the exit_fun to check for only PBCH fail to decode 100 times and set the oai_exit flag back to “0” and create a new UE_thread to start sync and processing threads but I have many issues.
    Could you please provide a brief guidance on how to handle the pool of threads (I can see you are its author) and creating new UE_thread after PBCH failure 100 times? I thought using the abort and delete functions for those old threads before setting the oai_exit flag “0” and creating the new UE_thread, please advice.

    Thank you so much for your help .


    1. Hi,

      I’ve wrote some documentation on the thread pool in: $OPENAIR_DIR/common/utils/threadPool/thread-pool.md

      For the real time questions, direct display in a “tty” is an issue because the real time process depends on the Xwindow server
      So, for example, lauch the process with ‘nohup xxxx > /tmp/myTrace.txt’,
      then if you want to see the trace in real time, do tail -f /tmp/myTrace


      1. Thanks you,

        I did what you suggested with nohup command but still got U and Ls. I decided to double check URSP performance using the benchmark_rate, setting the clock_master 184.32 MHz and rate 61.44MHz for almost 10 min and did not get any performance issues. I may be missing something as using SSH it works with no issues and using both nohup or ubuntu terminal “TTY” I got U and Ls with or without -d option.

        1. Hi Julian,

          I’m not surprised: I tried OAI 5G with recent computer (i7-9900K, fastest double channel memory, …) and X310 boards about 6 month ago.
          The gNB was failing quickly as yours.
          There was a UHD bug: massage “poke32”, nevertheless the computer was not catching real time.
          As you, the UHD benchmark was running well.
          The CPU was not highly loaded.
          with Linux tool “stress-ng” I figured out the memory bus (RAM access) was overloaded.
          I stopped testing on X3100 or N300 for 6 months.
          Please report in the OAI mailing list: I think the problem for everybody.

  2. Hi laurent,
    I am very interested in your work.I want to know whether these precedures can preocess in ubuntu18.04(Linux version 4.15.0-99-lowlatency (buildd@lcy01-amd64-013) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #100-Ubuntu SMP PREEMPT Wed Apr 22 21:10:38 UTC 2020
    ) or in container in the future.Everytime,I have to install new dependency in a new computer that will cause many new issues.

    1. Hi,
      Yes it can, nevertheless we have no planning to deliver ready to use virtual machine images.

      1. Dear laurent,
        I have finished OAI first run according to your blog and OAI website guide and got the same graph like aforeshowed.However,I can not find more detais about the explanation about x axis and y axis on this graph.Can you explain offer more deatils especially the unit of X axis and Y axis on this graph.
        Thany you in andvance!
        Best Regards

  3. Dear Laurent,

    I followed your tutorial to build up nr-softmodem and nr-uesoftmodem recently. Could I ask you some questions?

    The below is what reply I can see after gNB and UE are connected:

    [PHY] —— PBCH ChannelComp/LLR: frame.slot 58.0 ——
    [MAC] [L2][MAC] decode mib
    [RRC] MIB PDU : 95
    [RRC] MIB PDU : 246
    [RRC] MIB PDU : 6
    [MAC] <<<<<<<<<index_4msb 12 num_rbs 48 num_symb 1 rb_offset 16
    [PHY] start adjust sync slot = 0 no timing 0
    [PHY] Decoded frame index (762) is not compatible with current context (58), UE should go back to synch mode
    [PHY] ****** start TX-Chain for AbsSubframe 762.8 ******
    [PHY] ****** end TX-Chain for AbsSubframe 762.8 ******
    [HW] UEsock: 85 gap of: 17536 in reception
    [HW] UEsock: 85 gap of: 17536 in reception
    [PHY] SET rx_offset 614382
    [PHY] ****** start TX-Chain for AbsSubframe 763.8 ******
    [PHY] ****** end TX-Chain for AbsSubframe 763.8 ******
    [HW] UEsock: 85 gap of: 17536 in reception
    [HW] UEsock: 85 gap of: 17536 in reception

    We only can receive MIB in this branch? the RA, RAR and other procedures won't do?

    And I can't ping and iperf UE or gNB each other from different host, but if I create the namespace to run UE then I can ping and iperf, I don't know why?
    The steps I follow to create namespace:

    ip netns delete ueNameSpace
    ip link delete v-eth1
    ip netns add ueNameSpace
    ip link add v-eth1 type veth peer name v-ue1
    ip link set v-ue1 netns ueNameSpace
    ip addr add dev v-eth1
    ip link set v-eth1 up
    iptables -t nat -A POSTROUTING -s -o enp0s31f6 -j MASQUERADE
    iptables -A FORWARD -i enp0s31f6 -o v-eth1 -j ACCEPT
    iptables -A FORWARD -o enp0s31f6 -i v-eth1 -j ACCEPT
    ip netns exec ueNameSpace ip link set dev lo up
    ip netns exec ueNameSpace ip addr add dev v-ue1
    ip netns exec ueNameSpace ip link set v-ue1 up

    I am just learn it so I am not clearly understand what its function. Could you help me?

    Best regards,

    1. Dear Tony,

      RA,RAR, …: are not yet in this branch called “develop”

      Network namespace: we need a network namespace because the gNB in this mode acts as a core network (a 5GC, a EPC, …) so it tells to “internet” it is the UE (it pretend the UE IP address is in the 5GC/EPC).
      The same design exists in 4G: the UE IP address is routed by the UE and by the P-GW (the SGi interface)
      So, if we run both in the same machine, we need to isolate the two interfaces that routes the same IP address.
      This GTP tunnel is there to hide to internet the UE mobility. IP protocol is not mobile, so GTP (3GPP), mobile IP (IETF) are tunelling data.


  4. Dear Tony, Laurent:

    Can you pls mention the commit ID in which ping works in the 5G NR, rfsimulator setup?

    This is what we got :
    Version from May 15, the UE works and is able to connect to the gNB.

    What is the issue:
    In the UE, we don’t get the oai network interface up.So ping, etc. does not work.

  5. Dear Laurent,

    Thanks for putting up this info. Appreciate it.

    We are trying to bring up the 5G NR code base in a single machine and we are able connect, but unable to ping.

    Can you provide the commit ID’s we need to use on the UE and the gNB side?
    Rgds, Ashok

    1. Dear Ashok,

      It should work with latest develop commit.
      Let me know the error details if you need more help


  6. Dear,laurent
    I have finished the OAI first run work according to the OAI gitlab guider and your blog.So,i have got the same graph like aforeshowed.However,I find these parameters are hard to comprehend in this graph .Becase I can not find any detail description about x axis and y axis on this paragraph.Can you offer more details about this graph especially the explanation of x and y axis.
    Thany you in advance!

    1. Hi,
      X/Y axis per graph:
      received signal: x=sample(time) y=log(power)
      channel impluse: x=time y=power
      channel freq= x=frequency y=power
      all llr graphs: x=array of bits received in the channel, y=softbit (probability it is 0 or 1)
      I/Q graphs: x and y represent the real and the imaginary parts of the demodulated sample

  7. Dear team,
    According to the gitlab website guide and this blog,I have finished the work OAI rfsimulator successfully and got the graph of NR DL SCOPE UE.However,I don not find the source code which plot the graph.Furthermore,where is the source code related with field measurements like Synchronization Signal and DM-RS.I need your help.Thank your very munch.
    Best Regards,

    1. Dear Peter,

      The scope source is in: openair1/PHY/TOOLS/nr_phy_scope.c

      I did a lot of modifications in this source that will be in next commit in develop branch.

      It will also make the gNB scope working.

      More will come in one more merge, then the new code structure will be in place (by end of this month).


    2. Hi Laurent,

      Thanks for the post, I have given it a try and got the following error, it basically cannot find the reconfig.raw in the current directory (build directory).
      Do I need to compile the nrUE with -P?

      The command for running:
      ~/oai-dev/cmake_targets/ran_build/build> sudo ./nr-uesoftmodem -d –rrc_config_path . –nokrnmod –phy-test –rfsim –rfsimulator.serveraddr

      If I specify the reconfig.raw path as
      sudo ./nr-uesoftmodem -d –rrc_config_path /home/oai-dev/openair1/SIMULATION/NR_PHY –nokrnmod –phy-test –rfsim –rfsimulator.serveraddr
      It fails in finding the rbconfig.raw this time which I do not know where it is?

      Assertion (fd) failed!
      In openair_rrc_top_init_ue_nr() /home/oai-dev/openair2/RRC/NR_UE/rrc_UE.c:336
      cannot read file ./reconfig.raw: errno 2, No such file or directory

      Assertion (fd) failed!
      In openair_rrc_top_init_ue_nr() /home/oai-dev/openair2/RRC/NR_UE/rrc_UE.c:349
      cannot read file /home/gnb1/oai-dev/openair1/SIMULATION/NR_PHY/rbconfig.raw: errno 2, No such file or directory


      1. Hi Ari,

        These files are made by the nr-softmodem when you start it.
        Whatever the method you use, the nr-uesoftmodem need to find them in the directory pointed by the parameter –rrc_config_path


        1. Thanks, Laurent,
          I ran gNB and UE in different machines and that was the problem.
          I need to copy those files into the UE machine after running gNB as you suggested.


  8. Hello dear Laurent
    Thanks for your guidance and sharing, I have already successfully built OAI gNB and nrUE on two separate PCs under develop branch
    On the other hand, I took gnb.band78.tm1.106PRB.usrpn300.conf as test example.
    But I was trapped by the problem of PSS synchronous postion when running nrUE. According the message of the terminal, it seemed that the nrUE program is looped at sync step.
    If you are free, would you mind giving me some suggestion or helping me?
    Thanks a lot.
    Attached information:
    (Always loop the below information at nrUE terminal)
    [PHY] Starting sync detection
    [PHY] [UE thread Synch] Running Initial Synch (mode 0)
    [PHY] [UE] nr_synchro_time: Sync source = 2, Peak found at pos 455440, val = 3816661 (66 dB) avg 63 dB, ffo 0.000000
    PSS execution duration 475615 microseconds
    [PHY] [UE0] Initial sync : Estimated PSS position -1, Nid2 2
    [PHY] sync_pos -1 ssb_offset 614255
    [PHY] TDD Normal prefix: SSS error condition: sync_pos -1
    [PHY] [UE] nr_synchro_time: Sync source = 2, Peak found at pos 374440, val = 4278293 (66 dB) avg 63 dB, ffo 0.000000
    PSS execution duration 472482 microseconds
    [PHY] [UE0] Initial sync : Estimated PSS position -1, Nid2 2
    [PHY] sync_pos -1 ssb_offset 614255
    [PHY] TDD Normal prefix: SSS error condition: sync_pos -1
    [PHY] [UE0] Initial sync : Estimated power: 0 dB
    [PHY] [initial_sync] trying carrier off -100 Hz, rxgain 80 (DL 3579999900, UL 3619079900)
    Setting USRP TX Freq 3619079900.000000, RX Freq 3579999900.000000
    [PHY] [SCHED][UE] Check absolute frequency DL 3580000000, UL 3619080000 (oai_exit 0, rx_num_channels 1)

    1. Hi,
      I tested again, with latest develop branch commit.
      please try exactly this:
      cd cmake_targets
      ./build_oai -c -w USRP –nrUE –gNB -g Debug –ninja
      cd ran_build/build
      sudo ./nr-softmodem -O ../../../ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf –parallel-config PARALLEL_SINGLE_THREAD –rfsim –rfsimulator.serveraddr server –noS1 -d –phy-test

      in another window, same machine
      cd openairinterface5g/cmake_targets/ran_build/build
      sudo ./nr-uesoftmodem –rrc_config_path . –nokrnmod –phy-test –rfsim –rfsimulator.serveraddr –noS1 -d –phy-test

      you should get after a couple of seconds the UR synched and the two scope windows showing it decodes channels.

  9. Dear Laurent
    Thanks for the post, I have given it a try with 2 computers and 2 USRP N310,and got the following error when I run gNB with “./nr-softmodem -O ../../../ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf –parallel-config PARALLEL_SINGLE_THREAD –rfsim –phy-test –rfsimulator.serveraddr server”:

    [RRC] Dumping NR_RRCReconfiguration message (302 bytes)
    Error: signal 11:

    If you are free, would you mind giving me some suggestion or helping me?
    In addition, I am a novice Chinese student and I would like to ask if you could share a more detailed tutorial.
    Thank your very munch.

    1. Dear Fuaiyong
      I tried your command line with latest commit in develop branch
      I had to modify the IP addresses in ../../../ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf, then it runs
      [RRC] Dumping NR_RRCReconfiguration message (302 bytes)
      [RRC] Dumping scg_RB_Config message (8 bytes)
      [MAC] [gNB 0] Adding UE with rnti 1234 (next avail 0, num_UEs 0)
      [MAC] gNB 0] Add NR UE_id 0 : rnti 1234
      maybe you changed something else in the configuration file.


  10. Hello again Laurent,

    Sorry to bother, I’d like to see how SIB1 is generated in nr OAI, I have followed the main function in nr-softmodem.c but when dealing with your server threat poll link list I got lost. Could you please point me to the right place where the SIB1 is generated?


    1. Hi Julian,
      There is no relation between SIB generation and the thread pool 😉 isn’t it ?
      So, coming to your actual question:
      I think SIB1 is generated in function do_SIB1_NR()
      this function is never called in nr-softmodem, for the code on “develop” branch.
      So, please ask this question on the OAI mailing list

  11. Thanks,

    Sorry I was talking about the ITTI tasks, not the processing and sync processes. However, you helped me to clarify some other things. I checked the call hierarchy for do_SIB1_NR() function but did not get any results.

    1. I agree, in current code it is never called, so the SIB won’t be sent over the air
      In 5G NSA, SIB is not very usefull

      1. Laurent,

        I think I got lost with your comment about SIB is not very useful, I know that minimum SI is used by a nrUE to camp on a cell and also that the code in the DEVELOP branch is using .raw files so the nrUE can configure itself to be able to initiate sync with the gNB, reason by which MIB and SIB are not needed. am I correct?

        In regards of the NSA, I will have a look at the OAI NSA with COTs UE document where I may assume that in this case the minimum SI is being sent over the air.


        1. Julian,
          3GPP standard is huge and very difficult to catch, nevertheless i think in ENDC or NSA mode, SIB 1 transmission is not required

Leave a Reply to Tony Cancel reply

Your email address will not be published. Required fields are marked *