MicroPhase / antsdr_uhd

This repo contains both the uhd host driver and firmware for microphase antsdr devices.
GNU General Public License v3.0
46 stars 30 forks source link

Run uhd commands into e200 without host #59

Open MatiP11dev opened 8 months ago

MatiP11dev commented 8 months ago

Hello, how can i run the uhd commands from the e200 embedded computer?

uptools commented 8 months ago

We compiled the antsdr_uhd for the host within the buildroot environment and tried to access the UHD device from the embedded Linux in the E200, but were not available to find it:

# uhd_find_devices 
[INFO] [UHD] linux; GNU C++ version 12.3.0; Boost_108200; UHD_4.3.0.0-275-g177170f4
No UHD Devices Found[ERROR] [UHD] Device discovery error: AssertionError: libusb_init(&_context) == 0
  in libusb_session_impl
  at /home/dertis25/projects/buildroot/output/build/uhd-4.3.0.0/host/lib/transport/libusb1_base.cpp:37

# uhd_find_devices --args serial=F5B1D172CA34935BFB4703304F4E7CB0
[INFO] [UHD] linux; GNU C++ version 12.3.0; Boost_108200; UHD_4.3.0.0-275-g177170f4
No UHD Devices Found[ERROR] [UHD] Device discovery error: AssertionError: libusb_init(&_context) == 0
  in libusb_session_impl
  at /home/dertis25/projects/buildroot/output/build/uhd-4.3.0.0/host/lib/transport/libusb1_base.cpp:37

# uhd_find_devices --args addr=192.168.1.10
No UHD Devices Found

Even though the UHD device is recognized from an ethernet connected Linux without problems:

# uhd_find_devices 
[INFO] [UHD] linux; GNU C++ version 11.4.0; Boost_107400; UHD_4.1.0.0-38-g84372477
--------------------------------------------------
-- UHD Device 0
--------------------------------------------------
Device Address:
    serial: F5B1D172CA34935BFB4703304F4E7CB0
    addr: 192.168.1.10
    name: ANTSDR-E200
    product: E200  v1
    type: ant

Any clues how to access the device from the embedded Linux will be appreciated.

lone-boy commented 8 months ago

I'm very sorry, but currently UHD firmware cannot run on the board, but from a technical point of view I think it can be achieved, and the development process may be cumbersome.

uptools commented 8 months ago

Hi @lone-boy, I assume currently a host with uhd utils would interact with the E200 via the /sbin/e200 process via UDP. The most easy way to do it from the embedded Linux would be to migrate uhd utils to the embedded linux and then access the device via localhost UDP, again through /sbin/e200. But we couldn't either connect the recompiled uhd utils to the localhost via UDP. Would you recommend any hints for this?

A better way would be to access a modified e200 directly. But we could not find the source code for the /sbin/e200 in the antdr_uhd project. Is the source code for it included?

black-pigeon commented 8 months ago

I don't think it's that simple. It's not just about the network; you may also need to implement the network driver between the PL and PS yourself. This is because your network data ultimately needs to interact with the components on the PL, rather than just looping back within the operating system.

uptools commented 8 months ago

Is there currently a driver or daemon (like /sbin/e200) receiving uhd packets from the interface and sending to the PL? Or the PL is handling them before the OS gets them?

black-pigeon commented 8 months ago

Currently, we have not implemented any interaction with UHD data packets on PS. We have only partially implemented PL Ethernet drivers on PS. You can find them here: https://github.com/MicroPhase/antsdr_uhd/tree/master/firmware/linux/drivers/net/ethernet/ni

uptools commented 8 months ago

Hi @black-pigeon, we need to run uhd-based applications in the embedded linux. May be you are also interested in this, as it would make the embedded processor in E200 useful for the original purpose of having a UHD device with a CPU. We would like to collaborate with you on this. We could engage a direct access from the PS to the transciever sample interface via the AXI and then make a driver to compatibilize with the UHD API, or we could try to make the PL receive UHD samples datagrams sourced from the embedded applications, in the same way it can now receive UHD samples datagrams sourced from outside hosts. What do you think of the proposal?

black-pigeon commented 8 months ago

Hello @uptools, this is what we plan to do in the future. The method you mentioned is indeed feasible. Our initial idea is to implement a virtual NIC between the PS and PL. This way, we would only need to modify the kernel driver and PL components, without making any changes to the UHD driver. In fact, the original USRP E310 from Ettus does support running UHD directly on the PS ARM. They use a structure called RFNOC, which is different from the traditional UHD structure we are using. We have other SDR products that can run on their RFNOC architecture, which means UHD can be run on ARM. However, that product is not yet launched. Here is the repository for creating RFNOC images: https://github.com/EttusResearch/meta-ettus