All posts by Per Magnusson

Bahnhofs IP-telefoni, del 3

Jag har tidigare (här och här) skrivit om problem jag haft med Bahnhofs IP-telefoni och hur jag löst dem.

Idag drabbades jag av ett nytt problem. Webbservern som den här bloggen ligger på och som alltså finns hemma hos mig, gick inte att komma åt utifrån. Istället möttes man av inloggningsrutan för SIP-boxen (Eltek R7121-L1). Jag misstänker att någon inställning råkat ändras på Bahnhofs sida, för själv har jag inte loggat in på SIP-boxen på väldigt länge. Och när jag i samband med de tidigare bloggposterna pratade med supporten så var det de som till slut gjorde någon inställning som bryggade SIP-boxen så att den kunde sitta mellan fibern och min router utan att den spärrade inkommande trafik till min webbserver. Nu tycktes alltså SIP-boxen inte längre vara bryggad.

Det här fick mig att till slut få tummen ur och slå av inställningen WAN / NAT Passthrough / SIP Passthrough i ASUS-routern RT-N56U jag har och flytta SIP-boxen så att den sitter efter routern och inte mellan fibern och routern. Tipset om den här inställningen gavs i tidigare kommentarer av Christian och Magnus F. Port forwarding till IP-adressen för SIP-boxen så som Bahnhof rekommenderar för denna konfiguration hade jag redan ställt in:

69 – UDP
5060 – 5080 TCP och UDP
9000 – 14000 UDP
50000 – 60000 UDP

Efter omkopplingen verkar allt fungera smärtfritt. Man ser inte längre inloggningsfönstret för R7121-L1 när man surfar till axotron.se, IP-telefonin verkar fungera (ljud åt båda hållen för både inkommande och utgående samtal) och webbservern är åter tillgänglig från omvärlden. En bonus är att jag nu slipper 100 Mbit/s-begränsningen som SIP-boxen införde när den satt före routern. Hastigheten enligt Bredbandskollen är nu 126 Mbit/s istället för som tidigare strax under 100 Mbit/s. Ingen skillnad som lär märkas särskilt ofta, men det är ju knappast någon nackdel.

Jag undrar om det är Bahnhof som råkat ändra inställningarna i min SIP-box och varför det i så fall hände. Eftersom allt löste sig ganska snabbt så har jag inte ringt supporten och frågat.

Installing ATLC on Windows

This post describes how to compile and run ATLC under Cygwin on Windows.

ATLC is an open source 2D transmission line field solver. This means that it can calculate the characteristic impedance and some other parameters of arbitrary single-ended and differential transmission lines. It was written by radio amateur  Dr. David Kirkby (G8WRB) and it is very useful when designing RF and high-speed PCBs since it allows accurate calculation of the impedance of pretty much any geometry of transmission line. It is not limited to the simplified geometries that the various closed form approximation formulas deal with, so you can easily (well) include e.g. the effect of the solder mask on top of microstrips or the different permittivity of the resin that is pressed in between the traces of a tightly coupled differential stripline.

ATLC is however not a program with a graphical user interface. Instead it is a command line program written for Unix-like environments that you need to compile yourself from the source code and run from the command line. This creates a perhaps daunting threshold for non-Linux/Unix users. The intention of this post is to describe how to anyway make ATLC work on Windows computers by compiling it under the Linux-like environment Cygwin.

Installing Cygwin

The first step is to download and install Cygwin. This is a two-step process. First you download the setup-executable, either setup-x86_64.exe (64-bit installation) or setup-x86.exe (32-bit installation) from the Cygwin home page.

Then you run the executable. There are a series of questions to answer during the installation. Typically it is best to select to “Install from Internet”, to set the root directory to C:\cygwin64 (assuming a 64-bit installation), select some reasonable folder to store the installation files (perhaps the same place where you saved the setup executable) and select whether or not you are using a proxy to connect to the Internet. Then you come to the first less obvious choice; which download server to use. A good idea might be to try someone that you think is close to home and has decent bandwidth. Then the fun begins, namely the process to select which packages of Cygwin to install. There are many. Very many.

To compile ATLC you need at least the following packages: Devel/gcc-core and Devel/make. I would also recommend Graphics/netpbm since it is a package that can be useful for manipulating images that form the input and output data of ATLC. If you later find out that you want to add more packages, you just rerun the install file and it will remember what you have previously installed and allow you to install more packages.

Downloading and Compiling ATLC

Now you need to download the source files for ATLC. They are available on Sourceforge, http://sourceforge.net/projects/atlc/. To get the source code you need to click on Files, then on atlc (do not click on the link to the Windows binaries as they currently are for an outdated version of ATLC which does not produce correct results in many cases), then click on the most recent version (currently atlc-4.6.1), finally click on atlc-4.6.1.tar.bz2 and wait for the mandatory Sourceforge download delay to expire. There is also a .tar.gz package of source files, but that archive seemed to be broken when I tried to unpack it, while the bz2 archive was OK.

Save the source package in some directory (I chose D:\download\ATLC) and then unpack it using e.g. 7-zip, first the bz2 level and then the tar level to get a directory tree of all the source files. You may want to move the folder that contains the proper top level folder up to the same level as the bz2 file. Now we have the folder D:\download\ATLC\atlc-4.6.1 with the top level of the source tree.

Start Cygwin and change directory to the source files. Cygwin maps the Windows drive letters to folders called /cygdrive/<driveletter>, so to change to the desired folder, you need to type in the following command:

cd /cygdrive/d/download/ATLC/atlc-4.6.1

To prepare for building the exe file, type:

./configure

This performs some checks on the target system (your Windows PC) and creates a suitable makefile. Hopefully every check goes well (it did for me) so then it is time to build the whole thing by typing:

make

This takes a little while, but if everything goes well, the result are some .exe files in the src directory, the most important of which is atlc.exe. It is then a good idea to also run an automatic test to see if everything went well:

make check

The last lines of output when I run the check are:

Run times: T_sequential is 26 s. Not configured for parallel operation.
PASS: benchmark.test
======================
All 82 tests passed
(2 tests were not run)
======================

This looks good to me.

Then we can “install” ATLC, which mostly means copying files to suitable locations. This is done by:

make install

Trying It Out

Now, cd to a directory where you want to work with ATLC. You can type:

man atlc

to get some information about how the program works. You can also read about it on the ATLC page, primarily under the headings Tutorial, Bitmaps, Man pages and Examples.

Use Paint, Gimp, Photoshop, some other drawing programs, a script or one of the other .exe files that were compiled along with atlc.exe to create suitable input data to ATLC. Basically, the input data consists of a 24-bit BMP image which represents the cross section of the transmission line. Specific colors represent different materials as described in the man page. Red (0xFF0000) represents the conductor of a line, green (0x00FF00) is the ground conductor, white is vacuum (a good enough approximation of air) some other colors represent predefined dielectrics while most colors are free to use as custom dielectrics with permittivity that can be defined on the command line.

Below is a (scaled down) example picture I created. It represents a 0.52 mm wide microstrip line without solder mask on a 0.3 mm thick FR-4 substrate.

Cross section of a microstrip to be used as input to ATLC.
Cross section of a microstrip to be used as input to ATLC. (Click on the image to download the actual full resolution BMP file.)

I have put a ground plane not only under the FR-4, but also all around the edges of the image. This helps with ATLC convergence. Such a boundary ground plane should not be placed too close to the actual transmission line in order not to affect the impedance significantly. I chose to use a scale of 200 pixels per mm in this case, but you do not need to tell ATLC that since the impedance is scale invariant. Using more pixels per mm gives a more accurate result.

To feed this picture to ATLC, the following command can be issued:

atlc -d d2ff00=4.2 052_030_microstrip.bmp

The option “-d d2ff00=4.2” tells ATLC that the color 0xd2ff00 represents a dielectric with a relative permittivity of 4.2. The other colors that were used (white, green and red) have predefined properties.

The output data from ATLC (after a few seconds) is:

052_030_microstrip.bmp 2 Er=  3.03 Zo=  51.457 Ohms C=  112.9 pF/m L=  298.8 nH/m v= 1.722e+08 m/s v_f= 0.574 VERSION= 4.6.1

This means that ATLC has calculated that the effective permittivity of the line is 3.03, the characteristic impedance is 51.457 ohms, the capacitance is 112.9 pF/m, the inductance is 298.8 nH/m, the propagation velocity is 172.2*106 m/s, which is 0.574 times the speed of light in free space.

A number of output files are generated as well, both BMP-images that represent the electrical and magnetic fields and binary files that represent the same thing, but with higher accuracy. See the Files section on the ATLC home page for descriptions of these files.

As mentioned above, a higher resolution (more pixels per mm) results in more accurate results, but the downside is that the runtime increases steeply. I seem to remember (cannot find it right now) that the run time of ATLC is roughly proportional to the square of the number of pixels in the input image, so doubling the resolution (in pixels per mm) creates four times as many pixels and hence 16 times as long execution time.

Elektronikforum

Ikväll stod jag och SP Devices som värd för en träff i mötesserien “Elektronikforum” som dragits igång av Joacim Frisk på Prevas. Elektronikforum riktar sig till elektronikkonstruktörer i Linköping. “En plats att träffas, ta en fika, diskutera elektronik och lyssna på intressanta föredrag.”

Föredraget jag höll var i stort sett en repris på ett föredrag jag höll för knappt tre år sedan och hade titeln “Filtrering av matningsspänningar för känsliga analoga tillämpningar”. Bilderna från presentationen finns här:

Filtrering av matningsspänningar för känsliga analoga tillämpningar

Drygt 20 personer hade mött upp och både före och efter själva föredraget diskuterades det elektronik (och kanske en del annat) i mindre grupper. Det verkar som om deltagarna uppskattade tillställningen.

Jag hann inte gå runt och delta i alla diskussionerna, men här följer några länkar till sådant som nämndes i samband med föredraget eller i de samtal jag var med i:

Tack till alla som kom och bidrog till de intressanta samtalen! Hoppas det blir en ny träff i mötesserien snart.