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

ant-sdr E200 on Ubuntu 24.04 - UHD issues #79

Open mitshell opened 3 weeks ago

mitshell commented 3 weeks ago

Here is my adventure in trying to make my ant-sdr work. date: 2024/06/06 OS: Ubuntu 24.04 Following: https://antsdr-docs.microphase.cn/en/latest/device_and_usage_manual/E200_Getting_Started_Guide.html

1) IIO based firmware

It seems the libad9361.so is not yet build when make tries to build the Python bindings at first iteration, hence we need to run make twice. The Python bindings will build on the 2nd run.

The IIO driver seems to be working OK afterward.

2) UHD based firmware

Need to declare #include <cstdint> in: ~/src/antsdr_uhd/host/include/uhd/cal/database.hpp ~/src/antsdr_uhd/host/include/uhd/rfnoc/defaults.hpp ~/src/antsdr_uhd/host/lib/usrp/dboard/magnesium/magnesium_constants.hpp

Need to declare #include <boost/math/special_functions/sign.hpp> in: ~/src/antsdr_uhd/host/lib/usrp/cores/rx_dsp_core_3000.cpp ~/src/antsdr_uhd/host/lib/usrp/cores/rx_frontend_core_3000.cpp ~/src/antsdr_uhd/host/lib/usrp/cores/dsp_core_utils.cpp

Need to declare #include <array> in: ~/src/antsdr_uhd/host/lib/usrp/common/lmx2592.cpp

Need to declare #include <complex> in: ~/src/antsdr_uhd/host/test/tx_streamer_test.cpp

The UHD driver seems to be working OK afterward.

3) Testing the UHD mode with Ettus tools

The device radio front-end is recognized:

$ uhd_usrp_probe 
[INFO] [UHD] linux; GNU C++ version 13.2.0; Boost_108300; UHD_4.1.0.0-0-9abe8bc8
[INFO] [ANT] Detected Device: ANTSDR
[INFO] [ANT] Initialize CODEC control...
[INFO] [ANT] Initialize Radio control...
[INFO] [ANT] Performing register loopback test... 
[INFO] [ANT] Register loopback test passed
[INFO] [ANT] Performing register loopback test... 
[INFO] [ANT] Register loopback test passed
[INFO] [ANT] Setting master clock rate selection to 'automatic'.
[INFO] [ANT] Asking for clock rate 16.000000 MHz... 
[INFO] [ANT] Actually got clock rate 16.000000 MHz.
  _____________________________________________________
 /
|       Device: B-Series Device
|     _____________________________________________________
|    /
|   |       Mboard: B210
|   |   magic: 45568
|   |   eeprom_revision: v0.1
|   |   eeprom_compat: 1
|   |   product: MICROPHASE
|   |   name: ANT
|   |   serial: 4210AABBF8ABEDD0F5611F2C27C849C5
|   |   FPGA Version: 16.0
|   |   
|   |   Time sources:  none, internal, external
|   |   Clock sources: internal, external
|   |   Sensors: ref_locked
|   |     _____________________________________________________
|   |    /
|   |   |       RX DSP: 0
|   |   |   
|   |   |   Freq range: -8.000 to 8.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       RX DSP: 1
|   |   |   
|   |   |   Freq range: -8.000 to 8.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       RX Dboard: A
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       RX Frontend: A
|   |   |   |   Name: FE-RX1
|   |   |   |   Antennas: TX/RX, RX2
|   |   |   |   Sensors: temp, rssi, lo_locked
|   |   |   |   Freq range: 50.000 to 6000.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 76.0 step 1.0 dB
|   |   |   |   Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       RX Frontend: B
|   |   |   |   Name: FE-RX2
|   |   |   |   Antennas: TX/RX, RX2
|   |   |   |   Sensors: temp, rssi, lo_locked
|   |   |   |   Freq range: 50.000 to 6000.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 76.0 step 1.0 dB
|   |   |   |   Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       RX Codec: A
|   |   |   |   Name: B210 RX dual ADC
|   |   |   |   Gain Elements: None
|   |     _____________________________________________________
|   |    /
|   |   |       TX DSP: 0
|   |   |   
|   |   |   Freq range: -8.000 to 8.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       TX DSP: 1
|   |   |   
|   |   |   Freq range: -8.000 to 8.000 MHz
|   |     _____________________________________________________
|   |    /
|   |   |       TX Dboard: A
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       TX Frontend: A
|   |   |   |   Name: FE-TX1
|   |   |   |   Antennas: TX/RX
|   |   |   |   Sensors: temp, lo_locked
|   |   |   |   Freq range: 50.000 to 6000.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 89.8 step 0.2 dB
|   |   |   |   Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       TX Frontend: B
|   |   |   |   Name: FE-TX2
|   |   |   |   Antennas: TX/RX
|   |   |   |   Sensors: temp, lo_locked
|   |   |   |   Freq range: 50.000 to 6000.000 MHz
|   |   |   |   Gain range PGA: 0.0 to 89.8 step 0.2 dB
|   |   |   |   Bandwidth range: 200000.0 to 56000000.0 step 0.0 Hz
|   |   |   |   Connection Type: IQ
|   |   |   |   Uses LO offset: No
|   |   |     _____________________________________________________
|   |   |    /
|   |   |   |       TX Codec: A
|   |   |   |   Name: B210 TX dual DAC
|   |   |   |   Gain Elements: None

All the UHD calibration routines are leading to a similar error as this:

$ uhd_cal_tx_dc_offset

Creating the usrp device with: ,ignore_cal_file=1,ignore-cal-file=1...
[INFO] [UHD] linux; GNU C++ version 13.2.0; Boost_108300; UHD_4.1.0.0-0-9abe8bc8
[INFO] [ANT] Detected Device: ANTSDR
[INFO] [ANT] Initialize CODEC control...
[INFO] [ANT] Initialize Radio control...
[INFO] [ANT] Performing register loopback test... 
[INFO] [ANT] Register loopback test passed
[INFO] [ANT] Performing register loopback test... 
[INFO] [ANT] Register loopback test passed
[INFO] [ANT] Setting master clock rate selection to 'automatic'.
[INFO] [ANT] Asking for clock rate 16.000000 MHz... 
[INFO] [ANT] Actually got clock rate 16.000000 MHz.
Running calibration for FE-TX1
Daughterboard serial: 
Error: This board does not have the CAL antenna option, cannot self-calibrate.

Here is an attempt with uhd_fft:

$ uhd_fft -a "type=ant,addr=192.168.1.10" -s 10M -f 2.4G
QSocketNotifier: Can only be used with threads started with QThread
[INFO] [UHD] linux; GNU C++ version 13.2.0; Boost_108300; UHD_4.6.0.0+ds1-5.1build4
Traceback (most recent call last):
  File "/usr/bin/uhd_fft", line 627, in <module>
    main()
  File "/usr/bin/uhd_fft", line 608, in main
    top_block = uhd_fft(args)
                ^^^^^^^^^^^^^
  File "/usr/bin/uhd_fft", line 138, in __init__
    self.setup_usrp(uhd.usrp_source, args)
  File "/usr/lib/python3/dist-packages/gnuradio/uhd/uhd_app.py", line 149, in setup_usrp
    self.usrp = ctor(
                ^^^^^
RuntimeError: LookupError: KeyError: No devices found for ----->
Device Address:
    type: ant
    addr: 192.168.1.10

Benchmarking the Ethernet link is fine, up to 20Msps:

$ ./benchmark_rate --args "type=ant,addr=192.168.1.10" --duration=10 --rx_rate 20000000 --tx_rate 20000000

[INFO] [UHD] linux; GNU C++ version 13.2.0; Boost_108300; UHD_4.1.0.0-0-9abe8bc8
[00:00:00.002934] Creating the usrp device with: type=ant,addr=192.168.1.10...
[INFO] [ANT] Detected Device: ANTSDR
[INFO] [ANT] Initialize CODEC control...
[INFO] [ANT] Initialize Radio control...
[INFO] [ANT] Performing register loopback test... 
[INFO] [ANT] Register loopback test passed
[INFO] [ANT] Performing register loopback test... 
[INFO] [ANT] Register loopback test passed
[INFO] [ANT] Setting master clock rate selection to 'automatic'.
[INFO] [ANT] Asking for clock rate 16.000000 MHz... 
[INFO] [ANT] Actually got clock rate 16.000000 MHz.
Using Device: Single USRP:
  Device: B-Series Device
  Mboard 0: B210
  RX Channel: 0
    RX DSP: 0
    RX Dboard: A
    RX Subdev: FE-RX1
  RX Channel: 1
    RX DSP: 1
    RX Dboard: A
    RX Subdev: FE-RX2
  TX Channel: 0
    TX DSP: 0
    TX Dboard: A
    TX Subdev: FE-TX1
  TX Channel: 1
    TX DSP: 1
    TX Dboard: A
    TX Subdev: FE-TX2

[00:00:01.25434459] Setting device timestamp to 0...
[INFO] [ANT] Asking for clock rate 20.000000 MHz... 
[INFO] [ANT] Actually got clock rate 20.000000 MHz.
[00:00:01.497791405] Testing receive rate 20.000000 Msps on 1 channels
Setting TX spp to 364
[00:00:01.521816999] Testing transmit rate 20.000000 Msps on 1 channels
[00:00:11.984896350] Benchmark complete.

Benchmark rate summary:
  Num received samples:     205479536
  Num dropped samples:      0
  Num overruns detected:    0
  Num transmitted samples:  205235212
  Num sequence errors (Tx): 0
  Num sequence errors (Rx): 0
  Num underruns detected:   0
  Num late commands:        0
  Num timeouts (Tx):        0
  Num timeouts (Rx):        0

Done!

Testing for UHD control messages shows all of them are failing, except the late command ones:

./test_messages --args "type=ant,addr=192.168.1.10"

Creating the usrp device with: type=ant,addr=192.168.1.10...
[INFO] [UHD] linux; GNU C++ version 13.2.0; Boost_108300; UHD_4.1.0.0-0-9abe8bc8
[INFO] [ANT] Detected Device: ANTSDR
[INFO] [ANT] Initialize CODEC control...
[INFO] [ANT] Initialize Radio control...
[INFO] [ANT] Performing register loopback test... 
[INFO] [ANT] Register loopback test passed
[INFO] [ANT] Performing register loopback test... 
[INFO] [ANT] Register loopback test passed
[INFO] [ANT] Setting master clock rate selection to 'automatic'.
[INFO] [ANT] Asking for clock rate 16.000000 MHz... 
[INFO] [ANT] Actually got clock rate 16.000000 MHz.
Using Device: Single USRP:
  Device: B-Series Device
  Mboard 0: B210
  RX Channel: 0
    RX DSP: 0
    RX Dboard: A
    RX Subdev: FE-RX1
  RX Channel: 1
    RX DSP: 1
    RX Dboard: A
    RX Subdev: FE-RX2
  TX Channel: 0
    TX DSP: 0
    TX Dboard: A
    TX Subdev: FE-TX1
  TX Channel: 1
    TX DSP: 1
    TX Dboard: A
    TX Subdev: FE-TX2

[INFO] [ANT] Asking for clock rate 32.000000 MHz... 
[INFO] [ANT] Actually got clock rate 32.000000 MHz.
Test time error message... failed:
    Async message recv timed out.

Test underflow message... Ufailed:
    Async message recv timed out.

Test burst ack message... failed:
    Async message recv timed out.

Test underflow message... Ufailed:
    Async message recv timed out.

Test time error message... Lfailed:
    Async message recv timed out.

Test late command message... success:
    Got error code late command message.

Test underflow message... Ufailed:
    Async message recv timed out.

Test time error message... Lfailed:
    Async message recv timed out.

Test late command message... success:
    Got error code late command message.

Test late command message... success:
    Got error code late command message.

Test late command message... success:
    Got error code late command message.

Test late command message... success:
    Got error code late command message.

Test late command message... success:
    Got error code late command message.

Test late command message... success:
    Got error code late command message.

Test late command message... success:
    Got error code late command message.

Test time error message... Lfailed:
    Async message recv timed out.

Test underflow message... Ufailed:
    Async message recv timed out.

Test time error message... Lfailed:
    Async message recv timed out.

Test late command message... success:
    Got error code late command message.

Test burst ack message... failed:
    Async message recv timed out.

Test time error message... Lfailed:
    Async message recv timed out.

Test burst ack message... failed:
    Async message recv timed out.

Test time error message... Lfailed:
    Async message recv timed out.

Test time error message... Lfailed:
    Async message recv timed out.

Test late command message... success:
    Got error code late command message.

Test late command message... success:
    Got error code late command message.

Test burst ack message... failed:
    Async message recv timed out.

Test time error message... Lfailed:
    Async message recv timed out.

Test underflow message... Ufailed:
    Async message recv timed out.

Test burst ack message... failed:
    Async message recv timed out.

Test time error message... Lfailed:
    Async message recv timed out.

Test burst ack message... failed:
    Async message recv timed out.

Test time error message... Lfailed:
    Async message recv timed out.

Test time error message... Lfailed:
    Async message recv timed out.

Test underflow message... Ufailed:
    Async message recv timed out.

Test burst ack message... failed:
    Async message recv timed out.

Test time error message... Lfailed:
    Async message recv timed out.

Test time error message... Lfailed:
    Async message recv timed out.

Test time error message... Lfailed:
    Async message recv timed out.

Test underflow message... Ufailed:
    Async message recv timed out.

Test time error message... Lfailed:
    Async message recv timed out.

Test underflow message... Ufailed:
    Async message recv timed out.

Test burst ack message... failed:
    Async message recv timed out.

Test underflow message... Ufailed:
    Async message recv timed out.

Test burst ack message... failed:
    Async message recv timed out.

Test burst ack message... failed:
    Async message recv timed out.

Test late command message... success:
    Got error code late command message.

Test underflow message... Ufailed:
    Async message recv timed out.

Test time error message... Lfailed:
    Async message recv timed out.

Test time error message... Lfailed:
    Async message recv timed out.

Summary:

Test Burst ACK    ->     0 successes,  10 failures
Test Underflow    ->     0 successes,  10 failures
Test Time Error   ->     0 successes,  18 failures
Test Late Command   ->    12 successes,   0 failures

Done!

Finally, it seems no signal is received when testing with:

/rx_ascii_art_dft --args "addr=192.168.1.10" --rate 20000000 --freq 2470000000 --gain 20 --dyn-rng 100

There is nothing over -80dB, while a WiFi antenna is on the RX port and I believe some signals should appear.

4) Testing with radio applications

One of the main issue seems to be the kind of arguments that need to be passed, e.g. -a "driver=uhd,type=ant,addr=192.168.1.10,..." It seems the device in UHD mode is not recognized by most of the SDR applications.