You can also try with fprintf(stderr... in case stdout is redirected.
Tiy can put prints in several ad9361 files to see which ones are called,
If all fails try gdb...Press <ctrl-c>  when timing out in tuning and
check the stack...

HTH
Nikos

On Fri, Jul 29, 2022 at 10:02 PM yan zhang <yanzhan...@gmail.com> wrote:
>
> Hi, Nikos,
>
> I am using a E312 device with ad9361 frontend and I am sure the frontend is 
> ad9361. I have searched for like two weeks and can not find the source code 
> for tuning.
>
> The most possible code is in the ad9361 driver folder, but that does not work 
> ... (with printf())
>
> Yan
>
> On Fri, Jul 29, 2022 at 11:03 AM Nikos Balkanas <nbalka...@gmail.com> wrote:
>>
>> Hi Yan,
>>
>> Throwing an error (exception?) is a bit drastic. A simple printf or
>> cout should be sufficient...
>> Yup. That seems to be controlling the VCO. That should be in your 
>> daugtherboard.
>> What daugtherboard are you using?
>> If you are using it and it doesn;t print/err then you should be
>> looking elsewhere...
>> Are you sure you are using the ad9361 driver?
>>
>> HTH
>> Nikos
>>
>> On Fri, Jul 29, 2022 at 4:41 PM yan zhang <yanzhan...@gmail.com> wrote:
>> >
>> > Hi, Nikos,
>> >
>> > Thanks for your reply! I will try to learn and install ctag. Here is what 
>> > I further find:
>> >
>> > Following your directions, I can find the _tx_freq variable in 
>> > "uhd/host/lib/usrp/common/ad9361_driver/ad9361_device.h".
>> > I assume that the " _tune_helper() " function implemented in 
>> > "uhd/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp" is the 
>> > underlying function that tunes the ad9361 front end.
>> > The problem is that I modify the _tune_helper()  by throwing a uhd error 
>> > at the beginning of the function, however after I re-compile the modified 
>> > uhd and re-install it and then re-run my tuning loop, I didn't find the 
>> > error message I throw in the  _tune_helper() .
>> >
>> > Does that mean the E312 uhd does not run the  _tune_helper() function in  
>> > "uhd/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp"?
>> > I really would like to find where the underlying tuning source code is and 
>> > I need to turn off the calibration procedure in the tuning code to speed 
>> > up the tuning.
>> >
>> > Thanks,
>> > Yan
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > On Thu, Jul 28, 2022 at 6:48 PM Nikos Balkanas <nbalka...@gmail.com> wrote:
>> >>
>> >> Hi,
>> >>
>> >> _tx_freq is an intermediate frequency.
>> >> It is defined in:
>> >> uhd/host/lib/usrp/common/ad9361_driver/ad9361_device.h
>> >> If you need to modify uhd, you really need to install ctags, and grep
>> >> the sources...
>> >>
>> >> HTH
>> >> Nikos
>> >>
>> >> On Thu, Jul 28, 2022 at 10:42 PM <yanzhan...@gmail.com> wrote:
>> >> >
>> >> > Hi, all,
>> >> >
>> >> >
>> >> >
>> >> > I have a E312 device and I just find that the tuning speed of E312 is 
>> >> > very slow (~150ms) for each tuning. Thus I would like to modify the 
>> >> > underlying tuning source code in the uhd software architecture.
>> >> >
>> >> >
>> >> >
>> >> > Here is what I found:
>> >> >
>> >> >
>> >> >
>> >> > I first create a multi_usrp object:
>> >> >
>> >> > uhd::usrp::multi_usrp::sptr usrp = 
>> >> > uhd::usrp::multi_usrp::make(device_args);
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > then I tune the usrp by running a loop:
>> >> >
>> >> >
>> >> >
>> >> > int count = 200;
>> >> > for(int a = 0; a < count; a++) {
>> >> >         uhd::tune_request_t tune_request(600e6 + a*10e6);
>> >> >
>> >> >         usrp->set_rx_freq(tune_request, 0);
>> >> >         usrp->set_tx_freq(tune_request, 0);
>> >> > }
>> >> >
>> >> >
>> >> >
>> >> > Basically, the loop tunes the frequency from 600MHz to 2.6 GHz with a 
>> >> > step size of 10 MHz. The 200 tunings take 52 seconds, which is pretty 
>> >> > slow.
>> >> >
>> >> >
>> >> >
>> >> > Thus, I traced the call stack from usrp->set_rx_freq(tune_request, 0). 
>> >> > Here is what I found:
>> >> >
>> >> > usrp->set_rx_freq(tune_request, 0);  calls the method 
>> >> > set_tx_frequency() in 
>> >> > uhd/host/lib/usrp/dboard/e3xx/e3xx_radio_control_impl.cpp
>> >> >
>> >> > then the method set_tx_frequency() in 
>> >> > uhd/host/lib/usrp/dboard/e3xx/e3xx_radio_control_impl.cpp calls the 
>> >> > tune() method in uhd/host/lib/usrp/dboard/e3xx/e3xx_ad9361_iface.cpp
>> >> >
>> >> > then the tune() method in 
>> >> > uhd/host/lib/usrp/dboard/e3xx/e3xx_ad9361_iface.cpp calls the method 
>> >> > set_tx_frequency() in uhd/host/lib/rfnoc/radio_control_impl.cpp.
>> >> >
>> >> >
>> >> >
>> >> > The conclusion I have reached so far is the underlying tuning method is 
>> >> > in  uhd/host/lib/rfnoc/radio_control_impl.cpp:
>> >> >
>> >> >
>> >> >
>> >> > double radio_control_impl::set_tx_frequency(const double freq, const 
>> >> > size_t chan)
>> >> > {
>> >> >     std::lock_guard<std::mutex> l(_cache_mutex);
>> >> >     return _tx_freq[chan] = freq;
>> >> > }
>> >> >
>> >> >
>> >> >
>> >> > Then I just got stuck here, what is the _tx_freq[chan] ? I just can not 
>> >> > find more.
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > What I want to do is to modify the underlying ad9361 driver, so that 
>> >> > when tuning a frequency, I can bypass the calibration in the ad9361 to 
>> >> > speed up the tuning speed.
>> >> >
>> >> >
>> >> >
>> >> > Can anyone point me to 1.where I can find the source code for tuning 
>> >> > for the E312 with uhd 4.0 or 2. how to use mpm to get low-level access 
>> >> > to ad9361 so that I can write my own tuning method for ad9361 ?
>> >> >
>> >> >
>> >> >
>> >> > Thanks,
>> >> >
>> >> > Yan
>> >> >
>> >> > _______________________________________________
>> >> > USRP-users mailing list -- usrp-users@lists.ettus.com
>> >> > To unsubscribe send an email to usrp-users-le...@lists.ettus.com
_______________________________________________
USRP-users mailing list -- usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-le...@lists.ettus.com

Reply via email to