Homebrew, open source, repurposed, hacked, software defined, open hardware

Saturday, 30 April 2016

Importing or converting gerber files into gEDA PCB layouts

Being able to convert gerber files into pcb layouts can be useful for a couple of reasons, namely:

- acquiring exotic footprints
- modifying existing designs
- reverse engineering designs
- snatching previous design efforts from the jaws of obsolescent, closed EDA software products, forced upgrade paths, or cloud based services

Luckily, most of the hard work was done at the turn of the century by Philipp Knirsch, who wrote some gerber parsing code in java that can be used to render gerbers. Philipp licensed his gerber parsing code as GPL2:

http://www.wizards.de/phil/java/rs274x.html

The code was modified to play nicely with translate2geda as a conversion option, and now exports gEDA PCB elements in a footprint file.

The footprint file allows new tracks and pads to be snapped to the locations very easily, and since each feature in the footprint file is uniquely numbered, mouse over on the features allows the identifier to be determined, and using the unique identifiers, the element or elements can be copied from the footprint file with a text editor, for example, if a grouping of elements is needed to duplicate a footprint.

I may try to implement layout export with tracks and pads in different layers, but this will be complicated, since some EDA tools paint features such as pads, polygons and tracks, rather than flashing them, making it hard to determine which features are pads vs trackwork.

Only four sided polygons are supported currently, in order to identify rectangular pads which have not been flashed. This may be extended to capture octagonal pads, such as those supported by Eagle and gEDA PCB, and the gEDA PCB fork pcb-rnd.

Ground pour polygons and other complex polygons will not be supported, unless I implement the layout export option, since gEDA footprints do not support arbitrary polygons.

Here's a bottom copper layer gerber viewed in gerbv:


and here's the output from the translate2geda utility being viewed in gEDA PCB


To use the translate2geda utility to convert gerbers like this, you'll need to get yourself on over to github, get the java source and follow the build and use instructions.

I hope to implement Kicad export once the wrinkles have been ironed out and the translate2geda code refactored a bit.

The translate2geda utility will also convert manufacturer agnostic BXL files, Eagle XML libraries, BSDL (.bsd) files, IBIS (.ibs), symdef, LT-Spice and QUCS files into gEDA gschem and gEDA PCB compatible footprint and schematic symbols as well.

The KicadModuleToGEDA and KicadSymbolToGEDA  functionality will be merged into the translate2geda utility in due course, adding Kicad Symbol and Footprint conversion to gEDA gschem and PCB  formats as well.

Thursday, 3 March 2016

Converting IBIS, BXL, BSDL, symdef, Eagle, and Kicad design elements to gEDA

It's turning into something of a compulsion, but after writing the code for converting legacy and s-expression format Kicad footprints (modules) to gEDA PCB compatible footprints:

https://github.com/erichVK5/KicadModuleToGEDA

a converter for Kicad symbols, to convert them to gEDA gschem compatible symbols, seemed like the logical thing to do next:

https://github.com/erichVK5/KicadSymbolToGEDA/

With the basic software objects written, extending them with additional methods to support additional formats became easier and easier, and I have now put a working version of translate2geda on github:

https://github.com/erichVK5/translate2geda

It currently supports conversion of the following formats into symbols and footprints compatible with the FOSS gEDA EDA suite:

Eagle footprints (in XML .lbr files)
Eagle symbols (in XML .lbr files)
vendor neutral BXL files
BSDL files
IBIS files
symdef files

When time permits, I plan to incorporate the original Kicad module and symbol converter code into the now more modular translate2geda code. Until then, the individual converters can be used by those keen to convert Kicad design elements.

In addition, support for the upverter (.upv) open format is planned, and gerber -> footprint/layout is a work in progress.

Once things are behaving, I intend to implement export to Kicad as well. This should not be hard, since much of the code relies on Kicad flags and dimensions, around  which the original solution was designed.

With that done, export to Eagle is also planned, since they were nice enough to implement an open XML format.

FOSS EDA suites should ideally leverage each other's efforts, rather than reinventing the wheel, and being able to share symbols and footprints is an obvious way to do this.

Stretch goal:

schematic conversion

Here's a simple board intended for use in an eggbot designed in gEDA PCB, using an Arduino nano footprint, TO-220 footprint, electrolytic capacitor footprints, and a DIP16 Pololu footprint imported from Kicad modules.

The schematic used to design the circuit in gschem used symbols also imported from Kicad.

The board has deliberately been designed to be compact, since I aimed to fit it within a 5cm x 5cm layout, one of the sizes that gets preferential pricing with my usual PCB supplier, hackvana.com


Monday, 7 September 2015

Codec2 700B mode trellis decoding experiments and Reverend Thomas Bayes

The codec2 700B mode has been an improvement on the 700 mode, and employs vector quantisation (VQ) rather than scalar quantisation.

The characteristics of the 700B frames can be summarised as follows:

  bits_per_frame = 28;       % number of bits/frame for "700B" mode
  bit_fields = [1 5 3 6 6 6 1]; % number of bits in each field
  field_labels = ["voicing"; "logWo"; "energy"; "LSPmelVQ1"; "LSPmelVQ2"; "LSPmelVQ3"; "spare"];

which contrasts to the features of the 700 mode:

  bits_per_frame = 28;
  bit_fields = [1 5 3 3 2 4 3 3 2 2];
  field_labels = ["voicing"; "logWo"; "energy"; "LSP1"; "LSP2"; "LSP3"; "LSP4"; "LSP5"; "LSP6"; "spare"];

Naturally, trellis decoding seemed worth trying on 700B.

Here are the transition probability plots for the 700B bit fields, when the ve9qrp10s sample is processed.





It is interesting to note the quite striking difference in appearance between the very uniformly dispersed nature of the 700B VQ bit field transition probability mesh plots and the "peakier" 700 scalar LSP bit field mesh plots with more marked central tendencies ( see: codec2-700-mode-trellis-decoding )

This suggests that the VQ is doing a pretty good job of encoding information without much redundancy, which is likely to have implications for maximum likelihood decoding strategies. It is harder to derive a useful measure of the central tendency and then meaningfully apply it when the mesh plot looks like a square of uniformly cut lawn, as opposed to a nice mound in the middle of the lawn.

codec2's author, David Rowe, also discusses this issue of information redundancy in his blog.

It seems to be all about that hoary old chestnut that was first discussed in 1763 by the Reverend Thomas Bayes in "An Essay towards solving a Problem in the Doctrine of Chances". The posterior odds, i.e. our estimation of the most likely received codeword, can only be improved if we have useful information regarding the prior distribution of likely codewords. In the absence of useful information, we are left with a non-informative entropy maximizing distribution.



Here are some summary statistics from the first decoding runs:

Passing through bitfield 4 LSPmelVQ1 without trellis decoding
Passing through bitfield 5 LSPmelVQ2 without trellis decoding
Passing through bitfield 6 LSPmelVQ3 without trellis decoding
Passing through bitfield 7 spare     without trellis decoding
processing 700B mode parameter: 1, nbits: 1, label: voicing                         
Eb/No: 0.00 dB nerrors 25 13 BER: 0.10 0.05 std dev: 0.31 0.23
processing 700B mode parameter: 2, nbits: 5, label: logWo                           
Eb/No: 0.00 dB nerrors 121 82 BER: 0.10 0.07 std dev: 4.71 4.67
processing 700B mode parameter: 3, nbits: 3, label: energy                          
Eb/No: 0.00 dB nerrors 67 63 BER: 0.09 0.08 std dev: 1.20 1.32

And an attempt to trellis decode the VQ encoded bitfields (four hours of octave on a dedicated 64 bit 2.7GHz intel cpu):

Passing through bitfield 7 spare     without trellis decoding
processing 700B mode parameter: 1, nbits: 1, label: voicing                         
Eb/No: 0.00 dB nerrors 25 13 BER: 0.10 0.05 std dev: 0.31 0.23
processing 700B mode parameter: 2, nbits: 5, label: logWo                           
Eb/No: 0.00 dB nerrors 121 82 BER: 0.10 0.07 std dev: 4.71 4.67
processing 700B mode parameter: 3, nbits: 3, label: energy                          
Eb/No: 0.00 dB nerrors 67 63 BER: 0.09 0.08 std dev: 1.20 1.32
processing 700B mode parameter: 4, nbits: 6, label: LSPmelVQ1                       
Eb/No: 0.00 dB nerrors 246 115 BER: 0.17 0.08 std dev: 15.57 10.97
processing 700B mode parameter: 5, nbits: 6, label: LSPmelVQ2                       
Eb/No: 0.00 dB nerrors 277 115 BER: 0.19 0.08 std dev: 15.42 10.80
processing 700B mode parameter: 6, nbits: 6, label: LSPmelVQ3
Eb/No: 0.00 dB nerrors 285 114 BER: 0.19 0.08 std dev: 14.55 10.52

Judging by the large increases in errors from our attempt to apply maximum likelihood decoding to the VQ bit fields, it seems reasonable to conclude that the VQ encoded bit fields are doing an excellent job of conveying a lot of information with minimal redundancy. Unfortunately for us, this would suggest that we can't profitably employ maximum likelihood decoding for the VQ bit fields directly.

While experimenting, we have also seen that Reverend Bayes' insights are quite relevant to low bit rate audio codec R&D some 250 years later!

Here are some .wav files of the trellis decoded ve9qrp_10s sample which has had additive gaussian white noise added after 700B encoding, in keeping with the method used for the other codec2 mode trellis decoding experiments....

No bit fields trellis decoded:
ve9qrp_10s_700B_0.50_simple_700B.wav

Bit field 1 trellis decoded:

ve9qrp_10s_700B_0.50_trellis_700B_dec1.wav

Bit field 2 trellis decoded:
ve9qrp_10s_700B_0.50_trellis_700B_dec2.wav

Bit field 3 trellis decoded:
ve9qrp_10s_700B_0.50_trellis_700B_dec3.wav

Bit fields 1,2 trellis decoded:

ve9qrp_10s_700B_0.50_trellis_700B_dec12.wav

Bit fields 1,3 trellis decoded:
ve9qrp_10s_700B_0.50_trellis_700B_dec13.wav


Bit fields 2,3 trellis decoded:

ve9qrp_10s_700B_0.50_trellis_700B_dec23.wav


Bit fields 1,2,3 trellis decoded:
ve9qrp_10s_700B_0.50_trellis_700B_dec123.wav


Bit fields 1,2,3,4,5,6 trellis decoded
ve9qrp_10s_700B_0.50_trellis_700B_dec123456.wav


Bit field 4 trellis decoded:
ve9qrp_10s_700B_0.50_trellis_700B_dec4.wav

Bit field 5 trellis decoded:

ve9qrp_10s_700B_0.50_trellis_700B_dec5.wav


Bit field 6 trellis decoded:
ve9qrp_10s_700B_0.50_trellis_700B_dec6.wav


The intelligibility of the samples with bit fields 4, 5, or 6 decoded are not improved, as would be expected based on the very uniform distribution of the encoded VQ values evident in the transition probability plots, and also from the significantly increased number of bit errors and  standard deviation seen in the summary statistics.

From the above samples, it is clear that bit fields 1,2 and 3, either singly or in combination, benefit from direct trellis decoding, but the VQ bit fields would require decoding before attempting trellis decoding of their encoded information.


Codec2 700 mode trellis decoding experiments

Further to the codec2 1600 bit/second mode experiments with trellis decoding, the octave script has been modified further with a view to allowing any mode of interest to be specified.

As part of this refactoring and testing of the modified octave script, the 700 mode has been put through the script, with a combination of trellis decoded and passed through bit fields.

Here are the transition probability mesh plots for all of the bit fields showing the likelihoods (in Z axis height) of a given bitfield transitioning from a given value (X-axis) to a corresponding value on the Y axis. These plots were generated with the ve9qrp10s sample which was also used for the 1600 mode trellis decoding experiments.

The voicing bit field appears to be the least impressive in terms of predictability, and this bitfield may not lend itself to trellis decoding without excess errors being introduced.











Here are the summary statistics for the bitfields following the addition of additive Gaussian white noise (AGWN) and then trellis decoding.

Passing through bitfield 10 spare   without trellis decoding
processing 700A mode parameter: 1, nbits: 1, label: voicing                       
Eb/No: 0.00 dB nerrors 23 17 BER: 0.09 0.07 std dev: 0.30 0.26
processing 700A mode parameter: 2, nbits: 5, label: logWo                         
Eb/No: 0.00 dB nerrors 121 85 BER: 0.10 0.07 std dev: 4.95 4.83
processing 700A mode parameter: 3, nbits: 3, label: energy                        
Eb/No: 0.00 dB nerrors 63 65 BER: 0.08 0.09 std dev: 1.28 1.31
processing 700A mode parameter: 4, nbits: 3, label: LSP1                          
Eb/No: 0.00 dB nerrors 64 55 BER: 0.09 0.07 std dev: 1.06 1.29
processing 700A mode parameter: 5, nbits: 2, label: LSP2                          
Eb/No: 0.00 dB nerrors 47 50 BER: 0.09 0.10 std dev: 0.63 0.71
processing 700A mode parameter: 6, nbits: 4, label: LSP3                          
Eb/No: 0.00 dB nerrors 63 66 BER: 0.06 0.07 std dev: 1.83 2.41
processing 700A mode parameter: 7, nbits: 3, label: LSP4                          
Eb/No: 0.00 dB nerrors 78 61 BER: 0.10 0.08 std dev: 1.30 1.25
processing 700A mode parameter: 8, nbits: 3, label: LSP5                          
Eb/No: 0.00 dB nerrors 42 64 BER: 0.06 0.09 std dev: 0.87 1.31
processing 700A mode parameter: 9, nbits: 2, label: LSP6                          
Eb/No: 0.00 dB nerrors 32 42 BER: 0.06 0.08 std dev: 0.49 0.66

And another run:

Passing through bitfield 1 voicing without trellis decoding
Passing through bitfield 10 spare   without trellis decoding
processing 700A mode parameter: 2, nbits: 5, label: logWo                         
Eb/No: 0.00 dB nerrors 140 103 BER: 0.11 0.08 std dev: 5.20 5.28
processing 700A mode parameter: 3, nbits: 3, label: energy                        
Eb/No: 0.00 dB nerrors 60 55 BER: 0.08 0.07 std dev: 1.08 1.21
processing 700A mode parameter: 4, nbits: 3, label: LSP1                          
Eb/No: 0.00 dB nerrors 70 61 BER: 0.09 0.08 std dev: 1.21 1.36
processing 700A mode parameter: 5, nbits: 2, label: LSP2                          
Eb/No: 0.00 dB nerrors 34 33 BER: 0.07 0.07 std dev: 0.53 0.53
processing 700A mode parameter: 6, nbits: 4, label: LSP3                          
Eb/No: 0.00 dB nerrors 72 71 BER: 0.07 0.07 std dev: 1.85 2.63
processing 700A mode parameter: 7, nbits: 3, label: LSP4                          
Eb/No: 0.00 dB nerrors 58 50 BER: 0.08 0.07 std dev: 1.23 1.17
processing 700A mode parameter: 8, nbits: 3, label: LSP5                          
Eb/No: 0.00 dB nerrors 42 63 BER: 0.06 0.08 std dev: 0.85 1.21
processing 700A mode parameter: 9, nbits: 2, label: LSP6                          
Eb/No: 0.00 dB nerrors 34 37 BER: 0.07 0.07 std dev: 0.57 0.59

And another run:

Passing through bitfield 1 voicing without trellis decoding
Passing through bitfield 2 logWo   without trellis decoding
Passing through bitfield 10 spare   without trellis decoding
processing 700A mode parameter: 3, nbits: 3, label: energy                        
Eb/No: 0.00 dB nerrors 44 53 BER: 0.06 0.07 std dev: 1.07 1.15
processing 700A mode parameter: 4, nbits: 3, label: LSP1                          
Eb/No: 0.00 dB nerrors 80 65 BER: 0.11 0.09 std dev: 1.17 1.31
processing 700A mode parameter: 5, nbits: 2, label: LSP2                          
Eb/No: 0.00 dB nerrors 32 39 BER: 0.06 0.08 std dev: 0.53 0.62
processing 700A mode parameter: 6, nbits: 4, label: LSP3                          
Eb/No: 0.00 dB nerrors 69 70 BER: 0.07 0.07 std dev: 1.68 2.51
processing 700A mode parameter: 7, nbits: 3, label: LSP4                          
Eb/No: 0.00 dB nerrors 69 61 BER: 0.09 0.08 std dev: 1.27 1.25
processing 700A mode parameter: 8, nbits: 3, label: LSP5                          
Eb/No: 0.00 dB nerrors 38 65 BER: 0.05 0.09 std dev: 0.85 1.27
processing 700A mode parameter: 9, nbits: 2, label: LSP6                          
Eb/No: 0.00 dB nerrors 27 35 BER: 0.05 0.07 std dev: 0.49 0.58

After all of that, here is what the ve9qrp_10s_700A.bit sample sounds like with simple decoding after the addition of the AWGN:

ve9qrp_10s_700A_0.50_simple_700A.wav

Here is what the ve9qrp_10s_700A.bit sample sounds like with trellis decoding of all bit fields except for the  spare bit field (10) after the addition of the AWGN:

ve9qrp_10s_700A_0.50_trellis_700A_dec123456789.wav

Here is what the ve9qrp_10s_700A.bit sample sounds like with trellis decoding of bit fields 2-9, skipping the voicing (1) and the spare (10) bit fields after the addition of the AWGN:

ve9qrp_10s_700A_0.50_trellis_700A_dec23456789.wav

Here is what the ve9qrp_10s_700A.bit sample sounds like with trellis decoding of bit fields 3-9, skipping the voicing (1), logW0 (2) and the spare (10) bit fields after the addition of the AWGN:

ve9qrp_10s_700A_0.50_trellis_700A_dec3456789.wav

Having confirmed that the modified script still works with the codec2 700 mode, the next step is to support the 700B and 1300 bit/second modes.

In closing, all of this experimentation serves to highlight that black box vocoders subject to intellectual property protection being marketed by commercial equipment vendors do not allow this sort of experimentation by interested amateurs.

Sunday, 6 September 2015

gEDA PCB footprint text utility

When creating footprints in gEDA, the addition text elements other than the overlaid refdes is not supported.

Here is a command line java utility that allows text to be generated as an element which can then be loaded and added to a gEDA PCB footprint or layout.

https://github.com/erichVK5/FootprintTextForPCB

Without a utility of this nature, those making footprints and seeking to add text have to hand draw the desired text.

v1.1 of the utility uses the free Hershey Sans 1 Stroke Font and outputs 0.01mil (imperial, square bracketed) units.

This builds on the previous font work discussed previously:

geda-pcb-font-utilities-and-options

I plan to incorporate this utility into the Kicad to PCB footprint importer utility,

https://github.com/erichVK5/KicadModuleToGEDA

to allow text defined in Kicad modules to be rendered when converting to gEDA PCB format.

I may also add support for other ported fonts in due course.

Hints for usage:

Step 1)

decide on the text (or texts) needed in the footprint being designed

Step 2)

generate each needed bit of text as a footprint with this utility, i.e.
 
java FootprintTextForPCB -t "You Shouldn't Have Unsoldered This" -m 1.3

which will generate a footprint file
 
You_Shouldn_t_Have_Unsoldered_This.fp

that will contain the text. It will recognise spaces and any of the usual ASCII characters that PCB can ordinarily display as text, but, you will need to escape characters that the shell might take exception to, and the escape character may end up getting rendered in the footprint text, until such time as I support escape characters a bit better.

Step 3)

When generating the new footprint in PCB, use

"File:Load Element To Buffer"

to load the newly generated footprint onto the layout.
Place the text in a suitable position. If it is the wrong size, go back and play with the magnification ratio option.

Step 4)

Select the text by clicking on it.

CTRL-x to cut the text to buffer

Go to "Buffer:Break Element To Pieces" to convert the text footprint into silk line primitives, and click to place the broken up element where it is needed.

Hit "Esc" to deselect.

Step 5)

Proceed now, as you normally would, to convert your collection of elements (which now include the silk lines showing the text) making up your footprint in its entirety into a footprint.

Usage:
 
java FootprintTextForPCB -t "my Text For Conversion To Silkscreen Stroke Elements" -m X.XXXX

"my Text For Conversion To Silkscreen Stroke Elements" is ASCII text, which can include spaces,
and X.XXXX is an optional magnification ratio; default = 1.0)

If run without any command line arguments, a demonstration footprint file
called demonstration1234567890.fp, will be generated

Installation:

1) install a java compiler and java virtual machine (JVM) using your preferred package management system/source, if it isn't already installed.

2) clone the FootprintTextForPCB git repository. Failing that, download the java source file and put it in a suitable directory with the same subdirectories and contents.

3) in the FootprintTextForPCB directory, type:

user@box:~$ javac FootprintTextForPCB.java

and that should be it, you are now ready to use the FootprintTextForPCB utility.

Codec2 1600 bit/s mode trellis decoding experiments

Codec2 is an open source low bit rate voice coder (vocoder) that enables voice to be carried on data channels at very low data rates.

Low bit rate vocoders are distinct from their higher bit rate encoder cousins such as mp3 which seek to reproduce more than just voice, i.e. music.

Codec2 is particularly exciting owing to its potential to revolutionise HF voice communications, until now dominated by Single Sideband Transmission (SSB). Codec2 already offers better robustness than SSB in low signal to noise conditions. Codith ec2 also has significant potential in VHF and above amateur radio communications, where single frequency time division multiple access technologies (TDMA) already in use commercially for mobile communications and telephony can be introduced with significant spectrum saving benefits in amateur bands and on amateur repeaters.

Anyway, after playing with trellis.m in the codec2-dev/octave directory, support for trellis decoding of the 1600 bit/s mode was implemented.

Maximum likelihood decoding is used, using the raw hts sample audio file encoded at 1600 bit/s as the source of the training database.

David Rowe has pointed out that that 1600 bit/s mode uses an underlying 1300 bit/s bit stream plus a 300 bit/s forward error correction (FEC) bit stream, for a total of 1600 bits per second.

Accordingly, experiments on the underlying 1300 bit/s mode is planned, in the absence of FEC.

Additive white gaussian noise has been added to the ve9qrp_10s audio sample, followed by trellis decoding of various combinations of the bit fields.

This is the result of decoding after the addition of noise to the codec2 bitstream, with no trellis decoding:

ve9qrp_10s_1600_0.50_simple_1600.wav

This is the result of decoding after the addition of noise to the codec2 bitstream, with trellis decoding of bitfields 3,6,7,8,9,10,11,12,14,15,16:

ve9qrp_10s_1600_0.50_trellis_1600_dec3678910111213141516.wav

This is the result of decoding after the addition of noise to the codec2 bitstream, with trellis decoding of bitfields 1,3,4,6,7,8,9,10,11,12,14,15,16:

ve9qrp_10s_1600_0.50_trellis_1600_dec134678910111213141516.wav

This is the result of decoding after the addition of noise to the codec2 bitstream, with trellis decoding of bitfields 7,8,9,10,11,12,14,15,16:

ve9qrp_10s_1600_0.50_trellis_1600_dec78910111213141516.wav

This is the result of decoding after the addition of noise to the codec2 bitstream, with trellis decoding of bitfields 1,4,7,8,9,10,11,12,14,15,16:

ve9qrp_10s_1600_0.50_trellis_1600_dec1478910111213141516.wav

1600 mode bitfields are as follows:

 bits_per_frame = 64;
 bit_fields = [2 7 5 2 7 5 4 4 4 4 4 4 4 3 3 2];
 field_labels = ["voicing1"; "scalarWo1"; "energy1"; "voicing2"; "scalarWo2"; "energy2"; "LSP1"; "LSP2"; "LSP3"; "LSP4"; "LSP5"; "LSP6"; "LSP7"; "LSP8"; "LSP9"; "LSP10"];

Intelligibility in the presence of noise seems to be enhanced the most by maximum likelihood decoding of the LSPs and voicing bits, with next best being maximum likelihood decoding of just the LSPs.

Maximum likelihood decoding of just the LSPs in the 1600 bit/s mode is not too demanding given the small bitfield lengths. Based on this admittedly limited sample set, maximum likelihood decoding of the voicing bits in addition to the LSPs seems to reduce the occasional "stutter" type artifacts.

Errors introduced by maximum likelihood decoding of the energy bitfields seem to have an adverse effect on intelligibility. Interestingly, there were dense probabilities in the high order bits, and sparse probabilities in the low order bits... see transition probability plots below, and see the summary statistics showing significantly increased errors with trellis decoding.

Maximum likelihood decoding of the scalar W0 bitfields has not been performed owing to the bits = 7, making processing by octave quite challenging. This is due to the exponential ( i.e. 2^(bitfield length) ) demands of the maximum likelihood decoding. Further experimentation with maximum likelihood decoding of the scalar W0 bitfields in C is planned. Also of interest were the uniformly dense probabilities in the low order bits, and sparse probabilities in the high order bits... see transition probability plots below... which may have an impact on trellis decoding effectiveness - but this may reflect the effects of FEC, in which case it is actually desirable. Furthermore, the ability to adequately encode outliers is also important to convey and preserve intelligibility.

A couple of the bitfield transition probability plots also showed marked clustering into four peaks, perhaps suggesting that quantising could take better advantage of the available bits, although it may just be evidence of the FEC at work, adding robustness, or again, reflecting a required ability to adequately encode the occasional outlier.

The following plots are labeled and are presented in order of the 1600 bit/s bitfields. Basically, the Z axis shows the frequency at which a bitfield value on the X axis maps to another value on the Y axis. Accordingly, the more densely clustered the maxima, the more predictable changes from one bitfield to the next will be, and the greater the ability of the trellis decoding to make informed guesses about the most likely codeword:
















The summary statistics produced by octave:

Passing through bitfield 2 scalarWo1 without trellis decoding
Passing through bitfield 5 scalarWo2 without trellis decoding
processing parameter: 1, nbits: 2, label: voicing1 
Eb/No: 0.00 dB nerrors 34 36 BER: 0.07 0.07 std dev: 0.63 0.57
processing parameter: 3, nbits: 5, label: energy1  
Eb/No: 0.00 dB nerrors 133 98 BER: 0.11 0.08 std dev: 4.11 4.66
processing parameter: 4, nbits: 2, label: voicing2 
Eb/No: 0.00 dB nerrors 31 40 BER: 0.06 0.08 std dev: 0.61 0.65
processing parameter: 6, nbits: 5, label: energy2  
Eb/No: 0.00 dB nerrors 126 88 BER: 0.10 0.07 std dev: 4.69 4.96
processing parameter: 7, nbits: 4, label: LSP1     
Eb/No: 0.00 dB nerrors 83 72 BER: 0.08 0.07 std dev: 2.44 2.24
processing parameter: 8, nbits: 4, label: LSP2     
Eb/No: 0.00 dB nerrors 98 95 BER: 0.10 0.10 std dev: 2.46 2.55
processing parameter: 9, nbits: 4, label: LSP3     
Eb/No: 0.00 dB nerrors 104 75 BER: 0.10 0.08 std dev: 2.63 2.89
processing parameter: 10, nbits: 4, label: LSP4     
Eb/No: 0.00 dB nerrors 80 83 BER: 0.08 0.08 std dev: 2.43 2.64
processing parameter: 11, nbits: 4, label: LSP5     
Eb/No: 0.00 dB nerrors 66 75 BER: 0.07 0.08 std dev: 2.02 2.34
processing parameter: 12, nbits: 4, label: LSP6     
Eb/No: 0.00 dB nerrors 67 81 BER: 0.07 0.08 std dev: 1.54 2.82
processing parameter: 13, nbits: 4, label: LSP7     
Eb/No: 0.00 dB nerrors 82 81 BER: 0.08 0.08 std dev: 2.71 2.41
processing parameter: 14, nbits: 3, label: LSP8     
Eb/No: 0.00 dB nerrors 86 61 BER: 0.12 0.08 std dev: 1.36 1.29
processing parameter: 15, nbits: 3, label: LSP9     
Eb/No: 0.00 dB nerrors 17 50 BER: 0.02 0.07 std dev: 0.43 1.14
processing parameter: 16, nbits: 2, label: LSP10    
Eb/No: 0.00 dB nerrors 25 29 BER: 0.05 0.06 std dev: 0.31 0.49

In conclusion, early indications are that trellis decoding has the potential to improve the performance of the 1600 bit/s codec2 mode in the presence of noise, as envisaged by codec2's author, David Rowe. Further investigation is planned of the 1300 bit/s mode prior to the addition of FEC in the 1600 bit/s mode, and also the lower bit rate 700B mode that does not employ FEC. 

See also:

Rowetel blog posting "Trellis Decoding for Codec 2"

and for information on codec2 in general:

http://www.rowetel.com/blog/?page_id=452

Monday, 5 January 2015

SA GRN trunked scanning on the BC780 XLT

The South Australian (SA) Government Radio Network (GRN) uses Motorola trunked UHF radio communications for public services including Country Fire Service (CFS) control communications, SA Police Force (SAPOL), and the SA Ambulance Service (SAAS).
 
Conventional scanners provide only frustrating snippets of conversations.
 
The Uniden Bearcat BC  780 XLT is a fairly cheap trunk tracking scanner and readily obtained second hand that is compatible with the SA GRN.
 
The trunked scanning programming process is not very intuitive.
 
 
Stage 1: a worked example using bank 1 for SA GRN scanning:
 
The first thing to do is delete the frequencies in a bank you will dedicate to trunked SA GRN scanning
 
A bank on the BC780XLT is a set of 50 frequencies, i.e. stored frequencies
 
bank 1: 1-50,
bank 2: 51-100
bank 3: 101-150, etc...

in the case of bank 1:

pressing "1" on the keypad and "E" takes you to stored frequency number 1

if you then press "0" and then "E", it will delete the frequency in stored frequency number 1

if you then hit the "MAN" = manual key, it will step you to frequency number 2

if you then press "0" and then "E", it will delete the frequency in stored frequency number 2

and you can do this until you get up to and including stored frequency number 50, if you want to delete bank 1
 
Stage 2: configuring bank 1 for motorola compatible trunked scanning

the next step is to set up bank 1 (in the case of this example) as a motorola trunking bank (I have drawn on and added to the sascan instructions here):

Step 1:  Press MENU

Step 2:  Select TRUNK DATA and press E

Step 3:  Press the UP or DOWN arrows to select the trunk bank you want to program the channels into ( you can also use the VFO knob to scroll through the banks as well). When you have you bank selected (in the case of this example, we will choose bank 1), press E

Step 4:  Press the UP or DOWN arrows to select TRUNK TYPE and press E

Step 5:  Choose the Type 2 UHF trunk type. This is type no 2 and the screen should show it as TYPE 2 UHF. When this is done, press E

Step 6: Press the UP or DOWN arrows to display "BASE CONFIG 1" and press E.

Step 7:  Enter the first GRN base frequency of 412.475 and again press E

 Step 8:  The display will change so as to ask you for the spacing frequency. Enter 12.5 and press E

Step 9:  The display changes once again to ask for the offset value. Enter 380 and press E.

Step 10:  The scanner will prompt you now for the second base. Enter 415.125 and press E.

Step 11:  The scanner will now ask for the spacing and offset, the same as steps 8 and 9. Enter 12.5 for the spacing and 460 for the offset. repeater as steps 8 and 9 above.

Step 12:  Press the menu button repeatedly to exit from this mode. Then select the first channel in the bank you selected as the trunk bank by using the manual and numbers keys as you normally would.

Stage 3: find details for your local SA GRN tower

Assuming you live in the vicinity of goolwa, your local SA GRN site is the Port Elliot tower:

SA GRN Site - Pt Elliot
Location - GRN SITE BROWN HILL CROWSNEST RD PT ELLIOT 
Lat/Long  -35 30 22 / +138 38 44

Data Channel
413.125

Voice Channels
415.125
415.625
416.125
416.625
417.125
417.625

Stage 4: program the GRN channels into the bank selected for SA GRN scanning

so, you then need to program your local GRN site, in this case, we are doing it in bank 1, which starts at stored frequency number 1:

pressing "1" on the keypad and "E" takes you to stored frequency number 1

enter
 
413.125
 
then press "E" to store it, then press and hold the TRUNK key for 2 seconds. A tone will sound and the display will show the M icon

hit the manual ("MAN") key to step to frequency slot number 2

pressing "1" on the keypad and "E" takes you to stored frequency number 1

enter
 
415.125
 
then press "E" to store it, then press and hold the TRUNK key for 2 seconds. A tone will sound and the display will show the M icon just above the most significant digit of the frequency readout

hit the manual ("MAN") key to step to frequency slot number 3.... and so on

continue doing this for the remaining frequencies for the SA GRN site


Stage 5: Try some trunked scanning

having stored the Port Elliot SA GRN frequencies, the next step is to start scanning.

Press the "SCAN" button

make sure bank 1 is selected for scanning. The row of numbers 1-10 on the LCD under the word "BANK" show you which banks have been selected for scanning. In this case, make sure "1" is selected. The other banks can be excluded from the scanning.

then press the "TRUNK" button

then press the "SRCH" button

this will start the scanner reception of the data channel, and identification of trunked "conversation IDs"

You will see things something like "MOT ID: 17584" displayed on the screen below the frequency readout during overheard conversations or data bursts.

If you hear data coming through you can press the "L/O" = lockout button while the data burst is still coming through to lock out that particular trunked conversation ID. The data bursts are likely pagers or encrypted SAPOL and the scanner can be told to ignore them in this way. After listening for a while, and locking out trunked data IDs, you'll only be left with in the clear voice traffic (See also page 48 of the bearcat manual, which pretty much says the same thing).

If you have accidentally locked out some IDs by pressing the "L/O" button during voice traffic you can clear all of the locked out IDs at once (see also page 41 of the manual if you (unlikely) want to undo a lockout of a particular ID):

To unlock all locked out IDs in a bank at once:

1. Press MENU.
2. Select TRUNK DATA - BANK NO. - L/O ID REVIEW
using L, M or VFO and pressing E, SELECT or VFO.
3. Select the locked out ID you want to unlock using L or M.
4. Press E instead of L/O in step 4 above.
5. To exit from this mode, press MENU repeatedly.


The above shouldn't take more than 10-20 minutes while sitting in front of the TV.
 
If you screw something up, you just start again.