Thanks for the answer, so what is the order of pushing samples to the mock buffer? if i want to ensure that i am receiving correct data i pushed after calling recv() using float or double type?
пн, 31 мая 2021 г. в 15:44, Marcus D. Leech <[email protected]>: > On 05/31/2021 08:30 AM, Alexey Silyuk wrote: > > HI everybody, I am new at mailing list. > > These days I am writing an emulator for emulating tx/rx streams based > > on uhd 3.15LTS > > I am using device usrp2 device from uhd/lib. > > As I saw in examples (rx_samples_to_file), I am creating a mock > > streamer ( taken from uhd tests ). > > and now i want to push samples inside the buffer. > > I see that i can define type of samples, if am using 'short' type of > > samples, I am creating uint32_t variable, 16 MSB i put real part of > > sample, and 16 LSB i put imaginary part of sample (i am using little > > endian) > > After that i am calling usrp->recv() and i get samples as i defined ( > > spp is 2000) > > (0,0) > > (2,2) > > .... > > (1999,1999) > > as expected, according to data I push to the mock buffer. > > > > now while i want to use type 'float' i am using for example > > float real = 1.5 > > float imag = 2.5 > > and trying to push sample to the mock buffer, i am doing: > > buffer[0] = (uint32_t)real; > > buffer[1] = (uint32_t)imag; > > > > and expecting to get after calling usrp->recv() > > (1.5, 2.5) > > but i get incorrect result (convertor settings: cpu_format "fc32", > > otw_format "sf16" ) > > > > i am printing real and imag parameters as bitset<32> and see in real > > part, in 16 LSB part of result, my 16 MSB bits from sample value 1.5, > > and in imagine part zeros, in next sample i see in 16 LSB part of > > result, 16 MSB bits of sample value 2.5. I mean one sample i push to > > buffer uses whole sample after calling recv() > > > > P.S i set scale factor to 1.0 > > > > What am I doing wrong to use the type 'float' and 'double' for mock > > samples? > > I am new at usrp so I don't understand what samples I should use, will > > be glad to get references. > > Thanks > > > > > Your OTW format is still SC16 -- normally only the *HOST* side uses > floating-point and no actual USRP devices that I'm aware of can > support floating-point *ON THE WIRE* (OTW). > > _______________________________________________ > USRP-users mailing list -- [email protected] > To unsubscribe send an email to [email protected] >
_______________________________________________ USRP-users mailing list -- [email protected] To unsubscribe send an email to [email protected]
