Re: Troubleshooting ThumbDV HW AMBE chip with Analog_Bridge


Steve N4IRS
 

David,
There are typically 2 issues with the ThumbDV on a RPi:
1: Power, The ThumbDV is very sensitive  to power drops See <https://dvswitch.groups.io/g/main/message/315?p=,,,20,0,0,0::relevance,,DV3000u,20,2,0,5521534>
2: FTDI latency, as root:
    cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
    If the result is greater then 1
    echo 1 > /sys/bus/usb-serial/devices/ttyUSB0/latency_timer

73, Steve N4IRS


On 9/6/19 12:32 AM, David Ranch wrote:

Hello Everyone,

I have a working DMR TG to Analog DVSwitch setup working here using the included "Project 25 IMBE Encoder/Decoder Fixed-Point implementation" SW emulation on an Rpi3B+.  It was recommended to go with a hardware AMBE solution for the best audio quality so I bought a NWDigital ThumbDV.  It seems things the new hardware is functioning:

   - ThumbDV seen as /dev/ttyUSB0
   - ThumbDV LEDs light up when people are talking on the DMR talk group
   - No errors in dmesg
   - No errors shown from the Analog_Bridge output from STDOUT
   - Load on the Rpi is around 0.35


Yet the resulting analog audio is segmented up.  When I say segmented up, I mean the audio is coming through but I'm hearing gaps in the analog audio every 300ms or so (a guess) and it seems to be substantially slowed down compared to the audio I hear on a DMR HT.  What's especially interesting that at the end of a long transmission, the Rpi can be 15-20 seconds delayed  though the pitch of the voice is still correct!  That's some SERIOUS buffering that is not experienced when using the SW vocoder.
 

I did some various research on the web and found the AMBEtest4.py script at:

   https://raw.githubusercontent.com/DVSwitch/Analog_Bridge/master/scripts/AMBEtest4.py

but it seems this is a Python2 script but my Rpi only has Python3.  I did install all the required Python modules and did port the various print statements to by Python3 compatible but I started getting into some difficult errors that I couldn't get past.  Does anyone have a version of this that's Python3 compatible?

Any other  thoughts on why this might be happening?  If I switch back to the SW IMBE vocoder, the analog audio is smooth with a average load of 0.90.

--David
KI6ZHD


cat /etc/lsb-release
LSB_VERSION=1.4
DISTRIB_ID=Arch
DISTRIB_RELEASE=rolling
DISTRIB_DESCRIPTION="Arch Linux"


Linux ww6bay-asl 4.14.97-1-ARCH #1 SMP Tue Feb 5 20:10:34 UTC 2019 armv7l GNU/Linux


Analog_Bridge.ini
----------------------------------------------------------------------------------------------------------------------------------
; Analog_Bridge configuration file.                                                       
;   This file should be placed in either /etc or it can be                                
;   supplied as a path on the Analog_Bridge command line.                                 

; General Section describes settings for Analog_Bridge itself.
;   For RPI, don't forget to modprobe snd_pcm_oss to get the devices populated
[GENERAL]                                                                    
logLevel = 2                            ; Show messages and above 0=No logging, 1=Debug, 2=Message, 3=Info, 4=Warning, 5=Error, 6=Fatal

; Metadata management
exportMetadata = true                   ; Export metadata to USRP partner (transcode setups require this)
subscriberFile = /var/lib/dvswitch/subscriber_ids.csv   ; DMR ID to callsign lookup data                

; General vocoder setup information
decoderFallBack = false                ; Allow software AMBE decoding if a hardware decoder is not found
useEmulator = false                     ; Use the MD380 AMBE emulator for AMBE72 (DMR/YSFN/NXDN)       
emulatorAddress = 127.0.0.1:2470        ; IP address and port of the server                            

; Audio devices are normally not needed when in gateway service.  These devices should
; only be set when local monitor or dongle modes are required.
outputAudioDevice = /dev/null           ; Audio device /dev/null, /dev/dsp1, portaudio, etc
inputAudioDevice = /dev/null            ; Only used for dongle mode

; Below values are for using this as a local DMR dongle (no ASL needed)
useMicrophone = false                   ; Use app as just a fancy dongle for DMR
useVox = false                          ; If using dongle mode (useMicrophone), enable VOX
voxDecay = 2                            ; Hang time in seconds
voxTrigger = 200                        ; Value to trip PTT (0-32767)

; Information for xx_Bridges (Where xx is MMDVM, HB, IPSC)
[AMBE_AUDIO]
server = 127.0.0.1                      ; IP address of xx_Bridge.py
fromDMRPort = 31100                     ; was rxport; AMBE frames from xx_Bridge (should match "toGatewayPort" in xx_Bridge.cfg)
toDMRPort = 31103                       ; was txport; AMBE frames from xx_Bridge (should match "fromGatewayPort" in xx_Bridge.cfg)
ambeMode = DMR                          ; DMR, DMR_IPSC, DSTAR, NXDN, P25, YSFN, YSFW
minTxTimeMS = 2000                      ; Minimum time in MS for hang delay
gatewayDmrId = <removed>                ; ID the DMR listener will see when Allstar people speak; the repeater's main DMR ID; ID to use when transmitting from Analog_Bridge
repeaterID = <removed>                   ; private DMR ID used in the MMDVM bridge config; ID of source repeater
txTg = 31075                            ; TG to use for all frames received from Analog_Bridge -> xx_Bridge
txTs = 2                                ; Slot to use for frames received from Analog_Bridge -> xx_Bridge
colorCode = 1                           ; Color Code to assign DMR frames

; Information for USRP channel driver.  This interface uses PCM to transfer audio information
; There are two typical configurations, ASL and Transcode.  ASL (AllstarLink) is for analog clients connected
; to a digital network.  Transcode is when Analog_Bridge actually points its PCM interfaces back at itself,
; causing a TLV <-- (pcm <--> pcm) --> TLV type of architecture.
;   When using ASL, this matches the rpt.conf ASL file with a setting like:
;   rxchannel = usrp/127.0.0.1:34001:32001
;   When Transcoding, make toASLPort equal to the other instance fromASLPort (crossover)
[USRP]
server = 127.0.0.1                      ; IP address of Allstar/Asterisk
toASLPort = 32001                       ; Analog_Bridge <-- ASL
fromASLPort = 34001                     ; Analog_Bridge --> ASL
aslAudio = AUDIO_UNITY                  ; Audio to ASL (AUDIO_UNITY, AUDIO_USE_AGC, AUDIO_USE_GAIN)
agcGain = -20                           ; Gain (in db) of the AGC filter
dmrAudio = AUDIO_UNITY                  ; Audio from ASL (AUDIO_UNITY, AUDIO_USE_GAIN, AUDIO_BPF)
dmrGain = 0.35                          ; Gain factor of audio from ASL (0.0-1.0)

; Information for DV3000 hardware decoder
;   There are two configuration modes: IP (AMBEServer) and serial (direct connect hardware)
;   Use top server and port if using AMBEServer
;   Use bottom server/port and serial = true if using the DV3000u (thumbdv)
;   Did you run AMBETest4.py before using this?
[DV3000]
; server = 127.0.0.1                      ; IP address of AMBEServer
; port = 2460                             ; Port of AMBEServer
server = /dev/ttyUSB0                 ; Device of DV3000U on this machine
port = 460800                         ; Baud rate of the dongle
serial = true                         ; Use serial (DV3000U) or IP
----------------------------------------------------------------------------------------------------------------------------------


[root@ww6bay-asl Analog_Bridge]# /opt/Analog_Bridge/Analog_Bridge /opt/Analog_Bridge/Analog_Bridge.ini
I: 2019-09-06 03:00:10.769 Analog Bridge Version 1.1 Wed  9 May 05:56:17 EDT 2018                    
I: 2019-09-06 03:00:10.769 Copyright (C) 2018 DVSwitch, INAD.                                        
I: 2019-09-06 03:00:10.769 Created by Mike N4IRR and Steve N4IRS                                     
I: 2019-09-06 03:00:10.769 Analog Bridge comes with ABSOLUTELY NO WARRANTY                           
I: 2019-09-06 03:00:10.769                                                                           
I: 2019-09-06 03:00:10.769 This software is for use on amateur radio networks only,                  
I: 2019-09-06 03:00:10.770 it is to be used for educational purposes only. Its use on                
I: 2019-09-06 03:00:10.770 commercial networks is strictly prohibited.                               
I: 2019-09-06 03:00:10.770                                                                           
I: 2019-09-06 03:00:10.770 Analog Bridge is starting                                                 
M: 2019-09-06 03:00:10.770 Setting [GENERAL] logLevel -> 2                                           
M: 2019-09-06 03:00:10.770 Setting [GENERAL] exportMetadata -> true                                  
M: 2019-09-06 03:00:10.770 Setting [GENERAL] subscriberFile -> /var/lib/dvswitch/subscriber_ids.csv  
M: 2019-09-06 03:00:10.770 Setting [GENERAL] decoderFallBack -> false                                
M: 2019-09-06 03:00:10.770 Setting [GENERAL] useEmulator -> false                                    
M: 2019-09-06 03:00:10.770 Setting [GENERAL] emulatorAddress -> 127.0.0.1:2470
M: 2019-09-06 03:00:10.770 Setting [GENERAL] outputAudioDevice -> /dev/null
M: 2019-09-06 03:00:10.770 Setting [GENERAL] inputAudioDevice -> /dev/null
M: 2019-09-06 03:00:10.770 Setting [GENERAL] useMicrophone -> false
M: 2019-09-06 03:00:10.770 Setting [GENERAL] useVox -> false
M: 2019-09-06 03:00:10.771 Setting [GENERAL] voxDecay -> 2
M: 2019-09-06 03:00:10.771 Setting [GENERAL] voxTrigger -> 200
M: 2019-09-06 03:00:10.771 Setting [AMBE_AUDIO] server -> 127.0.0.1
M: 2019-09-06 03:00:10.771 Setting [AMBE_AUDIO] fromDMRPort -> 31100
M: 2019-09-06 03:00:10.771 Setting [AMBE_AUDIO] toDMRPort -> 31103
M: 2019-09-06 03:00:10.771 Setting [AMBE_AUDIO] ambeMode -> DMR
M: 2019-09-06 03:00:10.771 Setting [AMBE_AUDIO] minTxTimeMS -> 2000
M: 2019-09-06 03:00:10.771 Setting [AMBE_AUDIO] gatewayDmrId -> <removed>
M: 2019-09-06 03:00:10.771 Setting [AMBE_AUDIO] repeaterID -> <removed>
M: 2019-09-06 03:00:10.771 Setting [AMBE_AUDIO] txTg -> 31075
M: 2019-09-06 03:00:10.771 Setting [AMBE_AUDIO] txTs -> 2
M: 2019-09-06 03:00:10.771 Setting [AMBE_AUDIO] colorCode -> 1
M: 2019-09-06 03:00:10.771 Setting [USRP] server -> 127.0.0.1
M: 2019-09-06 03:00:10.771 Setting [USRP] toASLPort -> 32001
M: 2019-09-06 03:00:10.771 Setting [USRP] fromASLPort -> 34001
M: 2019-09-06 03:00:10.771 Setting [USRP] aslAudio -> AUDIO_UNITY
M: 2019-09-06 03:00:10.771 Setting [USRP] agcGain -> -20
M: 2019-09-06 03:00:10.771 Setting [USRP] dmrAudio -> AUDIO_UNITY
M: 2019-09-06 03:00:10.771 Setting [USRP] dmrGain -> 0.35
M: 2019-09-06 03:00:10.771 Setting [DV3000] server -> /dev/ttyUSB0
M: 2019-09-06 03:00:10.771 Setting [DV3000] port -> 460800
M: 2019-09-06 03:00:10.772 Setting [DV3000] serial -> true
W: 2019-09-06 03:00:10.772 ioctl reset error
W: 2019-09-06 03:00:10.772 ioctl speed error
W: 2019-09-06 03:00:10.772 ioctl stereo error
W: 2019-09-06 03:00:10.772 ioctl setfmt error
M: 2019-09-06 03:00:10.772 Audio In/Out Device: /dev/null
I: 2019-09-06 03:00:10.772 Open UDP listener on 127.0.0.1:31100
I: 2019-09-06 03:00:10.772 Open USRP on 127.0.0.1:32001
M: 2019-09-06 03:00:10.772 Connecting to DV3000 hardware......
M: 2019-09-06 03:00:10.808 Begin DV3000 decode
Project 25 IMBE Encoder/Decoder Fixed-Point implementation
Developed by Pavel Yazev E-mail: pyazev@...
Version 1.0 (c) Copyright 2009
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; see the file ``LICENSE'' for details.
I: 2019-09-06 03:00:10.808 Subscriber IDs loaded: 0
I: 2019-09-06 03:00:10.808 Default extended metadata <3107955>
I: 2019-09-06 03:00:10.809 Using hardware AMBE vocoder
I: 2019-09-06 03:00:10.809 Starting Analog_Bridge --> USRP thread
I: 2019-09-06 03:00:10.809 Open UDP listener on 127.0.0.1:34001
I: 2019-09-06 03:00:10.809 Starting USRP --> HB_Bridge thread


Join main@DVSwitch.groups.io to automatically receive all group messages.