Re: [USRP-users] B210 -- AD9361 low-level access and changing filter configuration
Hi, I've figured out what I was doing wrong No set_filter() once the taps are set (I mistakenly thought that this was implicitly done -- and checking the source code of UHD confirmed that the sptr returned by get_filter() is a sptr to a **copy** of the original filter, and not the actual one!)! :S :S :S :S Now it works like a charm Thanks again!!! :) Rob On 13 September 2017 at 07:11, Rob Heig wrote: > Hi, > Thank you both for your help! :) > I had started myself patching UHD for the job like Sylvain did, but that > scared me a bit since I didn't want to stump on the feet of the library and > risk having some strange behaviour, therefore I preferred to ask first ;) > Have a nice day! > Rob > > On 12 September 2017 at 22:15, Julian Arnold > wrote: > >> Hey, >> >> In case you haven't already adopted the straight forward approach >> mentioned by >> Sylvain I just dug out the tool I mentioned and moved >> it to my github account [1]. >> >> I quickly compiled and linked against a recent version of UHD (3.9.6) to >> confirm that it still works. >> >> Build as usual: >> mkdir build >> cd build >> cmake .. >> make >> >> You can then run the "main" program as follows: >> >> ./main --list >> >> to see a list of all available filters with their corresponding paths. >> Then, you can write new filter coefficients with: >> >> ./main --write_fir --path= >> e.g.: >> ./main --write_fir --path=/mboards/0/dboards/A/rx >> _frontends/A/filters/FIR_1 >> >> this will update the coefficients of FIR_1 and then read the filter again >> to >> check if the coefficients have been updated. >> However, the tool is definitely not polished in any way and does not check >> whether or not the new coefficients actually take effect. >> If they still don't then let me know and I'll try to create a more >> complete >> example application. >> >> [1] https://github.com/jarn0ld/uhd-filter-tool >> >> Cheers, >> Julian >> >> On Tuesday, September 12, 2017 5:16:56 PM CEST Sylvain Munaut wrote: >> > Personally I'm using a patched UHD where I expose the SPI device : >> > >> > >> > diff --git a/host/lib/usrp/b200/b200_impl.cpp >> > b/host/lib/usrp/b200/b200_impl.cpp index a513e1336..01c1e3b51 100644 >> > --- a/host/lib/usrp/b200/b200_impl.cpp >> > +++ b/host/lib/usrp/b200/b200_impl.cpp >> > @@ -549,6 +549,8 @@ b200_impl::b200_impl(const uhd::device_addr_t& >> > device_addr, usb_device_handle::s >> > _adf4001_iface = boost::make_shared> l_ctrl>(_spi_iface); >> > } >> > >> > +_tree->create(mb_path / ("spi")).set(_spi_iface); >> > + >> > >> >> > // Init codec - turns on clocks >> > >> >> > >> > >> > Then in my code I can get the SPI object : >> > >> > uhd::spi_iface::sptr spi = >> > usrp->get_device()->get_tree()->access >> ("/mboards/0/spi >> > ").get(); >> > >> > and use read_spi / write_spi to control any register I want. >> > >> > >> > Cheers, >> > >> > Sylvain >> >> >> -- >> Julian Arnold, M.Sc. >> >> Institute for Networked Systems >> RWTH Aachen University >> Kackertstrasse 9 >> 52072 Aachen >> Germany >> > > ___ USRP-users mailing list USRP-users@lists.ettus.com http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
Re: [USRP-users] B210 -- AD9361 low-level access and changing filter configuration
Hi, Thank you both for your help! :) I had started myself patching UHD for the job like Sylvain did, but that scared me a bit since I didn't want to stump on the feet of the library and risk having some strange behaviour, therefore I preferred to ask first ;) Have a nice day! Rob On 12 September 2017 at 22:15, Julian Arnold wrote: > Hey, > > In case you haven't already adopted the straight forward approach > mentioned by > Sylvain I just dug out the tool I mentioned and moved > it to my github account [1]. > > I quickly compiled and linked against a recent version of UHD (3.9.6) to > confirm that it still works. > > Build as usual: > mkdir build > cd build > cmake .. > make > > You can then run the "main" program as follows: > > ./main --list > > to see a list of all available filters with their corresponding paths. > Then, you can write new filter coefficients with: > > ./main --write_fir --path= > e.g.: > ./main --write_fir --path=/mboards/0/dboards/A/ > rx_frontends/A/filters/FIR_1 > > this will update the coefficients of FIR_1 and then read the filter again > to > check if the coefficients have been updated. > However, the tool is definitely not polished in any way and does not check > whether or not the new coefficients actually take effect. > If they still don't then let me know and I'll try to create a more complete > example application. > > [1] https://github.com/jarn0ld/uhd-filter-tool > > Cheers, > Julian > > On Tuesday, September 12, 2017 5:16:56 PM CEST Sylvain Munaut wrote: > > Personally I'm using a patched UHD where I expose the SPI device : > > > > > > diff --git a/host/lib/usrp/b200/b200_impl.cpp > > b/host/lib/usrp/b200/b200_impl.cpp index a513e1336..01c1e3b51 100644 > > --- a/host/lib/usrp/b200/b200_impl.cpp > > +++ b/host/lib/usrp/b200/b200_impl.cpp > > @@ -549,6 +549,8 @@ b200_impl::b200_impl(const uhd::device_addr_t& > > device_addr, usb_device_handle::s > > _adf4001_iface = boost::make_shared pll_ctrl>(_spi_iface); > > } > > > > +_tree->create(mb_path / ("spi")).set(_spi_iface); > > + > > > > > // Init codec - turns on clocks > > > > > > > > > Then in my code I can get the SPI object : > > > > uhd::spi_iface::sptr spi = > > usrp->get_device()->get_tree()->access > ("/mboards/0/spi > > ").get(); > > > > and use read_spi / write_spi to control any register I want. > > > > > > Cheers, > > > > Sylvain > > > -- > Julian Arnold, M.Sc. > > Institute for Networked Systems > RWTH Aachen University > Kackertstrasse 9 > 52072 Aachen > Germany > ___ USRP-users mailing list USRP-users@lists.ettus.com http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
Re: [USRP-users] B210 -- AD9361 low-level access and changing filter configuration
Hey, In case you haven't already adopted the straight forward approach mentioned by Sylvain I just dug out the tool I mentioned and moved it to my github account [1]. I quickly compiled and linked against a recent version of UHD (3.9.6) to confirm that it still works. Build as usual: mkdir build cd build cmake .. make You can then run the "main" program as follows: ./main --list to see a list of all available filters with their corresponding paths. Then, you can write new filter coefficients with: ./main --write_fir --path= e.g.: ./main --write_fir --path=/mboards/0/dboards/A/rx_frontends/A/filters/FIR_1 this will update the coefficients of FIR_1 and then read the filter again to check if the coefficients have been updated. However, the tool is definitely not polished in any way and does not check whether or not the new coefficients actually take effect. If they still don't then let me know and I'll try to create a more complete example application. [1] https://github.com/jarn0ld/uhd-filter-tool Cheers, Julian On Tuesday, September 12, 2017 5:16:56 PM CEST Sylvain Munaut wrote: > Personally I'm using a patched UHD where I expose the SPI device : > > > diff --git a/host/lib/usrp/b200/b200_impl.cpp > b/host/lib/usrp/b200/b200_impl.cpp index a513e1336..01c1e3b51 100644 > --- a/host/lib/usrp/b200/b200_impl.cpp > +++ b/host/lib/usrp/b200/b200_impl.cpp > @@ -549,6 +549,8 @@ b200_impl::b200_impl(const uhd::device_addr_t& > device_addr, usb_device_handle::s > _adf4001_iface = boost::make_shared(_spi_iface); > } > > +_tree->create(mb_path / ("spi")).set(_spi_iface); > + > > // Init codec - turns on clocks > > > > Then in my code I can get the SPI object : > > uhd::spi_iface::sptr spi = > usrp->get_device()->get_tree()->access("/mboards/0/spi > ").get(); > > and use read_spi / write_spi to control any register I want. > > > Cheers, > > Sylvain -- Julian Arnold, M.Sc. Institute for Networked Systems RWTH Aachen University Kackertstrasse 9 52072 Aachen Germany ___ USRP-users mailing list USRP-users@lists.ettus.com http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
Re: [USRP-users] B210 -- AD9361 low-level access and changing filter configuration
Personally I'm using a patched UHD where I expose the SPI device : diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index a513e1336..01c1e3b51 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -549,6 +549,8 @@ b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::s _adf4001_iface = boost::make_shared(_spi_iface); } +_tree->create(mb_path / ("spi")).set(_spi_iface); + // Init codec - turns on clocks Then in my code I can get the SPI object : uhd::spi_iface::sptr spi = usrp->get_device()->get_tree()->access("/mboards/0/spi").get(); and use read_spi / write_spi to control any register I want. Cheers, Sylvain ___ USRP-users mailing list USRP-users@lists.ettus.com http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
Re: [USRP-users] B210 -- AD9361 low-level access and changing filter configuration
Hi Julian, Sure, no hurry, thanks a lot!!! :) Best, RH On 12 September 2017 at 12:12, Julian Arnold wrote: > Hey Rob, > > I remember creating a small example tool to use the filter API and to > write to the RX FIR. > If you can wait till the evening I'll dig it out at home and share it with > you. > > Cheers, > Julian > > Julian Arnold, M.Sc > Institute for Networked Systems > RWTH-Aachen University > Kackertstrasse 9 > 52072 Aachen > Germany > > > On 12. Sep 2017, at 07:01, Rob Heig via USRP-users < > usrp-users@lists.ettus.com> wrote: > > > > Hi, > > > > I have been playing a bit with the API of UHD and I wonder if it is > possible to have a low-level access to the underlying, low-level AD9361 > API. In effect, what I would love to do is to play with the filters (the RX > FIR filter in particular), but so far I haven't been that lucky (all I've > managed to do is to make the software crash badly). > > In particular, I have experimented a bit with the set_taps() function > call (after some very ugly casts), but either the system ignores it > (re-reading the coefficients shows me that they're all zeros), or it makes > the application crash (memory corruption). > > Can anyone point me to a good direction (besides the UHD manual), please? > > Thanks a lot in advance! > > RH > > ___ > > USRP-users mailing list > > USRP-users@lists.ettus.com > > http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com > > ___ USRP-users mailing list USRP-users@lists.ettus.com http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
Re: [USRP-users] B210 -- AD9361 low-level access and changing filter configuration
Hey Rob, I remember creating a small example tool to use the filter API and to write to the RX FIR. If you can wait till the evening I'll dig it out at home and share it with you. Cheers, Julian Julian Arnold, M.Sc Institute for Networked Systems RWTH-Aachen University Kackertstrasse 9 52072 Aachen Germany > On 12. Sep 2017, at 07:01, Rob Heig via USRP-users > wrote: > > Hi, > > I have been playing a bit with the API of UHD and I wonder if it is possible > to have a low-level access to the underlying, low-level AD9361 API. In > effect, what I would love to do is to play with the filters (the RX FIR > filter in particular), but so far I haven't been that lucky (all I've managed > to do is to make the software crash badly). > In particular, I have experimented a bit with the set_taps() function call > (after some very ugly casts), but either the system ignores it (re-reading > the coefficients shows me that they're all zeros), or it makes the > application crash (memory corruption). > Can anyone point me to a good direction (besides the UHD manual), please? > Thanks a lot in advance! > RH > ___ > USRP-users mailing list > USRP-users@lists.ettus.com > http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com ___ USRP-users mailing list USRP-users@lists.ettus.com http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
Re: [USRP-users] B210 -- AD9361 low-level access and changing filter configuration
Hi again, Some more info that I've gathered in the meantime on the issue: - the crashes seem more related to the fact that I've been dumping the retrieved I/Q pairs on file, so we could leave it out for the moment; - what I did to test whether the FIR is working as expected or not, is to retrieve its coefficients via the get_filter() function, cast the filter_info_base pointer to a digital_filter_fir pointer using a dynamic_pointer_cast, and then invoke the set_taps() function setting all coefficients to zero. If I re-read immediately the coefficients, they're all zeros as expected. However, reading them later shows that they're not zeros anymore. Indeed, given this configuration I should receive an identically null signal, but the signal seems to be untouched with respect to the "standard FIR setting". I could alter the UHD library (or the AD9361 driver) at "low level" to make it behave as I expect, but I would rather stick with a more gentle approach. Any idea? Thanks again! RH ___ USRP-users mailing list USRP-users@lists.ettus.com http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
[USRP-users] B210 -- AD9361 low-level access and changing filter configuration
Hi, I have been playing a bit with the API of UHD and I wonder if it is possible to have a low-level access to the underlying, low-level AD9361 API. In effect, what I would love to do is to play with the filters (the RX FIR filter in particular), but so far I haven't been that lucky (all I've managed to do is to make the software crash badly). In particular, I have experimented a bit with the set_taps() function call (after some very ugly casts), but either the system ignores it (re-reading the coefficients shows me that they're all zeros), or it makes the application crash (memory corruption). Can anyone point me to a good direction (besides the UHD manual), please? Thanks a lot in advance! RH ___ USRP-users mailing list USRP-users@lists.ettus.com http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com