How to check for a NAN (Not A Number) in C++ in embedded systems without exception handlers

Sometimes there are bugs or special corner conditions that makes a NAN (Not A Number) occur in code compiled from a C++ source and executed on an embedded systems without memory to run exception handlers.

Here is what @Jalf writes over at StackExchange:

According to the IEEE standard, NaN values have the odd property that comparisons involving them are always false. That is, for a float f, f != f will be true only if f is NaN.

Note that, as some comments below have pointed out, not all compilers respect this when optimizing code.

For any compiler which claims to use IEEE floating point, this trick should work.

If you inplement a function in a separate .cpp file , how do you access objects instantiated in main from functions implemented that file?

Sometimes there is a need to spread code into several .cpp files to avoid clutter (for example main.cpp, other1.cpp, other 2.cpp) . So if you implement a function in a separate .cpp file, how do you access objects instantiated in main?

Solution: use extern

other1.cpp:

extern ObjectType objectname

void doSomething (void) 
{
      objectname.method();
}

Of course this is very basic stuff, but many new programmers ask about this so I included a short post about this here.

IRIDIUM SATCOM enabling your next IoT / Arduino / microcontroller project

Rock Seven has launched a board that takes care of the PSU and antenna requirements to support the Iridium 96090 module https://www.iridium.com/products/iridium-9602/

http://www.rock7mobile.com/products-rockblock.php?gclid=EAIaIQobChMI1ZWSqv2C3gIVRawYCh2DBQ7eEAAYASAAEgI3vfD_BwE

This enables fast time to market and coverage in remote areas on customers IoT devices.

ZUMspot + Pi-Star setup guide

If you are looking for a Zumstar + PiSpot setup guide for DMR, then KC6N has made a great tutorial that is available here as a .PDF: https://www.hamdigitaal.nl/download/algemene-informatie/ZumSpot_Pistar_KC6N_20180605.pdf Full credit goes to KC6N, I have taken the liberty to link to the site where this document is available to help other amateur radio ops get on the air with their hotspot setup.

LDG AT-100PROII max C / max L

LDG does not specify either max C or max L of their antenna tuners in the “pro” series. They specify a vague “it can tune 1000 ohms”. This basically means nothing as no frequency is given and it is not given if they mean R or X or Z by “1000 ohms”. There is also no service manual or schematic available. Very disappointing from a serious (?) supplier.

Well, since LDG doent specify anything, I have measured it.

The LDG AT-100PROII is a series L, shunt C configuration.

Min L is 3uH, max L is 11,8uH
Min C is 85pF, max C is 250 pF
This is measured at 2MHz.

This shows that the capability of tuning an 2x20m doublet via “10-12m” of 590 ohm ladder line on 80m seems to be limited, and that tuning on 160m is very difficult.This is mainly due to limited Lmax. Also the limited Lmax gives limitations on other bands as well. Having the proper length of transmission line is important to overcome this limitations. You MAY also use a 4:1 or 9:1 balun. However it is important that the balun does have a very low loss. (Otherwise you you end up with a good SWR but poor efficiency).

Too low power Modification for ICOM IC-7100

I recently bought a second hand Icom IC-7100 HF radio for a reasonable price. This radio is known for a very conservative approach to internal ALC on the power output. This causes the output power to not go above approx 75-80W (PEP) as measured on my LPA-100 wattmeter in PEP mode with 14,5V DC input. Of course, there is no need to overdrive any linear amplifier, however Icom engineers have probably overdone it a bit on the conservative side on this radio (?).

There are two published mods that are possible on this radio. I did only one of the mods that involves a jumper from C1509 to ground, because the other mod that involves a 10uF capacitor is reported to cause modulation issues on FM and AM.

The PEP output power increased from 75-80W PEP to approx 140-145W PEP (14,5V DC input). Note: PEP, not average. On a sidenote the peak to average ratio also improved. There is no need to have PEP output of more than 100-110W PEP by the way.

The mod is easy:

  • Unplug the radio DC lead and all other leads incl. the antenna connector
  • Use an antistatic mat and handlead
  • Remove the back cover
  • Locate the C1509 and the ground lug
  • Solder a small jumper from the C1509 to the ground lug
  • Check carefully that you didn’t spill any solder residue on the PCB
  • Blow with compressed air to remove any residue
  • Close the radio

IC-7100 mod. (I did steal this picture from radio aficion website)

I did also upgrade the firmware to :

  • CPU 1.11
  • DSP 1.03

The firmware upgrade did have a small but insignificant effect on the PEP output power according to what I found. The hardware mod, did have a signficant impact as the DSP is led to believe that the output power is lower than it is.

Disclaimer:

  • All mods are done on your own risk!
  • You may void the warranty of your radio if carrying out this mod
  • I will not be held responsible for any problems, malfunctions, defects, indirect consequences or any other issues caused by the mod
  • Do at all times follow the license regulations of your country
  • Check that your bandwidth is not excessive
  • Check that your harmonic content is well below maximum allowed

Telenor 4G modem, IP camera, remote radio, remote SDR setup (Norwegian language)

Hvis du vil sette opp et 4G IP kamera, en 4G alarm, eller kjøre amatørradio via 4G remote så må du sette opp 4G ruteren din slik at datatrafikk UTENFRA kan komme inn igjennom 4G ruteren. For å kunne få dette til å virke må du kjenne IP adressen til 4G ruteren din. Ringer du Telenor support får du som regel et “god dag mann økseskaft svar”. Ringer du “telenor eksperten”, så får du ofte et nytt “goddag mann økseskaft svar”, men denne  gangen må du betale for det! Denne quick guiden omhandler Telenor D-link DWR-961 ruter.

Utfordring 1: Telenor har satt opp sine 4G rutere per default slik at du ikke har en egen IP adresse som er synlig på internett. Datatraffikk utenfra blir også stoppet (av sikkerhetsgrunner – som regel har ikke vanlige brukere behov for at traffikk utenfra skal kunne komme igjennom om den ikke er initiert innenfra først).

Løsning:

  • Logg inn på ruteren via kabel i LAN1, LAN2, LAN3 eller LAN4 porten (ikke WAN porten). Du har innloggingsdetaljene fra Telenor (ikke sant?)
  • Gå til “internett fanen”
  • Endre APN(Access Point Name) til internet.public  (med små bokstaver)
  • Restart ruteren
  • Nå har du en IP adresse som både er synlig utenfra og traffikk kan nå inn til ruteren din

Utfordring 2: IP adressen er ikke fast så den endrer seg hele tiden. Du aner ikke hvilken ip adresse 4G modemet ditt og det utstyret som står tilkoplet på innsiden har…. hvordan skal du da kunne aksessere dette?

Løsning:

  • Sett opp en dynamisk DNS
  • Viktig: Kun Dyndns (heter nå dyn.com) fungerer. Ingen av de andre dynamisk DNS tilbyderne fungerer.
  • Viktig: du  må nå betale for dyndns servicen fra dyn.com (ca 500 kr per år). Dette er det ingen vei utenom (som jeg har funnet i alle fall). Dyndns free service er discontinued så nå må du betale for tjenesten.
  • Gå hit https://dyn.com/dns/dyndns-pro-free-trial/ og registrer en gratis konto
  • Velg et passende sub-domenenavn  som f.eks pettersipkamera1.dyndns.org (fyll inn ditt valgte navn). Sub domenet er det som stør før første prikk, selv om det virker litt lite intuitivt at det står før prikken og ikke etter. Domenet er det som står etter prikken, men dette er jo forhåndsbestemt til å være dyndns.org
  • Gå til Advanced og DynDNS i oppsettsmenyene i Telenor 4G ruteren din (via web browser)
  • Fyll inn brukernavn, passord og hostname. Hostname er det du satt opp over når du registrerte kontoen hos dyn.com. For eksempel pettersipkamera1.dyndns.org 
    (selv om dyndns nå heter dyn.com så er dyndns.org fortsatt live and kicking)
  • Husk å klikke på DDNS så dynamisk DNS er skrudd på i ruterens meny
  • Nå vil pettersipkamera1.dyndns.org peke til IP adressen til ruteren din (SELV OM TELENOR SINE SYSTEMER ENDRER IP ADRESSE på 4G RUTERE INNIMELLOM!)
  • Så må du sette opp port forwarding, om du bruker egne porter. Dette gjøres i fanen Advanced / Port Forwarding. Du må vite den interne adressen til IP kameraet ditt. F.eks 192.168.0.123
  • Du må vite hvilken port IP kameraet ditt bruker
  • Så setter du opp hvilken port INN til 4G ruteren som skal forwardes til hvilken IP adresse (f.eks 192.168.0.123) og port inne på det lokale nettverket ditt
  • Lagre og gjør en reboot / omstart av ruteren
  • Og VIPPS, du ser og kan overvåke din eiendom / hytte / whatever på IP kameraet og er i høyeste beredskap til en hver tid! Alarmsystemer, sensorer, styringer osv kan koples til på denne måten.
  • (Om du er radioamatør, så ser du radiosystemet ditt og er klar til å kjøre remote radio).

Håper dette var til hjelp. Ønsker du hjelp til en kommersiell installasjon, IoT eller liknende så kjenner jeg firmaer som kan hjelpe med dette. I så fall ta kontakt så kan jeg formidle info.

FT-891 and TRX-manager CAT control software

I have successfully got FT891 running under TRX-manager: http://www.trx-manager.com/index.html

1) Install the dual serial port driver from Yaesu website. 
See manual here: http://www.yaesu.com/airband/downloadFile.cfm?FileID=9515&FileCatID=42&FileName=USB%5FDriver%5FInstallation%5FManual%5FENG%5F1610%2DB0.pdf&FileContentType=application%2Fpdf

(Note: the 891 has dual serial ports, it does not have an USB soundcard).

2) Reboot the PC and check that you see two serial devices in your Device manager (type device manager when clicking the start button)

3) Hold F on the FT-891 in a couple of seconds (long click)

4) Goto menu 05-06
Set CAT RATE to 38400

6) Goto menu 05-08.
 Set CAT RTS to DISABLE (unless you do that you may have a problem getting data thru)

7) Set the rate to 38400 in TRX-manager (setup menu) and select FT-891. Also select correct COM port (on my PC it was COM5. It may be different on yours).
Remember: unless you set CAT RTS to DISABLE (see above) you will not get data thru and you will mess around in the TRX-manager menus while the problem was a setting in the FT-891 menu.

8) Stop and restart TRX-manager

9) You may hear a clicking sound for every CAT transmission in your FT-891 loudspeaker (A bit annoying… I have to admit that even if I like Yaesu radios)

10) Click F on the FT-891 (short click)

11) Goto MON on the FT-891 menu

12) Click on MON

13) Turn down the MON level to 0
Note: This applies regardless if you have MON ON or MON OFF (this is a bug in Yaesu’s firmware. Rare. LOL)

14) Now you have CAT control without any clicking sounds on your FT-891

15) Enjoy your Yaesu FT-891

Comments about the FT-891: 

Plusses: the FT-891 has in my view a better and more modern RX than the ageing FT-857, even better than IC7300 (some ppl. claim) http://www.eham.net/reviews/detail/13042?page=2 , it is a low cost modern mobile 100W HF rig with a small detachable front, it has DSP RX, a nice variable RX filter, works well down to low voltages even if someone claims it doesn’t, has a much better menu system and a better VFO, it has a reasonable current draw on RX (even if the datasheet overstates this a bit it is below 1A on my rig).

Minuses: No VHF or UHF ( however that may be a benefit. Not the compromises that probably are in the 857 rf chain). No USB soundcard (do you really need that in a mobile station?), 60M USB has to be programmed in a memory and you go memory tune from there and it will keep USB even if you are below 10 MHZ.