Commit Graph
96 Commits
Author SHA1 Message Date
Sakthivel Velumani b987b033d5 test: include slot functions to frame parms ctest 2025-12-10 23:40:39 +00:00
Sakthivel Velumani c9902a8615 bugfix: length of first slot for numerology 0
For 15kHz SCS, symbols with index 0 and 7 have longer cyclic prefix.
This is now fixed in frame parms struct.
2025-12-10 23:26:03 +00:00
Sakthivel Velumani 5b92859cce phy: remove function pointers in frame param
1. Removed function pointers for functions get_samples_per_slot(),
   get_samples_slot_timestamp() and get_slot_from_timestamp() as it does
   not offer any advantage. The functions are now called directly from
   everywhere.
2. Optimized these functions by removing loops where ever possible.
2025-12-10 23:25:24 +00:00
Sakthivel Velumani 7807016ae6 pdcch: return pdcch processing is no ss configured 2025-10-21 12:03:02 +02:00
Sakthivel Velumani ae690217dd Clean-up nr_slot_fep
1.Create new funtion nr_symbol_fep() to do OFDM demod of one symbol on
  all antennas. This is called by nr_slot_fep() for now. In the
  upcoming MR, this function will be called directly after reading
  each OFDM symbol from the radio.

2.Removed redundant memory alignment. DFT function performs memory
  alignment if the input memory is not aligned.
2025-10-21 12:01:34 +02:00
Sakthivel Velumani 59ff9ae04e ulsim: test UCI on PUSCH with matlab
Since there is no UCI on PUSCH implementation in gNB, it is good to test
UE's implementation with matlab.

This commit allows to test with matlab in two ways:
1. generate OFDM waveform from ulsim and decode it in matlab using
uci_on_pusch_decode.m
2. generate codeword in matlab using uci_on_pusch_encode.m read it in
ulsim and compare the bits. ulsim option -o is used
2025-09-30 00:24:39 +08:00
Sakthivel Velumani 83bf140bc3 Add flag for Tx phase pre compensation
Used in ulsim to verify waveform in MATLAB
2025-09-30 00:24:39 +08:00
Sakthivel Velumani b2174cb8e1 Add processing stats for UCI mapping on PUSCH 2025-09-30 00:24:36 +08:00
Sakthivel Velumani 8de13fab97 Simplify code 2025-09-30 00:23:00 +08:00
Sakthivel Velumani 5f3a19cb7d Separate segmentation from ULSCH encoding function
Segmentation have to be called before UCI mapping to get number of
segments and sumKr values.
2025-09-26 11:16:54 +08:00
Sakthivel Velumani 524aa84e96 fix: issue 954 - DCI monitoring after RRC setup
After the UE is configured with pdcch-Config, it continues to monitor
fallback search spaces in pdcch-ConfigCommon for DCI with C-RNTI.

The rational is that after sending RRC Setup the network won't know if
the UE has received and successfully applied it. Hence the network would
still continue to use the fallback DCI till it receives RRC setup
complete.
2025-09-15 15:47:13 -04:00
Sakthivel Velumani 1becaf0671 Fix periodic CSI scheduling in UE
Changed the search structure to have periodic resoruce id in the outer
loop and configured resource set as inner loop to prevent configuring
resource that is not needed.

Use const for input pointers.
2025-08-05 10:01:05 -04:00
Sakthivel Velumani 39c6cb203c Not include DC for CSI IM measurement
DC subcarrier has a significantly higher energy compared to other CSI IM
resource elements. This causes the average interference + noise
estimation to be higher than CSI-RS signal power making the CQI 0. With
a third-party gnb that schedules PDSCH based on CQI, the UE never
receives DL DCI once it starts sending CSI reports.
2025-08-03 16:53:52 -04:00
Sakthivel Velumani 350cf8d6ef Fix PUCCH 2 DMRS in UE
for start RB not multiple of 4
2025-08-03 16:52:43 -04:00
Sakthivel Velumani e9d95e8962 Add new physim test cases for nr_dlsim
Following tests are added:
  1. 256QAM with TDL-A channel model
  2. 256QAM with 2 layers
2025-07-24 13:20:07 -04:00
Sakthivel Velumani dad6cf8dc3 Fix bug in LLR threshold buffer
The LLR threshold buffers hold only for one symbol but the LLRs are
computed for all symbols together. So only the threshold of last symbol
was used for computing LLR for all other symbols.

This commit calls nr_dlsch_llr for each symbol togther with rest of
nr_rx_pdsch() and calls nr_dlsch_layer_demapping at the last symbol.

Fixes issue 948.
2025-07-24 13:20:07 -04:00
Sakthivel Velumani eb44d715ca Dlsim dump processing buffers
Write extracted rxF buffer to output bin file.
Fix offset in writing rxF buffer.
2025-07-24 13:20:04 -04:00
Sakthivel Velumani b37cd04134 Set sib1 reception flag as per spec
TS 38.213 4.1 says coreset 0 is present only if kssb < 24 for FR1 and <
12 for FR2. This commit sets get_sib1 flag based on kssb.

Also, setting of mac state is taken out of function nr_ue_decode_mib().
2025-07-24 13:18:04 -04:00
Sakthivel Velumani 7feaea00c2 Fix counting error bits in nr_dlsim
Recently f buffer was changed to hold packed bits and the correspoinding
change in dlsim was not done so the number of error bits before decoding
was incorrectly reported. This commit fixes it.
2025-07-10 20:44:23 -04:00
Sakthivel Velumani abe25a52b3 Fix alignment of LLR buffer in UE 2025-07-10 17:36:02 -04:00
Sakthivel VelumaniandTeodora Vladic bff9c169c6 Update MTU for Foxconn to 9600
After capturing the FH packets, we observed that the RU supports the MTU value for jumbo frames.

Therefore, no fragmentation needed on DL.

Co-authored-by: Teodora Vladic <teodora.vladic@openairinterface.org>
2025-05-10 00:31:03 +02:00
Sakthivel Velumani 8c5340f135 Code cleanup
Use c16_t instead of int32_t for CSI RS freq domain samples.
Use const for rxdataF when used as input to functions.
2025-05-06 09:21:14 -04:00
Sakthivel Velumani 6128d1bb62 Use common function to generate CSI-RS signal
The functions nr_generate_csi_rs() and nr_ue_generate_csi_rs() are
identical. This commit removes nr_ue_generate_csi_rs() and moves
nr_generate_csi_rs() to nr_phy_common_csirs.c so both gNB and UE can use
the same function.
2025-05-06 09:11:40 -04:00
Sakthivel Velumani 18c9a3720d Fix asn1c double free
The UE stores PDCCH search spaces from the network in NR_BWP_PDCCH_t
struct within NR_UE_MAC_INST_t. After storing, the pointers otherSI_SS,
ra_SS and paging_SS are updated to point to the stored SS. Multiple
pointers could point to the same stored SS struct depending on
configuration. Then when the UE wants to release the SS, the pointers
are used to free the stored SS using ASN_STRUCT_RESET(). If multiple
pointers point to the same SS, calling ASN_STRUCT_RESET() on all
pointers would lead to double free. So one needs to check for dangling
pointer before freeing.

Instead of using pointers and assigning them during configuration, we
use SS id for otherSI_SS, ra_SS and paging_SS to retrieve the pointers
whenever needed. When the UE wants to release the SS, we make them -1
indicating an invalid SS id.
2025-04-25 15:40:07 -04:00
Sakthivel Velumani d334a75c8a Fix memory leak and possible crash
nr_dlsim allocates memory on every SNR iteration without freeing it.
This can lead to memory exhaustion. Fix this by allocating only once
and reuse memory. Also, free it before exit.
2025-04-11 09:46:55 -04:00
Sakthivel Velumani 4adadedeb9 Fix logging to matlab/bin file
Add Python script to plot logged buffers. Modified write_file_matlab()
to add .bin extension if binary format is selected.
2025-04-11 09:46:50 -04:00
Sakthivel Velumani e775b9ce9a Fix RA-RNTI for long prach formats 2025-03-20 11:12:00 -04:00
Sakthivel Velumani bab16b7e15 Fix long PRACH slot selection 2025-03-20 10:52:21 -04:00
Sakthivel Velumani 520c8aed38 Fix get_nr_prach_info_from_index() for FDD and long format 2025-03-05 12:02:43 -05:00
Sakthivel Velumani 591e009326 Fix prach K,kbar for mu 0 2025-02-25 11:58:41 -05:00
Sakthivel Velumani 94abbf247f Modified CI config file of NTN test
NTN test uses long PRACH format (format 0).
2025-02-25 11:58:41 -05:00
Sakthivel Velumani a3ba41b234 Don't do OFDM mod on PRACH slots
set number of prach slots in prach_vars in first slot and set as
inactive in last slot so we can skip OFDM modulation in slots that
already has prach.
2025-02-25 11:58:41 -05:00
Sakthivel Velumani a635b4b441 UE PRACH signal generation optimization
Use memcpy in nr_prach.c to fill txdata buffer.

Remove global tables related to PRACH generation.

Add new function to compute modulo multiplicative inverse and use it
directly to get inverse instead of LUT.

Removed nr_ru table and compute the values in-place.

In UE, added new flag root_seq_computed in nrUE_config to only compute
the sequence once after new nrUE_config is received.
2025-02-25 11:58:41 -05:00
Sakthivel Velumani 424b4f4daa Add processing time stats for PRACH 2025-02-25 11:58:41 -05:00
Sakthivel Velumani 4814443ba4 Fix RA-RNTI computation according to 3GPP
t_id for long prach formats is computed with mu = 0.
2025-02-25 11:58:41 -05:00
Sakthivel Velumani ecbb0bab5e update PRACH tracer 2025-02-25 11:58:41 -05:00
Sakthivel Velumani 611bbb5265 Use tx power from prach PDU instead of constant 2025-02-25 11:58:41 -05:00
Sakthivel Velumani cf0206e7c6 Fix scheduler for long prach
Long PRACH extends beyond a slot. Changes necessary to mark future slots
that may contain prach in ru, phy and mac functions.

In RU, the PRACH IDFT is done only after receiving last slot and marks
for L1 to start processing. The L1 processes at the last prach slot and
reports to MAC with the first slot index.

In MAC scheduler, the VRB for future slots are also marked as used.
PRACH scheduler is called in advance one frame minus num prach slots.
2025-02-25 11:58:41 -05:00
Sakthivel Velumani 94c74f4a1d fix long prach slot selection 2025-02-25 11:58:38 -05:00
Sakthivel Velumani b144ca7049 fix delta_preamble for long format 2025-02-23 16:18:01 -05:00
Sakthivel Velumani 4bfc0147ce ue mac changes for long prach
Fix bug in talbe 38.211 6.3.3.2-1 for FR2.
2025-02-23 16:18:01 -05:00
Sakthivel Velumani 8f5aa740bd Fix function nr_get_prach_mu for L839
function returns mu of UL BWP if msg1-SubcarrierSpacing absent instead
of asserting. The mu retured by this function is used to compute the
slot number of PRACH. In case of long format, the slot number is as per
UL mu.
2025-02-23 16:17:58 -05:00
Sakthivel Velumani 4c42a20eaa Cmd line option for sync in frames for iqrecorder
B200 with high clock drift will go out of sync within 280ms which was
the default duration to sync in with iqrecorder. Now this value can be
specified via cmd line so the user can change it according to needs.
2024-12-11 12:34:43 -05:00
Sakthivel Velumani 3f01ec0e71 Fix iqrecord to work on AVX512 machine 2024-12-11 12:32:18 -05:00
Sakthivel Velumani 73921dfa10 Prevent race condition when sync req received
Added a flush mechanism to actor thread. This is used to wait for all
waiting jobs in the queue to be completed.
2024-12-10 09:51:10 -05:00
Sakthivel Velumani e5814cd62e Handle sync request out of UE_dl_preprocessing()
Move handling of sync request from MAC from UE_dl_preprocessing(). This
will process the sync request before receiving the samples of current
slot from radio so we don't 'lose' the slot.
2024-12-10 09:50:27 -05:00
Sakthivel Velumani 4f56bf903a Helper function to get center frequency
from point A.
2024-12-10 09:50:27 -05:00
Sakthivel Velumani 5ac703b580 Code cleanup
Add const to function input pointer.
2024-12-10 09:50:27 -05:00
Sakthivel Velumani 3e3ef8cfd0 Enable usrp-tx-thread-config in UE
Setting this option will start a separate thread for writing samples to
USRP.
2024-11-15 14:16:32 -05:00
Sakthivel Velumani daeb110ae1 Don't reset txdata buffer every slot
This is not necessary becuase the buffer would be overwritten by OFDM
modulator in the next frame.
2024-11-15 14:14:17 -05:00
Sakthivel Velumani 210b92338f Decode PBCH with ssb index from init sync 2024-11-12 11:54:55 -05:00
Sakthivel Velumani 75cca9be3e Fix logging 2024-11-06 21:33:38 -05:00
Sakthivel Velumani 9333662cd8 Update logging in mac 2024-10-23 11:40:37 -04:00
Sakthivel Velumani 5855f766f8 Bugfix in ue pusch mac pdu creation
When more than one sdu with equal priority is present, there could be
buffer left after serving the lcids and also not enough for equaly
serving all lcids. This commit checks for this condition. Before this
fix the ue would send malformed mac pdus when serving multiple lcids.
2024-10-23 11:40:33 -04:00
Sakthivel Velumani f8a51921a8 Update default path for websrv resources 2024-09-30 21:02:29 -04:00
Sakthivel Velumani 56d05276bd Fix bug in websrv opening page
allocating enough memory to hold url to index page.
2024-09-30 20:29:59 -04:00
Sakthivel Velumani 321a20ea78 Fix vector mult function for out of bound access 2024-09-19 09:56:25 -04:00
Sakthivel Velumani a50cb354f4 Simplify map_current_symbol() function 2024-09-19 09:56:25 -04:00
Sakthivel Velumani e4c37fb3b2 Simplify data in DMRS symbol function
Mapping of data REs in DMRS symbol depends only on number of CDM group
no data. So the special case function that depended on delta is removed
and a single function is used.
2024-09-19 09:56:25 -04:00
Sakthivel Velumani 76cec45e80 Set correct USRP flags when not transmitting
Flags are set to INVALID when it is not a UL slot. This is important
when using GPIO to control TRX switch.
2024-09-10 14:41:05 -04:00
Sakthivel Velumani 28b2de5ac9 Add comments to the new RE mapping functions
Use the new struct as function argument instead of individual parameters
2024-09-03 09:21:29 +02:00
Sakthivel Velumani f5d22ab85a Gracefully exit PUSCH proc if encoding fails 2024-09-03 09:21:29 +02:00
Sakthivel Velumani 26b3fcca3b Remove SIMD operation for DMRS amplitude scaling
There was concern that someone in the future might call the function
with the wrong inputs. So, based on the discussion on the MR below
https://gitlab.eurecom.fr/oai/openairinterface5g/-/merge_requests/2916#note_132506
the SIMD for multiplying DMRS vector with amplitude is removed and is
now done with plain C (no SIMD).

The execution time for the function dmrs_amp_mult() in this commit is
10x higher that the previous commit.
2024-09-03 09:21:29 +02:00
Sakthivel Velumani 393363e253 Refactor PUSCH RE mapping
RE mapping time is reduced by 10x. Functions are made generic to be
later reused for PDSCH RE mapping at gNB.
2024-09-03 09:21:29 +02:00
Sakthivel Velumani add341e2f1 multi dmrs amp by vector 2024-09-03 09:18:26 +02:00
Sakthivel Velumani 2b7e0a0519 Change loop order to maximize cache hit
It is better to write to memory that are grouped together to reduce
probability of cache miss. This simple change improved the function's
execution speed by 70%.

Removed the unnecessary memset for the buffer.
2024-09-03 09:18:26 +02:00
Sakthivel Velumani 9c8bdd6db5 Add PUSCH timing stats 2024-09-03 09:18:26 +02:00
Sakthivel Velumani dd4eb9f8bc Fix regression in ue-scan-carrier option 2024-06-13 13:31:33 -04:00
Sakthivel Velumani dac55975b5 Updated documentation 2024-05-30 10:20:55 -04:00
Sakthivel Velumani 155d24f9e4 Code cleanup
Remove old and unused code. Fix indentation.
2024-05-30 10:20:55 -04:00
Sakthivel Velumani 7c146154f5 Prevent compiler warning
A particular GCC version (v13?) used by CI machines potentially has a
bug that issues a mismatch bound warning on function array arguments.
This commit should prevent it from happening.
2024-05-30 10:20:55 -04:00
Sakthivel Velumani ca93e68410 Use command line option for sell search
There is already a command line option called 'ue-scan-carrier' which
seemed to blindly look for SSB by changing the center frequency by
+/-100Hz if the previous attempt failed. This is probably copied from
LTE and is not suitable for NR. This commit uses this option to either
1. Perform initial sync on one GSCN if the SSB position if known
2. Or scan the all GSCN (if the SSB postion is unknown)

Also, the following is done for re-synchronization
1. Scan all GSCN when UE comes back from IDLE state
2. Scan one GSCN when UE does re-estabishment

Removed dependency of lte-softmodem.h in nr-softmodem.c.
CONFIG_HLP_UESCAN is declared also in lte-softmodem.h.
2024-05-30 10:20:55 -04:00
Sakthivel Velumani 26aa7c2e33 Suppressing PSS & SSS detection logs
Changed Info to Debug because the logs are too much if large number of
GSCN scans run concurrently. Print PSS correlation peak and average
power of detected cells.
2024-05-30 10:20:55 -04:00
Sakthivel Velumani 043da0c440 NR UE scan for SSB within current bandwidth
Till this commit, the UE gets the position of SSB in frequency from
command line and does the syncronization by locating the SSB in time. It
does this by generating a PSS time signal during initialization with the
SSB offset given via command line. Then PSS detection is done by
correlation.

In this commit, the UE computes a list of GSCN in the current NR band
that falls within the current bandwidth for the set center frequency.
For each GSCN in the list, the UE starts a thread and performs the
following:
1. Generate PSS time signal with SSB offset for current GSCN.
2. Detect PSS, SSS and decode PBCH (this step remains the same).
After all threads finishes, the results are collected.

For now, only the first detected PBCH is used to proceed further. So
this PBCH is indicated to MAC and UE exits initial sync.

Future work: The cell search can be standalone feature where the UE
could scan for SSB in the entire NR band. This would require changing
radio's frequency on the fly as the UE's bandwidth would not cover an
entire NR band. The cell detection can futher be imporved by looking
for SIB1 for each decoded PBCH.
2024-05-30 10:20:45 -04:00
Sakthivel Velumani 40b52bc8f4 Use existing function for bits reversal 2024-05-10 12:51:50 -04:00
Sakthivel Velumani 29bc4101cc NGAP: Fix byte order of NSSAI SD 2024-02-22 17:47:00 -05:00
Sakthivel Velumani d61c4f1042 Change global variable to local 2023-12-05 13:04:23 +05:30
Sakthivel Velumani f69f419a13 Remove duplicate declaration 2023-12-05 13:04:23 +05:30
Sakthivel Velumani 6bf954d35d Cast buffer intputs of order reversing macros 2023-12-05 13:04:23 +05:30
Sakthivel Velumani 3979879e9e Replace buffer conversion with macro 2023-12-05 13:04:23 +05:30
Sakthivel Velumani 8b118fd875 Remove hardcoding of default NSSAI selection
Check if NSSAI from config exists in allowed NSSAI list. Don't request
PDU session if not present in the list.
2023-12-05 13:04:13 +05:30
Sakthivel Velumani 124c86f7b8 Include sample advance option in OAI-UE tutorial
With X410 and N310, the RA procedure would not succeed and a sample advance is required.
2023-11-29 21:01:11 -05:00
Sakthivel Velumani 3a7f17ebb8 Create functions for getting LCID 2023-11-09 09:02:59 -05:00
Sakthivel Velumani 3ae665388a Declare variable outside of case: label 2023-11-02 10:28:51 -04:00
Sakthivel Velumani 8f79b4aeed Remove redundant typedef 2023-11-01 21:13:20 -04:00
Sakthivel Velumani 128bd3d3db Create macro to ntoh_int16 buffer input 2023-11-01 21:13:20 -04:00
Sakthivel Velumani 21b269fa99 Create macro to do ntoh for 3 bytes
use it in NSSAI parsing function
2023-11-01 21:13:20 -04:00
Sakthivel Velumani dc95e838eb Improve NSSAI parsing
use review suggestions from Laurent
2023-11-01 21:13:20 -04:00
Sakthivel Velumani 19551d1254 Remove extern declaration from .c 2023-11-01 21:13:20 -04:00
Sakthivel Velumani 950becb423 Store allowed NSSAIs from NAS message
Request default PDU session with first NSSAI from the list
2023-11-01 21:13:19 -04:00
Sakthivel Velumani 5f78fa6eed NGAP: put mcc, mnc, nssai inside new plmn struct 2023-10-31 16:12:15 -04:00
Sakthivel Velumani f381e93237 Set NSSAI config in MAC
Each active LCID at MAC is configured with NSSAI that is sent from AMF with PDU session setup request
2023-10-31 16:12:10 -04:00
Sakthivel Velumani 2bf40fbd17 Pass the NSSAI config via F1 2023-10-31 13:31:33 -04:00
Sakthivel Velumani 89fa5a18a8 Pass the NSSAI config via E1 2023-10-31 13:31:32 -04:00
Sakthivel Velumani 279a55c976 Save NSSAI params from AMF
The NSSAI of PDU sessions coming from AMF are stored in RRC to be sent to lower layers
2023-10-31 12:41:50 -04:00
Sakthivel Velumani f75519978e fix UE asserver due to PUCCH resource lookup all BWPs 2023-10-12 12:17:46 -04:00