[srslte-users] Resampling on N210
Justin Tallon
justin.tallon at softwareradiosystems.com
Fri May 17 12:53:11 UTC 2019
Hey Frederico,
Can you post a screenshot?
Regards,
Justin
On Fri, 17 May 2019, 13:32 Federico Quattrin, <fede.quattrin at gmail.com>
wrote:
> Hi Justin!
> Thanks for your answer! I'm running the pdsch_ue example right now, I have
> a graphic that's move, where should I exactly look to know if is properly
> working?
> Thanks!
> Greetings
> Federico
>
> Justin Tallon <justin.tallon at softwareradiosystems.com> schrieb am Fr.,
> 17. Mai 2019, 14:20:
>
>> Hey Federico,
>>
>> Good to you had some success.
>>
>> You will not be able to attach to a commercial network without a valid
>> SIM card and accompanying reader.
>>
>> My advice would be to try to use the pdsch_ue nad pdsch_enodeb examples
>> in the srsLTE/lib/examples folder and ensure you can get good behaviour
>> from these with the resampling before moving onto the full srsenb or srsue.
>>
>> Regards,
>> Justin
>> ____
>> Justin Tallon Ph.D.
>>
>> Software Radio Systems (SRS)
>> http://www.softwareradiosystems.com
>>
>> +353-86-067-0753 | justin.tallon at softwareradiosystems.com
>>
>>
>> On Fri, May 17, 2019 at 11:13 AM Federico Quattrin <
>> fede.quattrin at gmail.com> wrote:
>>
>>> Hi Justin,
>>> I looked at your code and copy some things and changes some for adapting
>>> to the new version. First of all I want to say that you have done a real
>>> good job!
>>> Second thing, I managed to run the code and I receive no more L messages
>>> nor time out, when I'm using prb<=15 I receive U messages.
>>> I was able to create a eNodeB but I can't see mi network. I tried to to
>>> run srsUE in order to see commercial network but I can't. I wonder if maybe
>>> these error is due to the SIM card configured in UE. Do I need a commercial
>>> SIM card to see commercial network in cell search?
>>> Greetings!
>>> Federico
>>>
>>> Justin Tallon <justin.tallon at softwareradiosystems.com> schrieb am Do.,
>>> 16. Mai 2019, 11:47:
>>>
>>>> Hey Frederico,
>>>>
>>>> There has been some work done on integrating the fractional resampling
>>>> functions with the UHD code but it is with an older version of the code.
>>>>
>>>>
>>>>
>>>> It is available in a repo, can be found at this link.
>>>>
>>>>
>>>> https://github.com/yagoda/srsLTE_Wishful/blob/master/lib/src/phy/rf/rf_uhd_imp.c
>>>>
>>>> Hope this can provide some help.
>>>>
>>>>
>>>> Regards,
>>>> Justin
>>>>
>>>>
>>>>
>>>>
>>>> On Tue, 14 May 2019, 20:02 Federico Quattrin, <fede.quattrin at gmail.com>
>>>> wrote:
>>>>
>>>>> Hi srsLTE community,
>>>>>
>>>>> I'm trying to write a piece of code in order to make a resample for
>>>>> the N210. Until now I read the source code and found that this piece of
>>>>> code must be written in the file rf_uhd_impl.c so i did that, most
>>>>> specifically I wrote it in the function rf_uhd_recv_with_time_multi.
>>>>> What i thought was: The N210 has a resampling frequency of 100 Msps, but
>>>>> srsLTE works with different frequency, so i need to get all the samples
>>>>> from UHD, save them into a array or buffer, and then do a resample of these
>>>>> data with the srsLTE resampling functions and send these new array of data
>>>>> as the final array of data.
>>>>> To achieve this I modified the code of the function
>>>>> rf_uhd_recv_with_time_multi as it follow:
>>>>>
>>>>> int rf_uhd_recv_with_time_multi(void *h,
>>>>> void *data[SRSLTE_MAX_PORTS],
>>>>> uint32_t nsamples,
>>>>> bool blocking,
>>>>> time_t *secs,
>>>>> double *frac_secs)
>>>>> {
>>>>> rf_uhd_handler_t *handler = (rf_uhd_handler_t*) h;
>>>>> uhd_rx_metadata_handle *md = &handler->rx_md_first;
>>>>> size_t rxd_samples = 0;
>>>>> size_t rxd_samples_total_new = 0;
>>>>>
>>>>> float sratio = 192.0 * 3.0 / (625.0 * 4.0); //added for resampling
>>>>> (1/sratio = 4.340277778) The idea is to resample from 100 Msps to 23.04
>>>>> Msps.
>>>>>
>>>>>
>>>>> // we need to convert all the vector to a new size in order to get
>>>>> all the samples.
>>>>>
>>>>> nsamples = nsamples / sratio; //added for resampling. We should
>>>>> receive more sampling due to different sample rate and same time.
>>>>>
>>>>> size_t rxd_samples_total = 0;
>>>>> int trials = 0;
>>>>>
>>>>> if (blocking) {
>>>>> while (rxd_samples_total < nsamples && trials < 100) {
>>>>> void *buffs_ptr[4];
>>>>> void *buff_new[4] ;
>>>>> cf_t * puntero;
>>>>> puntero = &data_c[rxd_samples_total]; // Here I try to imitate
>>>>> the behavior of buffs_ptr
>>>>> for (int i=0;i<handler->nof_rx_channels;i++) {
>>>>> cf_t *data_c = (cf_t*) data[i];
>>>>> buffs_ptr[i] = &data_c[rxd_samples_total];
>>>>> buff_new[i] = malloc(nsamples) ; //these is the pointer where
>>>>> i would keep all the samples coming from UHD.
>>>>> }
>>>>>
>>>>> size_t num_samps_left = nsamples - rxd_samples_total;
>>>>> size_t num_rx_samples = (num_samps_left >
>>>>> (handler->rx_nof_samples / sratio)) ? (handler->rx_nof_samples / sratio) :
>>>>> num_samps_left;
>>>>> // /sratio added for resampling.
>>>>>
>>>>> rxd_samples = 0;
>>>>>
>>>>> /*So these is the function that, as i understood, receive the
>>>>> samples from UHD. Originally said buffs_ptr instead of buff_new, but
>>>>> because I don't want to write the data with the samples that comes from UHD
>>>>> I give her buff_new.*/
>>>>> uhd_error error = uhd_rx_streamer_recv(handler->rx_stream,
>>>>> /*buffs_ptr*/ buff_new,
>>>>> num_rx_samples, md, 1.0,
>>>>> false, &rxd_samples);
>>>>>
>>>>> //Implementation of the resampling
>>>>> srslte_resample_arb_t r;
>>>>> srslte_resample_arb_init(&r,sratio,0);
>>>>> size_t new_rxd_sample[SRSLTE_MAX_PORTS];
>>>>> for(int i = 0 ; i < handler->nof_rx_channels ; i++){
>>>>> new_rxd_sample[i] = srslte_resample_arb_compute(&r,(cf_t*)
>>>>> buff_new[i], puntero, rxd_samples); //function returns new length.
>>>>> }
>>>>>
>>>>> for(int i = 0; i < handler->nof_rx_channels ; i++){
>>>>> free(buff_new[i]); //we need to free the memory because we did
>>>>> a malloc.
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>> if (error) {
>>>>> fprintf(stderr, "Error receiving from UHD: %d\n", error);
>>>>> log_rx_error(handler);
>>>>> return -1;
>>>>> }
>>>>> uhd_rx_metadata_error_code_t error_code = 0;
>>>>> uhd_rx_metadata_error_code(*md, &error_code);
>>>>>
>>>>> md = &handler->rx_md;
>>>>> rxd_samples_total_new += new_rxd_sample[0];
>>>>> rxd_samples_total += rxd_samples;
>>>>> printf("\n----------------------------------------\nrxd samples
>>>>> total new= %ld\nrxd samples total normal %ld\nrxd samples normal %ld\nrxd
>>>>> samples new
>>>>> %ld\n-----------------------------------------------\n",rxd_samples_total_new,rxd_samples_total,rxd_samples,new_rxd_sample[0]);
>>>>> // I add these printf because I wanted to see the values of these variables.
>>>>> trials++;
>>>>>
>>>>> if (error_code == UHD_RX_METADATA_ERROR_CODE_OVERFLOW) {
>>>>> log_overflow(handler);
>>>>> } else if (error_code ==
>>>>> UHD_RX_METADATA_ERROR_CODE_LATE_COMMAND) {
>>>>> log_late(handler, true);
>>>>> } else if (error_code == UHD_RX_METADATA_ERROR_CODE_TIMEOUT) {
>>>>> fprintf(stderr, "Error timed out while receiving samples from
>>>>> UHD.\n");
>>>>> return -1;
>>>>> } else if (error_code != UHD_RX_METADATA_ERROR_CODE_NONE ) {
>>>>> fprintf(stderr, "Error code 0x%x was returned during
>>>>> streaming. Aborting.\n", error_code);
>>>>> }
>>>>> }
>>>>> } else {
>>>>> uhd_error error = uhd_rx_streamer_recv(handler->rx_stream, data,
>>>>> nsamples, md, 0.0, false, &rxd_samples);
>>>>> rxd_samples_total = rxd_samples;
>>>>> printf("NO entramos al IF\n");
>>>>>
>>>>> if (error) {
>>>>> fprintf(stderr, "Error receiving from UHD: %d\n", error);
>>>>> log_rx_error(handler);
>>>>> return -1;
>>>>> }
>>>>> }
>>>>> if (secs && frac_secs) {
>>>>>
>>>>> uhd_rx_metadata_time_spec(handler->rx_md_first, secs, frac_secs);
>>>>> }
>>>>> printf("\n\nOUT OF THE FUNCTION\n\n");
>>>>> return rxd_samples_total_new; //I return the new length, I mean the
>>>>> length the the resampled data will have, not the length of the data I
>>>>> received from UHD.
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> So after I run the code, that is what I receive:
>>>>>
>>>>> # srsenb
>>>>>
>>>>> Built in Release mode using 18.12.0.
>>>>>
>>>>> --- Software Radio Systems LTE eNodeB ---
>>>>>
>>>>> Reading configuration file /root/.config/srslte/enb.conf...
>>>>> [INFO] [UHD] linux; GNU C++ version 8.3.0; Boost_106700;
>>>>> UHD_3.14.0.HEAD-0-g6875d061
>>>>> Opening USRP with args:
>>>>> [INFO] [USRP2] Opening a USRP2/N-Series device...
>>>>> [INFO] [USRP2] Current recv frame size: 1472 bytes
>>>>> [INFO] [USRP2] Current send frame size: 1472 bytes
>>>>> [WARNING] [MULTI_USRP] The hardware does not support the requested RX
>>>>> sample rate:
>>>>> Target sample rate: 1.920000 MSps
>>>>> Actual sample rate: 1.923077 MSps
>>>>>
>>>>> [WARNING] [MULTI_USRP] The hardware does not support the requested TX
>>>>> sample rate:
>>>>> Target sample rate: 1.920000 MSps
>>>>> Actual sample rate: 1.923077 MSps
>>>>>
>>>>> Setting frequency: DL=2685.0 Mhz, UL=2565.0 MHz
>>>>> Setting Sampling frequency 23.04 MHz
>>>>> Setting manual TX/RX offset to 100 samples
>>>>>
>>>>> ==== eNodeB started ===
>>>>> Type <t> to view trace
>>>>> S1 Setup Failure. Cause: misc - unknown-PLMN
>>>>>
>>>>> ----------------------------------------
>>>>> rxd samples total new= 84
>>>>> rxd samples total normal 363
>>>>> rxd samples normal 363
>>>>> rxd samples new 84
>>>>> -----------------------------------------------
>>>>>
>>>>> ----------------------------------------
>>>>> rxd samples total new= 168
>>>>> rxd samples total normal 726
>>>>> rxd samples normal 363
>>>>> rxd samples new 84
>>>>> -----------------------------------------------
>>>>>
>>>>> ----------------------------------------
>>>>> rxd samples total new= 172
>>>>> rxd samples total normal 742
>>>>> rxd samples normal 16
>>>>> rxd samples new 4
>>>>> -----------------------------------------------
>>>>>
>>>>> ----------------------------------------
>>>>> rxd samples total new= 172
>>>>> rxd samples total normal 742
>>>>> rxd samples normal 0
>>>>> rxd samples new 0
>>>>> -----------------------------------------------
>>>>> O
>>>>> ----------------------------------------
>>>>> rxd samples total new= 172
>>>>> rxd samples total normal 742
>>>>> rxd samples normal 0
>>>>> rxd samples new 0
>>>>> -----------------------------------------------
>>>>> Error timed out while receiving samples from UHD.
>>>>>
>>>>> LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
>>>>> ----------------------------------------
>>>>> rxd samples total new= 0
>>>>> rxd samples total normal 0
>>>>> rxd samples normal 0
>>>>> rxd samples new 0
>>>>> -----------------------------------------------
>>>>> Error timed out while receiving samples from UHD.
>>>>> LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
>>>>> ----------------------------------------
>>>>> rxd samples total new= 0
>>>>> rxd samples total normal 0
>>>>> rxd samples normal 0
>>>>> rxd samples new 0
>>>>> -----------------------------------------------
>>>>> Error timed out while receiving samples from UHD.
>>>>> LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
>>>>> ----------------------------------------
>>>>> rxd samples total new= 0
>>>>> rxd samples total normal 0
>>>>> rxd samples normal 0
>>>>> rxd samples new 0
>>>>> -----------------------------------------------
>>>>> Error timed out while receiving samples from UHD.
>>>>> LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
>>>>> ----------------------------------------
>>>>> rxd samples total new= 0
>>>>> rxd samples total normal 0
>>>>> rxd samples normal 0
>>>>> rxd samples new 0
>>>>> -----------------------------------------------
>>>>> Error timed out while receiving samples from UHD.
>>>>> LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
>>>>> ----------------------------------------
>>>>> rxd samples total new= 0
>>>>> rxd samples total normal 0
>>>>> rxd samples normal 0
>>>>> rxd samples new 0
>>>>> -----------------------------------------------
>>>>> Error timed out while receiving samples from UHD.
>>>>> LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
>>>>> ----------------------------------------
>>>>> rxd samples total new= 0
>>>>> rxd samples total normal 0
>>>>> rxd samples normal 0
>>>>> rxd samples new 0
>>>>> -----------------------------------------------
>>>>> Error timed out while receiving samples from UHD.
>>>>> LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL^CStopping
>>>>> srsENB... Press Ctrl+C 9 more times to force stop
>>>>>
>>>>> ----------------------------------------
>>>>> rxd samples total new= 0
>>>>> rxd samples total normal 0
>>>>> rxd samples normal 0
>>>>> rxd samples new 0
>>>>> -----------------------------------------------
>>>>> Error timed out while receiving samples from UHD.
>>>>> LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
>>>>> ----------------------------------------
>>>>> rxd samples total new= 0
>>>>> rxd samples total normal 0
>>>>> rxd samples normal 0
>>>>> rxd samples new 0
>>>>> -----------------------------------------------
>>>>> Error timed out while receiving samples from UHD.
>>>>> LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL---
>>>>> exiting ---
>>>>>
>>>>>
>>>>> One thing that I noticed is that the UHD always receive 742 samples
>>>>> and then do not receive a simple sample more.
>>>>> I don't know if i need to edit somewhere else in the code, but these
>>>>> of the 742 samples looks like that doesn't belong to the resampling problem.
>>>>>
>>>>> I would be really grateful if any of you guys could give some help
>>>>>
>>>>> Thanks in advance
>>>>> Greeting!
>>>>> Federico
>>>>>
>>>>> _______________________________________________
>>>>> srslte-users mailing list
>>>>> srslte-users at lists.softwareradiosystems.com
>>>>> http://www.softwareradiosystems.com/mailman/listinfo/srslte-users
>>>>>
>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.srsran.com/pipermail/srsran-users/attachments/20190517/8b11419f/attachment.htm>
More information about the srsran-users
mailing list