Issues after switching to usbradio from simpleusb driver

I recently set up a node with the ASL 2.0 image for RPi (on a Pi 4B) and it was working very well with simpleusb. The node is full-duplex (ie. duplex=3, not a repeater), using an HT that does cross-band full-duplex for the node radio. I was surprised at how smoothly the setup went, I only had to change a few settings in rpt.conf and everything then worked great.

Because I’m using an HT there is no COS line output, so I had built a circuit using a few op amps to detect any signal > ~1mV on the Rx audio line and assert COS in that case. This circuit works very well, but I’m hoping that usbradio’s carrierfrom = dsp option will be able to do the same thing and thus a hardware COS detection circuit should not be necessary at all, which would be great, as there are probably many people who have an old HT lying around that could be used for a node radio with no extra circuitry needed. (However this may not be a realistic expectation because in developing my COS detect circuit I found that the detection thresholds, peak detection and averaging need to be done a certain way or the COS will not trigger at a low enough level or might trigger when it shouldn’t eg. from RFI on a cable. BTW if anyone knows of any documentation on what exactly USBRadio should be capable of in these regards please let me know.)

The usbradio.conf settings seem pretty well documented and clear, but after setting it up and enabling in rpt.conf, ie. with the following,

; rxchannel = SimpleUSB/usb_571570      ; SimpleUSB
rxchannel = Radio/usb_571570            ; USBRadio (DSP)

And then restarting the Pi, I am seeing various errors. First asterisk would not start at all, and gave some errors which I did not make a copy of. Then it started running OK a couple attempts later. Doing a ‘sudo service asterisk status’ lists the following warnings and errors:

● asl-asterisk.service - AllStar Asterisk
   Loaded: loaded (/lib/systemd/system/asl-asterisk.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2022-11-01 20:48:36 UTC; 32min ago
     Docs: man:asterisk(8)
  Process: 509 ExecStartPre=/usr/bin/mkdir -p /run/asterisk (code=exited, status=0/SUCCESS)
 Main PID: 520 (asterisk)
    Tasks: 25 (limit: 4323)
   CGroup: /system.slice/asl-asterisk.service
           └─520 /usr/sbin/asterisk -g -f

Nov 01 20:48:38 node571570 asterisk[520]: [Nov  1 20:48:38] WARNING[577]: chan_usbradio.c:2738 usbradio_read: Possibly stuck USB read channel. [usb_571570]
Nov 01 20:48:38 node571570 asterisk[520]: [Nov  1 20:48:38] WARNING[577]: chan_usbradio.c:2741 usbradio_read: Nope, USB read channel [usb_571570] wasn't stuck after all.
Nov 01 21:00:07 node571570 asterisk[520]: [Nov  1 21:00:07] ERROR[577]: chan_usbradio.c:2661 usbradio_read: HID process has died or something!!
Nov 01 21:00:08 node571570 asterisk[520]: [Nov  1 21:00:08] WARNING[552]: app_rpt.c:22603 rpt_master: rpt_thread restarted on node 571570
Nov 01 21:00:08 node571570 asterisk[520]: ERROR: numrxcodes != numtxcodes
Nov 01 21:00:08 node571570 asterisk[520]: [Nov  1 21:00:08] WARNING[615]: chan_usbradio.c:1762 hidthread: Loaded parameters from usbradio_tune_usb_571570.conf for device usb_571570 .
Nov 01 21:00:08 node571570 asterisk[520]: [Nov  1 21:00:08] WARNING[614]: chan_usbradio.c:2738 usbradio_read: Possibly stuck USB read channel. [usb_571570]
Nov 01 21:00:08 node571570 asterisk[520]: [Nov  1 21:00:08] WARNING[614]: chan_usbradio.c:2741 usbradio_read: Nope, USB read channel [usb_571570] wasn't stuck after all.

Strangely, the PTT line seemed to be stuck on for awhile, but then after a couple reboots that issue went away and it now occasionally will do a transmit, but it does not seem to register anything I transmit to the node.

Here is the usbradio.conf file:

; If you are going to use this channel driver, you MUST enable it in modules.conf
; noload => chan_usbradio.so ;					CM1xx USB Cards with Radio Interface Channel Driver (DSP)
; to:
; load => chan_usbradio.so ;					CM1xx USB Cards with Radio Interface Channel Driver (DSP)

; Usbradio channel driver Configuration File

[general]

[usb_571570]

eeprom = 0			; EEPROM installed: 0,1
					; 0 = no (default) / 1 = yes

hdwtype = 0			; Leave this set to 0 for USB sound fobs modified using
					; the instructions from usbfob.pdf. Use a setting of 
					; 1 is for Dingotel/Sph interfaces.
 
rxboost = 1			; 0 - 20db attenuator inserted
					; 1 - 20db attenuator removed
					; Set to 1 for additonal gain if using a low-level receiver output

rxctcssrelax = 1	; reduce talkoff from radios w/o CTCSS TX HPF
					; Do not change this, leave this as a 1

rxsqhyst = 3000		; Setting Squelch Hysteresis. 3000 is the default; 500 seems good.
					; Then set the squelch to the highest number revealed when doing a "radio
					; tune rxsquelch" - running the command multiple (like 20) times in a row.
					; <http://allstarnode.com/wiki/lib/exe/fetch.php?media=asterisk-notes-wj8g.pdf>

txctcssdefault = 100.0		; default TX CTCSS frequency, any frequency permitted
rxctcssfreqs = 100.0,91.5	; RX CTCSS frequencies list in floating point. must be in table
txctcssfreqs = 100.0,91.5	; TX CTCSS frequencies list. any frequency OK. will follow RX CTCSS frequency
rxctcssoverride = 1			; Set to 1 to start out in carrier squelch mode

carrierfrom = dsp		; no,usb,usbinvert,dsp,vox 
						; no - no carrier detection at all
						; usb - from the COR line on the USB sound fob (Active high)
						; usbinvert - from the inverted COR line on the USB sound fob (Active low)
						; dsp - from RX noise using DSP techniques
						; vox - voice activated from RX audio

ctcssfrom = no			; no,usb,usbinvert,dsp
						; no - no CTCSS decoding, system will be carrier squelch
						; usb - from the CTCSS line on the USB sound fob (Active high)
						; usbinvert - from the inverted CTCSS line on the USB sound fob (Active low) 
						; dsp - CTCSS decoding using RX audio in DSP.
						; rxdemod option must be set to flat for this to work.

rxdemod = speaker		; input type from radio: no,speaker,flat
						; no - RX audio input not used
						; flat - Use RX audio from discriminator (before de-emphasis) (default)
						; speaker - use de-emphasized audio 

rxsquelchdelay = 20		; delayline in ms carrier squelch tail eliminator 

rxondelay = 0		; Number of 20mSec intervals following the release of PTT.
					; Uncomment and/or adjust for simplex nodes to eliminate "Ping Ponging"
					; or "Relay Racing". A positive value here will instruct the usbradio
					; driver to ignore the COR line for a specified number of 20mSec
					; intervals following the release of PTT. Use this ONLY on simplex
					; nodes, and leave commented out for repeaters or other full duplex nodes.

txboost = 0			; Add transmitter audio gain boost: 0,1

txprelim = no		; Audio processing on left output channel: no,yes
					; no - Audio is not pre-emphasized and limited. 
					; Suitable for use on a microphone input
					; yes - Audio is pre-emphasized and limited.
					; Suitable for direct connection to an FM modulator

txlimonly = yes		; Audio limiting with no pre-emphasis on output channel: no,yes
					; no - Audio is not limited. 
					; yes - Audio is limited.
					; Suitable for transmitters with no limiting but with pre-emphasis.

txtoctype = notone	; Transmit tone control type: no,phase,notone
					; no - CTCSS tone encoding with no hang time
					; phase - encode CTCSS and reverse phase AKA ("reverse burst") before unkeying TX
					; notone - encode CTCSS and stop sending tone before unkeying TX AKA ("chicken burst")

txmixa = voice		; Left channel output: no,voice,tone,composite,auxvoice
					; no - Do not output anything
					; voice - output voice only
					; tone - CTCSS tone only
					; composite - voice and tone
					; auxvoice - auxiliary voice output at headphone level for monitoring

txmixb = no		; Right channel output: no,voice,tone,composite, auxvoice
				; (same opts as for txmixa)

; Audio filters - requires version newer than ASL_1.01
rxlpf = 2			   	; Receiver Audio Low Pass Filter 0,1 2
						; 0 - 3.0 kHz cutoff (Default) value for reduced noise and increased intelligibility.
						; 1 - 3.3 kHz cutoff for increased high end, sibilance and brightness.
						; 2 - 3.5 kHz cutoff for even more high end, sibilance and brightness.
rxhpf = 1				; Receiver Audio High Pass Filter 0,1
						; 0 - 300 Hz cutoff. (Default) Reduce subaudible signals in ReTx and in the Rx speaker.
						; 1 - 250 Hz cutoff for additional received and retransmitted bass response.
						; recommend using this filter with a CTCSS tone no higher than 186.2 Hz.
txlpf = 1			 	; Transmitter Audio Low Pass Filter 0,1
						; 0 - 3.0 kHz cutoff. (Default) value.
						; 1 - 3.3 kHz cutoff for increased high end, sibilance and brightness.
txhpf = 1			   	; Transmitter Audio High Pass Filter 0,1,2
						; 0 - 300 Hz cutoff. (Default) Reduces interference between voice & sub-audible signaling.
						; 1 - 250 Hz cutoff for increased bass response in transmitted audio.
						; 2 - 120 Hz cutoff for special apps requiring additional bass response in Tx audio.
						; Not recommended due to possibility of voice energy interfering w/sub-audible signaling

invertptt = 0		; Invert PTT: 0,1 
					; 0 - ground to transmit
					; 1 - open to transmit

duplex = 1		; Duplex 0,1
				; 0 - half duplex
				; 1 - full duplex
duplex3 = 0		; duplex 3 gain setting (0 to disable) ???

#includeifexists custom/usbradio.conf

If I run asterisk -vvvr I see some occasional messages, and it seems to be running normally but I’m not familiar with what all the options are or what the best way is to dump the current status / errors. One thing I did try is rpt showvars 571570,

Variable listing for node 571570:
   RPT_TXKEYED=0
   RPT_ETXKEYED=1
   RPT_RXKEYED=1
   RPT_LINKS=0>
   RPT_NUMLINKS=0
   RPT_AUTOPATCHUP=0
    -- 6 variables

Thus it seems to think RX is keyed? But there is definitely not any RX audio coming in. My HT is using squelch in addition to CTCSS Tone Squelch enabled. Thus why I do not have any tones enabled in the usbradio.conf file.

Another odd thing is every ~5 minutes I get a short ~1 Sec transmit from the node with no audio, and the following messages in the console:

    -- Hungup 'DAHDI/pseudo-1607945115'
    -- Hungup 'DAHDI/pseudo-868058813'

Any help with debugging the above and hopefully getting usbradio to work would be greatly appreciated. Thanks, David

Just wanted to give you a quick reply to know there are a few qurks on a pi4,
but I can’t find a list I thought was out there.
Perhaps someone will have a definite answer for you.
So don’t make a bunch of config changes trying to make it work till you know.

But as a quick check, make sure it is in the listed usb slot and/or try the other header and change device slot to match…
lsusb

I’m making progress but there is still an issue… I needed to set carrierfrom to vox instead of dsp in usbradio.conf and usbradio now detects when I’m transmitting, however there is now an issue that after I unkey, the node continues to show that I’m keyed for another ~2 full seconds. How can the usbradio ‘vox’ settings be adjusted? I don’t see any mention of any such settings in the config file. It appears there is definitely some sort of hold/release timer which ideally should be set to no more than 100mS, otherwise it will always cause a significant delay on whatever remote nodes I’m connected to and prevent other nodes from being able to key up.

I looked through asterisk/channels/chan_usbradio.c but the code is a little hard to follow and does not have much documentation/comments. I see some log message calls there e.g. if(!o->rxkeyed && o->debuglevel)ast_log(LOG_NOTICE,"o->rxkeyed = 1, chan %... but could not find any such messages in the logs in /var/log/asterisk/. Is there some other place those log messages might be going or do I need to enable this extended log debuglevel somewhere?

As some background, I knew the correct USB port was being used as it was transmitting fine on the usb audio interface, thus the PTT line is going out, and I had ran the radio-tune-menu from asl-menu and confirmed it showed the correct usb device and that my Rx audio level is set correctly. If I disable squelch on the radio and set the volume control to 12 O’Clock the radio-tune utility then shows exactly 5KHz deviation so this was set as I expected, and, when the squelch is on on the radio, there is no signal at all shown in the utility, also as expected, so it’s a mystery why usbradio thinks there is a carrier when in carrierfrom=dsp mode when there is in fact no audio signal coming in. Thus when the node would power up the usbradio driver would think it was seeing a signal and then start transmitting since duplex=3. Then after 3 minutes the transmit time out timer would elapse and it would stop transmitting.

The carrierfrom=dsp mode is probably designed for the context of a repeater controller where usbradio is processing raw unsquelched discriminator audio and making its own squelch/carrier determination based on the frequency content of the signal, ie. looking at the spectral content and presence of voice characteristics and maybe CTCSS, vs. broadband static.

I had assumed the carrierfrom=vox mode might work more like a typical VOX circuit, which have a somewhat high activation threshold and may look for voice vs noise spectral signatures, but fortunately that is not the case and usbradio is doing what I had hoped and reliably detecting the presence of any signal on the Rx audio line. Even if I’m not talking - but am keyed up and there’s that ~1mV of background room noise, it detects that perfectly with no carrier drops, and no false triggers. However, when I unkey, the vox mode has a long ‘Hold’ time which is now causing 2 seconds of silence to be added to every transmit.

If this can be fixed this will be great news anyone who would like to use an HT for a node radio but who doesn’t want to hack apart the HT to access the COS line. Thanks, David

UPDATE: I found the culprit in asterisk/channels/xpmr/xpmr.c:
#define XPMR_VOX_HANGTIME 2000
This is a hardcoded define that can only be changed by compiling the code, which I’ll try doing. I’ll also open a bug report since this seems like an arbitrary and long delay that will always cause a 2 second delay in courtesy tones and in other nodes being able to key up. To make this generally available and fully configurable for all ASL users this should be changed from a hardcoded #define to a cfg variable in one of the the .conf files. I can figure out how to do that easily enough (I was a C programmer from 1993-2010 and am on github), but maybe one of the devs can take care of it more quickly. Either way I’ll try to follow the Developer instructions on the site, make and test the changes and submit a pull request.

I was able to resolve this by compiling ASL 2 beta on my RPi by following the instructions on GitHub - AllStarLink/ASL-Asterisk: Version of Asterisk used for AllStarLink and changing the XPMR_VOX_HANGTIME to 500 mS in channels/xpmr/xpmr.c and verified that everything now works very well with no long delays after I unkey, and I see no false drops in carrier detect even when not talking. Since the code is easy to compile this was an easy fix for me, but hopefully for the benefit of other users of usbradio vox this will be made configurable in a future ASL release.

1 Like

This is GREAT information and should be of benefit to those who can’t get COS logic from their radio.

Thank you!

Kevin W3KKC

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.