Download as pdf or txt
Download as pdf or txt
You are on page 1of 39

TinySA – Operator’s Manual

WA2FZW/M0WID Software - Version 2.8


By: John Price – WA2FZW

Table of Contents

Introduction ....................................................... 4
Hardware Compatibility ............................................. 4
The Display ........................................................ 5
Screen Top .............................................................. 5
Bottom Line ............................................................. 6
Left Side ............................................................... 6
Right Side .............................................................. 7
Traces .................................................................. 7
The My_SA.h Header File ............................................ 8
The TFT_eSPI Library ............................................... 9
The Serial Command Handler ......................................... 9
Command Formats ........................................................ 10
The Startup Menu ....................................................... 11
The ‘START’ and ‘STOP’ Commands ........................................ 12
The ‘CENTER’ Command ................................................... 13
The ‘SPAN’ Command ..................................................... 13
The “FOCUS” Command .................................................... 13
The ‘RBW’ Command ...................................................... 14
The ‘ATTEN’ Command .................................................... 15
The ‘PAUSE’ Command .................................................... 15
The ‘TRACES’ Command ................................................... 15
The ‘PREAMP’ or ‘GAIN’ Command ......................................... 16
The ‘GRIDREF’ Command .................................................. 17
The ‘SCALE’ Command .................................................... 17
The ‘DRIVE’ Command .................................................... 17

- Page 1 -
The ‘SAVE’ and ‘RECALL’ Commands ....................................... 18
The ‘FREQ’ Command ..................................................... 19
The ‘HELP’ (or ‘?’) Command ............................................ 20
The ‘STEPS’ Command .................................................... 20
The ‘DELAY’ Command .................................................... 20
The ‘VFO’ Command ...................................................... 20
The ‘IF_FREQ’ command .................................................. 21
The ‘REGDUMP’ Command .................................................. 21
The ‘RSSI’ Command ..................................................... 22
The ‘REGISTER’ Command ................................................. 22
The ‘REF_FREQ’ Command ................................................. 23
The ‘TUNE’ Command ..................................................... 24
The ‘ACTUAL_PWR’ Command ............................................... 25
The ‘CONFIG_SAVE’ Command .............................................. 25
The Web Interface ................................................. 25
Installing the Web Interface ........................................... 25
The Web Page Proper .................................................... 27
The Touch Screen Interface ........................................ 28
Main Menu .............................................................. 29
The ‘SWEEP’ Menu ....................................................... 30
The ‘DISPLAY’ Menu ..................................................... 31
The ‘STORAGE’ Menu ..................................................... 33
The ‘OUTPUT’ Menu ...................................................... 33
The ‘SAVE/RECALL’ Menu ................................................. 33
The ‘CONFIG’ Menu ...................................................... 33
The ‘CALIBRATE’ Menu ................................................... 34
Calibration Procedure ............................................. 34
Tuning the Transmitter (LO) Si4432 Module.............................. 35
Tuning the Receiver Si4432 Module ...................................... 36
Calibrating the Input Power ............................................ 36
Update the “My_SA.h” Header File ....................................... 37
Error Handling .................................................... 38

- Page 2 -
Known Bugs & Glitches ............................................. 38
Entering Frequencies ................................................... 38
The ‘PAUSE’ Command .................................................... 39
Suggestion Box .................................................... 39

- Page 3 -
Introduction
David (M0WID) and I have been slowly but surely making many
improvements to the software for Erik Kaashoek’s (PD0EK) TinySA.

The main modifications to date include modifying the software to run


on the ESP32 (WROOM or WROVER) processor and to use the Hiletgo
ILI9341 320x240 touch screen display.

Less visible changes include a lot of cleaning up and adding comments


to the code. The Si4432 transceivers and the PE4302 attenuators are
now implemented using a class/object approach. Using the built in WiFi
capabilities of the ESP32, David has added a web interface that works
with most web browsers as well as Android and Apple smart phones.

The serial command input has been made more human friendly at the
expense of making it incompatible with Erik’s original TinySA.exe
program. Once completed, the web page interface will replace that
program.

This documentation is nowhere near being a complete description of how


to use the software, but for the time being I will document some of
the enhancements to the user interfaces.

Hardware Compatibility
This software is designed to be compatible with the PCBs designed by
Glenn (VK3PE). He designed the hardware as a pair of stackable boards
with all the RF components on one board and the processor and other
components on a second board. The idea being that should someone want
to use a different processor, that could be implemented without having
to re-do the RF components.

His Version 1 PCBs had a few issues which he is in the process of


correcting. When I get the final schematics, I will add them here and
I’m sure Glenn will make the Gerber files available for those that
wish to have the PCBs made.

Note that Glenn’s PCB is designed to use the TTGO T8 V1.7 ESP32 board
(shop around; you can probably find it cheaper).

- Page 4 -
The Display

Wow! So much stuff on such a little screen! Let’s explain it all if


it’s not all self-explanatory. One thing to note, for many of the
items discussed here, I’ve noted that they can be manipulated using
either/or the serial command handler or the touch screen menus. Most
of them can also be set using the web interface, but as that is still
under development, I did not specify that option.

Screen Top

At the top left of the screen, you see the vertical scale setting; in
this case “10dB/” division. This can be changed using either the
serial command handler or the touch screen menus.

Across the top of the screen are the signal levels and frequencies for
each of the enabled markers there are four available. These can be
turned on or off using the touch screen menus; the ability to control
them from the serial input is on the to-do list.

- Page 5 -
We suggest that you leave marker #1 always enabled as that is the only
way (for now) that you can see the numerical data for the maximum
peak.

Bottom Line

On the bottom of the screen, you can see the frequency range of the
sweep. The start, center and end frequencies are shown. Again, the
sweep range can be set in a number of ways using either the serial
command handler or the touch screen menu system.

The text “Mode:SALo” indicates that the unit is operating in the


“Spectrum Analyzer Low Range” mode. This is the only mode currently
available.

Between the center and end frequencies is the time in microseconds


that the last scan took. The scan time is a function of the sweep
range and the RBW setting.

Left Side

There is a lot of stuff over here! From top to bottom:

At the top is the current RBW (Resolution Bandwidth) setting; If


displayed in green, it indicates that the RBW is in “auto” mode and
will vary based on the sweep width. If a specific RBW value is
specified, it will be displayed in orange text.

Next is the VRe (Video Resolution). This is a function of the display


resolution and the number of sample points.

Following that is the receiver Si4432 preamp gain. This can be set to
automatic (uses the Si4432 AGC capability) or can be set to specific
values using either the serial command input or the touch screen
menus. If the AGC is turned on, the text will be displayed in green;
if a specific setting is selected, the test will be orange. If the
gain trace is turned on, the level can be seen on the display.

The next field is for the external gain or attenuation (“Ext”). This
is not implemented yet.

- Page 6 -
Below that is the averaging setting. Averaging can be turned on or off
and the averaging factor can only be set using the touch screen menus
for now. When turned on, the text will be displayed in the same color
that you selected for the corresponding trace (set in the My_SA.h
file).

Next is an indicator that the spurious signal reduction filter is


enabled or not. For now, this can only be turned on or off via the
touch screen menus.

The “Ref” field shows the frequency setting of the transmitter


Si4432’s GPIO2 output or that it is turned off. This can be set using
either serial command input or the touch menus.

The final thing in the list shows the number of web clients that are
connected to the device. If the USE_WIFI symbol in the My_SA.h file is
set to false, this field will not be displayed.

Oops, I forgot to mention that the top and bottom line decibel values
are also displayed in the same color as you selected for DB_COLOR in
the My_SA.h file.

Right Side

If you have the gain trace enabled, down the right side of the screen,
the decibel scale for the gain trace will be displayed in the same
color as you selected for the GAIN_COLOR in the My_SA.h file. If the
gain trace is turned off, so is the scale.

Traces

There are four traces available. The normal spectrum display is shown
in yellow in the picture above along with the preamp gain trace in
green.

There is also an averaging trace available and a stored trace which


can be displayed simultaneously with the live spectrum trace for
comparison purposes.

- Page 7 -
The My_SA.h Header File
The My_SA.h file contains definitions of everything the user might
want (or need) to change. The things currently in this file are:

 The ability to enable or disable the WiFi (web) interface, and if


enabled the settings for your network SSID and password.
 The definitions of the colors you would like to use for the
various traces available on the display.
 Your personalized default settings that are set when the “DEFAULT
SETTINGS” touch screen menu item is chosen (not yet available via
the serial interface) from the “DISPLAY” menu item.
 Your choice of which hardware implementation of the PE4302
attenuator module is in use.
 The frequency and power calibration values for your particular
hardware implementation.
 The selection of which mixer type is installed in your hardware.
 The minimum and maximum frequency limits. What you set here
depends on your hardware configuration. Glenn’s PCBs have a
250MHz LPF on the input. There are filters on the Si4432 modules
that if not modified limit the device’s useful range to about
150MHz. The modification is described on Glenn’s web page.
 The FOCUS factor.
 The minimum touch screen pressure to be considered a valid touch.
 The default backlight level setting. Sooner or later there will
be a way to adjust this through the command structures, but not
yet
 Some definitions reserved for implementation of a rotary encoder
to control the menu system. It is doubtful that we will ever
bother to implement this.

The comments in the My_SA.h file explain in detail what the allowed
settings for each of the above items are and how to decide what you
need to change.

- Page 8 -
The TFT_eSPI Library
The current version of the program relies on the “TFT_eSPI” library to
handle the ILI9341 320x240 touch screen display. The library can be
installed using the “Tools – Manage libraries…” menu in the Arduino
IDE. When the “Library Manager” window has completed loading all the
available libraries, enter “TFT_eSPI” into the search box and click
the “Install” button. At the time of this writing, the current version
was 2.2.0.

After the library is installed, you need to copy the files:

M0WID_Setup_ILI9341_TinySA.h
WA2FZW_Setup_ILI9341_TinySA.h

from the “TFT_eSPI Setup Files” folder included with this software
into the “User_Setups” directory in the main “TFT_eSPI” library
folder.

You also need to edit the “User_Setup_Select.h” file in the main


“TFT_eSPI” library folder to add one or both of the above files to the
list of custom user setup files starting around line 22 in the file.

Un-comment one or the other of the above files in that list and
comment out the line that selects the default setup file. It should
look something like this when done:

//#include <User_Setup.h
#include <User_Setups/WA2FZW_Setup_ILI9341_TinySA.h>
//#include <User_Setups/M0WID_Setup_ILI9341_TinySA.h>

The only difference in the “WA2FZW” and “M0WID” custom setup files is
the setting of the SPI bus speed. The “M0WID” file has it set to 40MHz
which is the maximum allowed. If you get distorted screens, then
select the “WA2FZW’ file which has the bus speed set to 27MHz.

The Serial Command Handler


There are actually three user interfaces available on the device.
Parameters can be changed using the serial input (Arduino Serial
Monitor or some other terminal simulator program), the touch screen
menus or a web interface.

We haven’t gotten as far as making all changeable parameters available


on all three interfaces yet, however, we’re getting close!

- Page 9 -
The serial input command handler has been completely overhauled to
make it more human friendly and to add a couple of capabilities that
weren’t available in the original software.

In Version 2.0 I eliminated all the dumb single letter commands which
in many cases had no logical relation to the function to be performed.
For example ‘A’ to set the scan ‘START’ frequency. The command handler
now uses real command words!

Command Formats

In general, the command line consists of a keyword followed by one or


more numerical values. If no (optional) data is supplied with the
command, most of them will display the current setting of the
particular parameter when applicable. Some commands require no data.

The keywords (and data) can be entered in either upper or lower case.
The command word and data elements can be separated by either commas
or spaces.

One need only enter enough of the command word to make it uniquely
recognizable amongst the list of commands. For example if one were to
enter “ST”, that could be interpreted to be the “START”, “STOP” or
“STEPS” command and the program will display the message:

'ST' Is ambiguous!

However, if one wants to set the attenuator level, one need not enter
the entire “ATTEN” command word as “A” is enough to make the command
uniquely recognizable!

- Page 10 -
The Startup Menu

When the program is started (of if you enter ‘H’ or ‘?’), you will see
a menu of the available commands and the current settings for some of
the parameters:

Tiny Spectrum Analyzer Version 2.8 - User Commands:

Sweep Settings:

START.........Sweep start frequency, currently: 49,975,000 Hz


STOP..........Sweep stop frequency, currently: 50,025,000 Hz
CENTER........Sweep center frequency, currently: 50,000,000 Hz
SPAN..........Sweep frequency span, currently: 50,000 Hz
FOCUS.........Set single frequency mode with narrow bandwidth
RBW...........Set or get resolution bandwidth (RBW); currently: 2.6 KHz
ATTEN.........Set or get the attenuator setting; currently: 0dB
PAUSE.........Pause or resume the sweep

Display Options:

TRACES........Turn display traces on or off ['GAIN' or 'dB']


PREAMP/GAIN...Set or get the receiver preamp gain
See documentation for allowed values
GRIDREF.......Set the grid reference level; currently: -50dB
SCALE.........Set the dB/horizontal line value; currently: 10dB

Other Commands:

DRIVE.........Local oscillator drive level [0 to 7]; currently: 6


SAVE .........Save the current scan configuration [0 to 4]
RECALL........Recall a saved scan configuration [0 to 4]
FREQ..........Set or get the frequency for the selected VFO
HELP (or ?)...Show this menu
STEPS.........Steps, currently: 290
DELAY.........Timestep in uS, currently: 7500uS
VFO...........Set or get active VFO [R or ( L or T )]; currently: RX (0)

- Page 11 -
Debugging and Troubleshooting Commands:

IF_FREQ....... Set the IF (receiver) frequency [433 to 435MHz]; currently…


REGDUMP.......Display a dump of all the registers for the selected VFO
RSSI..........Output RSSI readings until the 'Q' command is entered
or one time only ['C' or '1']; the default is once.
QUIT (or Q)...Terminate RSSI output
REGISTER......Read or write a Si4432 register for the selected VFO
REF_FREQ......Set or get the transmitter GPIO2 reference frequency
TUNE..........Tune the frequency of the selected VFO
ACTUAL_PWR....Calibrate the indicated power level
CONFIG_SAVE...Save the hardware configuration parameters

The following sections describe each of the commands in the order that
they appear on the help list:

The ‘START’ and ‘STOP’ Commands

These commands allow you to set the low and high frequency limits of
the sweep range. The primary change from the original software is that
the way the numbers can be entered is now more consistent with how
they are entered using the touch screen menu system.

The frequencies can be entered in Hertz, for example:

START 100000000 for 100MHz

You can also insert commas or dots for clarity:

STOP 100,000,000 for 100MHz

But for consistency with the touch screen menus, you can also enter
the numbers with an ‘M’ or ‘K’ (upper or lower case) to indicate
megahertz or kilohertz, for example:

STOP 100M for 100MHz


START 100K for 100 kilohertz

If you try to set a ‘START’ frequency that is higher than the current
‘STOP’ frequency, the ‘STOP’ frequency will be adjusted to the value
of the symbol STOP_MAX (as defined in My_SA.h).

- Page 12 -
Similarly, if you specify a ‘STOP’ frequency that is lower than the
current “START’ frequency, the ‘START’ frequency will be adjusted to
the value of the symbol START_MIN (also defined in My_SA.h).

Both of these parameters can also be set using the web interface.

The ‘CENTER’ Command

The ‘CENTER’ command sets the center frequency of the sweep. It also
automatically adjusts the span range to be equal to the specified
‘CENTER’ frequency. For example if you enter the command:

CENTER 100M

The ‘CENTER’ frequency will be 100MHz and so will the frequency span.
In other words, the ‘START’ frequency will be set to 50MHz and the
‘STOP’ frequency will be set to 150MHz.

However if the setting of the ‘CENTER’ frequency puts it close enough


to the upper or lower sweep limits, the ‘SPAN’ will be narrowed so as
to not exceed the limits while keeping the ‘CENTER’ frequency at the
middle of the grid.

The frequencies can be entered in any of the formats as used for the
‘START’ and ‘STOP’ commands.

The ‘SPAN’ Command

This command is used to set the frequency range of the sweep while
maintaining the existing ‘CENTER’ frequency.

Should the specified ‘SPAN’ cause the ‘START’ or ‘STOP’ frequency to


exceed the sweep limits, the requested ‘SPAN’ will be reduced so as to
keep the sweep range within limits.

The “FOCUS” Command

The ‘FOCUS’ command is essentially an alternate version of the


‘CENTER’ command except that it sets the ‘CENTER’ frequency with a
narrow sweep range.

- Page 13 -
The sweep range is determined by the definition of the FOCUS_FACTOR
symbol (defined in My_SA.h). The sweep range will be set to the
‘CENTER’ frequency divided by the FOCUS_FACTOR. So, for example if the
FOCUS_FACTOR is set to 1,000 (as it is in the distributed software)
and you ask for a ‘FOCUS’ frequency of 50MHz, the sweep range will be
set to 50KHz.

If you have the ‘RBW’ in auto mode, it will be adjusted appropriately.

You can change the sweep range using the ‘SPAN’ command while
maintaining the ‘CENTER’ frequency.

The ‘RBW’ Command

The ‘RBW’ Command sets the resolution bandwidth (RBW). If the command
is entered with no data, the current setting is displayed.

If the command is followed by a number (in KHz) the RBW will be set to
a bandwidth that is equal to or possibly slightly higher than the
requested bandwidth.

The Si4432 is not capable of setting the receiver bandwidth to an


arbitrary number. The complete list of allowed bandwidths is listed on
pages 26 and 27 of Silicon Labs Application Note A440. The software
only supports a limited set of the possibilities however (you can see
the values in the bandpassFilters array in the “Si4432.cpp” file.

Thus, if you enter “RBW 300”, the response will be:

RBW = 335.5KHz

which is the next higher value in the bandpassFilters array.

You can also request automatic bandwidth selection by entering “RBW A”


or “RBW AUTO”. When the RBW is in auto mode, the actual setting is
determined by the frequency spread of the scan and is approximately a
300:1 ratio (scan range to RBW).

That is to say, for a scan range of 100MHz, the computed 300:1


bandwidth would be 333.3KHz but that would be adjusted to the next
higher value in the table which is 335.5KHz.

If the scan range is reduced to 25MHz, the computed bandwidth would be


83.3KHz, but the next higher value in the table is 112.1KHz.

- Page 14 -
Entering the command alone will cause the software to report the
current RBW setting. If not in auto mode, the actual RBW will be
displayed, however if the unit is in auto RBW mode, that fact will be
displayed along with the actual numerical bandwidth:

RBW = AUTO (335.5HKz) for example

The ‘ATTEN’ Command

The ‘ATTEN’ command sets the PE4302 attenuation. The valid range is
zero to 31dB; the maximum setting is defined by the value of the
symbol ATTEN_MAX in the My_SA.h file. If you have some other
attenuator arrangement, you can change that value to whatever is
appropriate. But note, the code will only actually set the attenuation
for the PE4302. The attenuator setting is taken into consideration in
determining the levels displayed on the sweep trace.

If the command is entered without any data, the current attenuator


setting is displayed:

Attenuator setting: 21dB

If the data value is out of the legal range an error message like:

Illegal attenuator setting: 45dB

will be displayed and the setting will not be changed.

The ‘PAUSE’ Command

This command is only available via the serial interface. When entered,
it stops scanning at the completion of the current sweep. Entering the
command a second time will cause scanning to continue.

This effectively gives you a single sweep capability.

The ‘TRACES’ Command

This command allows you to turn the main sweep trace or the gain trace
on or off. The command can be entered as either:

TRACES dB

- Page 15 -
Or TRACES GAIN

The selected trace will be toggled on or off. If no trace


specification is entered, you will get the error message:

No 'TRACES' item specified!

The ‘PREAMP’ or ‘GAIN’ Command

Either keyword may be used to set or see the current setting of the
receiver Si4432’s preamplifier. You can’t just set any arbitrary gain
value; the Si4432 has two ranges. The low range allows values from 5dB
to 29dB in 3dB steps and the high range allows settings from 25dB to
49dB in 3dB steps.

Notice there is some overlap. We’re not going to use the two upper
settings in the low range in other words for our purposes, the low
range will be from 5dB to 23dB only.

The format of the command is:

PREAMP nn or PREAMP AUTO

where “nn” is the desired gain value. If “nn” is not one of the
available specific allowed values, the program will use the next lower
allowed value. For example, if you specify “39”, the actual gain will
be set to 37dB.

If “AUTO” is specified, the Si4432’s AGC circuitry is turned on.

It’s explained (although not very well) on page 51 of the Silicon Labs
Application Note A440. Page 61 39 of the Si4432 datasheet shows a
graph of the AGC response versus the RSSI reading.

If a gain value of less than 5 or greater than 49 is entered, you will


see an error message like:

Illegal preamp gain value: 55


or Illegal preamp gain value: 2

If the entry is in the legal range, the program will tell you what the
gain was actually set to:

Preamp gain is 25dB

Or if the “AUTO” mode was requested:

- Page 16 -
Preamp AGC is on

If the command is entered with no setting specified, the program will


report the current setting.

The ‘GRIDREF’ Command

This command sets the decibel value for the top line of the grid. The
command format is:

GRIDREF nn

Where “nn” is a positive or negative decibel value for the top line of
the grid. Note, there is no limit to what you can enter, but the value
should be a reasonable one!

If no value is entered, the current setting will be displayed.

The ‘SCALE’ Command

This command sets the decibels per division value for the grid. The
command format is:

SCALE nn

Where “nn” is a positive value for the spacing between the horizontal
lines on the grid. Again, as is the case with the ‘GRIDREF’ command,
there is no limit to what you can enter, but the value should be a
reasonable one!

If no value is entered, the current setting will be displayed.

The ‘DRIVE’ Command

The ‘DRIVE’ command sets the drive (output) level for the transmitter
(LO) Si4432.

- Page 17 -
The drive level is entered as a number from '0' to '7' and the output
power will be set according to the following table (from page 39 of
the Si4432 datasheet):

0 => +1dBm 4 => +11dBm


1 => +2dBm 5 => +14dBm
2 => +5dBm 6 => +17dBm
3 => +8dBm 7 => +20dBm

If the command is entered with no data value, the response will be the
current setting, for example:

Drive: 6 (+17dBm)

If you entered a value, the response will show the new value.

If the number entered is not in the ‘0’ to ‘7’ range, an error message
like the following will be displayed:

Invalid drive specification: 8

and the level will not be changed.

The setting you chose is based on your particular hardware


configuration. If you are using the ADE-1 mixer, the recommended drive
level is +7dBm and if using the ADE-25MH mixer, the recommended drive
level is +13dBm.

If you are using Glenn’s (VK3PE) PCB, for example, that has a 3dB pad
between the output of the LO Si4432 and the mixer input which must be
compensated for. In that configuration, one would expect the LO drive
to be set to +17dBm to compensate for the presence of the pad.

The ‘SAVE’ and ‘RECALL’ Commands

These commands allow one to save the configuration of the current scan
setup in the flash memory. Up to five configurations (numbered 0 to 4)
can be saved and recalled.

- Page 18 -
The configurations are saved in the flash memory under the names
“Save0” through “Save4”. To save or recall a configuration, simply
enter the command and the number of the configuration you wish to save
or recall:

SAVE 3 for example

If you fail to enter a number for either command, you will see the
error message:

No save location specified!

If the number specified is not in the legal range, you will see the
message like:

Illegal location specification: 6

If the command is successful, the messages like:

Settings recalled from 'Save2'


Settings saved to 'Save2'

The ‘FREQ’ Command

The ‘FREQ’ command can be used to see or set the frequency of the
receiver or transmitter Si4432 module. The one that will be set or
read will be based on the currently selected VFO (see the ‘VFO’
command description).

With either VFO selected, one can request the current frequency by
simply entering ‘FREQ’ and the result will look like:

RX frequency: 430,000,000 Hz
LO frequency: 492,000,000 Hz

Specific frequencies can be entered for either the transmitter or


receiver by entering the ‘FREQ’ command followed by the desired
frequency. The frequency can be entered in the same formats as
described for the ‘START’ and ‘STOP’ commands.

Note, however entering a frequency for the transmitter is useless when


it is scanning as it is constantly changing as the scan progresses.
You’ll see this if you request the transmitter frequency repeatedly.

- Page 19 -
I haven’t figured out how this works when the unit is in “Generator”
mode.

The ‘HELP’ (or ‘?’) Command

The ‘HELP’ command displays the menu of allowed commands.

The ‘STEPS’ Command

The ‘STEPS’ command sets the steps value which defaults to the number
of DISPLAY_POINTS (290). I don’t see that it is actually used anywhere
in the software, however.

The ‘DELAY’ Command

The ‘DELAY’ command sets or displays the time delay in microseconds


between successive readings of the receiver RSSI (Received Signal
Strength Indicator) in the scan process.

If the command is entered with no number following it, the current


setting will be displayed. If a number is entered, the delay time will
be set and the new reading will be displayed:

Time per scan step = 200uS

The ‘VFO’ Command

The ‘VFO’ command can be used to see or set which Si4432 module is
currently selected. Many of the other commands available (e.g. ‘FREQ’)
are applied to one module or the other based on the selected “VFO”.

To simply see which is currently selected just enter the ‘VFO’


command.

To select one or the other enter “VFO R” to select the receiver, or


“VFO L” or “VFO T” to select the transmitter (LO). The output will
look like:

Selected VFO is: Receiver (0)

- Page 20 -
Selected VFO is: Local Oscillator (1)

If the selection is illegal (i.e., not ‘R’, ‘L’ or ‘T’), you will see
the following error message and the receiver VFO will be selected:

Illegal VFO specification!


Selected VFO is: Receiver (0)

The ‘IF_FREQ’ command

This command can be used to set the IF (receiver) frequency. You can
specify a particular frequency by entering the complete frequency in
any of the formats as described for the ‘START’ and ‘STOP’ commands or
you can enter a value to increment or decrement the current setting
by.

To use the increment/decrement capability, simply precede the


frequency by a plus or minus sign, for example:

IF -100k Decrement the IF frequency by 100KHz

If the command is entered with no data, the current setting will be


displayed.

The ‘REGDUMP’ Command

The ‘REGDUMP’ command is primarily a troubleshooting tool. It will


display a dump of the Si4432 registers for the selected VFO.

Here’s a partial example of the output:

RX Reg[0x00] = 0x08
RX Reg[0x01] = 0x06
RX Reg[0x02] = 0x21
RX Reg[0x03] = 0x20

The meaning of the values can be determined by referring to Silicon


Labs Application Note A440.

- Page 21 -
The ‘RSSI’ Command

The ‘RSSI’ command instructs the program to provide a list of the RSSI
(Receiver Signal Strength Indication) readings as the sweep
progresses. The RSSI value is the raw reading from the receiver Si4432
module.

If the command is entered with no additional data or if it is entered


as:

RSSI 1

The data displayed will only be for one pass through the sweep.

If the command is entered as:

RSSI C

the unit will continuously send RSSI readings to the serial output
until the ‘Q’ command is entered.

The format of the output is:

Freq: 1,034,480 Hz - RSSI: 122


Freq: 1,293,100 Hz - RSSI: 120
Freq: 1,551,720 Hz - RSSI: 109
Freq: 1,810,340 Hz - RSSI: 109

Beware, this outputs a LOT of data in continuous mode!

The ‘REGISTER’ Command

This is primarily a debugging/troubleshooting command. It can be used


to read out or set the contents of any of the registers in either the
transmitter (LO) or receiver Si4432. For a complete description of the
register values, please refer to Silicon Labs Application Note A440.

The general format of the command is:

REGISTER nn nn

- Page 22 -
where “nn” represents two hexadecimal digits. The first number is the
register of interest (and must be supplied) and the second number is
an optional data value to be loaded into the specified register. If
the data field is omitted, the program will simply show the current
contents of the register; for example:

RX Reg[0x0A] = 0x06

The values can also be entered as single hexadecimal digits if


appropriate. In other words, entering “REGISTER 5” is equivalent to
entering “REGISTER 05”.

The values may also be entered in the same format as is often used in
programming such as “0x0A”.

If you enter more than two hexadecimal digits, only the last 2 will be
honored. For example if you enter “REGISTER 123”, the command will be
applied to register 23. The same is true of the data field.

There are a number of error conditions that can occur:

Illegal Si4432 module specified; 'VFO' = n


No register specified!
'?' is not a hexadecimal digit!

The first message is unlikely and would indicate a software bug! The
second message occurs when the ‘REGISTER’ command is entered without
specifying a register and the third message indicates that a non-
hexadecimal digit was entered (the ‘?’ will be replaced with the
actual offending character).

Note also that when the user requests data to be loaded into the
register, the value displayed is actually read back from the register.
This was not the case in previous versions of the software.

Also note that some registers are read only and others may change the
value after it is set. For more information on the behavior of each
register refer to Silicon Labs Application Note A440.

The ‘REF_FREQ’ Command

This command is used to set the transmitter Si4432 GPIO2 frequency


which can be used to calibrate the unit. The format of the command is:

REF_FREQ nn

- Page 23 -
or REF_FREQ OFF

Where “nn” is the desired reference frequency. Valid frequencies are


30MHz, 15MHz, 10MHz, 4MHz, 3MHz, 2MHz and 1MHz. If an invalid
frequency is entered, the message:

‘nn’ is an illegal GPIO2 frequency setting!

will be displayed.

If the command is successful, the program will display the message:

Transmitter GPIO2 frequency: nnMHz


Or Transmitter GPIO2 reference frequency is off!

will be displayed.

If the command is entered with no data, the program will display the
current setting.

The ‘TUNE’ Command

This command is used to set the “load capacitance” of either the


receiver or transmitter Si4432 based on the current VFO selection.
This command is primarily intended to be used in the calibration
procedure.

The format of the command is:

TUNE nn

Where “nn” is a hexadecimal number between 0x00 and 0xFF (the number
may also be entered in that format).

The command will respond with:

RX capacitance: 0xnn
or TX capacitance: 0xnn

If no value is entered with the command, the program will show the
current settings.

- Page 24 -
The ‘ACTUAL_PWR’ Command

This command is used primarily in the calibration procedure to


calibrate the peak power shown on the display (or the web page)
against a known input level.

The format of the command is:

ACTUAL_PWR –nn

where “nn” is the actual input power at the unit’s input; it’s usually
as negative value in dBm, hence the minus sign.

If the command is successful, the message:

Indicated power set to: -nn

will be displayed. If no value is entered you will get the message”

No indicated power specified!

The ‘CONFIG_SAVE’ Command

This command forces the contents of the config structure to be saved


in the flash memory. It should be used at the completion of the
calibration procedure to save the parameters set during that process.

The Web Interface


David (M0WID) used the built-in WiFi capabilities of the ESP32 to
allow one to use any web browser (except Internet Explorer) to access
the TinySA unit. The web interface effectively eliminates the need to
use Erik’s “TinySA.exe” program which will no longer work anyway with
the updated serial interface.

We’ve tested the interface with Chrome, Firefox, and Android and IOS
phones.

Installing the Web Interface

There a few things you need to do in order to activate the web


interface.

- Page 25 -
First of all, look under the “Tools” menu in the Arduino IDE for an
item about halfway down the list named “ESP32 Sketch Data Upload”. If
that item doesn’t exist, you need to install the tool to upload data
to the ESP32 SPIFFS (Serial Peripheral Interface Flat File System)
from GitHub.

Next you have to upload the files in the “data” directory into the
SPIFFS. Make sure you don’t have the serial monitor open then go to
the “Tools” menu and select the “ESP32 Sketch Data Upload” item. The
IDE will load all the files in the data directory into the SPIFFS
automatically.

Next, edit the “MySA.h” file. There are three things you need to set
in there:

#define USE_WIFI true


// #define USE_ACCESS_POINT
#define WIFI_SSID "<put your network SSID here>"
#define WIFI_PASSWORD "<put your password here>"

I’m not familiar with the use of the “Access Point”, so I can’t
explain how to use that option.

Set the USE_WIFI definition to ‘true’ as shown and insert your WiFi
SSID and password in the appropriate places.

If you’re not going to use the WiFi interface change the USE_WIFI
definition to ‘false’, but DO NOT comment out the SSID and password
definitions; just leave the dummy stuff in there. That will cause
compiler errors. It’s on the to-do list!

Restart the ESP32 and you should see something like this on the serial
monitor:

Connecting...
Connecting to: <your network>
Connected - IP nnn.nnn.n.nn
Connected
WebSockets started
Building Server..
Setup - WiFi access point started - browse to http:// nnn.nnn.n.nn

If the connection between the TinySA and your router cannot be


established, you will get the message:

Connection Failed!

- Page 26 -
If the WiFi definition is not enabled in “My_SA.h”, you will see the
message:

WiFi not enabled!

But the rest of the program will continue to function just using the
display and serial interface.

The Web Page Proper

Put the IP address into your browser (you really shouldn’t need the
“http://” in front of it) and you should get the web page:

On the right side of the window are selection boxes that you can use
to change the sweep parameters. Changes made using the serial command
handler or touch screen will show up on the web page and vice-versa.

Note that in the present implementation, only a few of all the


possible sweep parameters can be changed from the web page. We’re
working on this!

At the bottom of the page you can turn the “dB’, “RSSI”, “gain” and
“average” traces on or off.

The one thing that’s not too obvious is the “menu” icon near the upper
right part of the screen (just to the left of “Sweep Settings” label).
By clicking on the icon, you can chose to print the graph or save it
as a “JPEG” or “PNG” picture file.

- Page 27 -
New in Version 2.8 of the software, you can use the mouse to select an
area of the graph and the program will zoom in on that segment. Here I
selected the area of the above picture from 20MHz to 40MHz:

Notice two more icons show up at the top right side of the graph. The
leftmost one doesn’t seem to do anything (a bug?) and the middle one
undoes the zoom.

The Touch Screen Interface


If one is using the ILI9431 touch screen display, the sweep parameters
along with many of the parameters related to the hardware
configuration can be set using this capability.

As is the case with most touch screen menu systems, this one has
multiple levels.

The menu items are activated by touching the screen near the right
side. You can use your finger, but if yours are as fat as mine, a
stylus works much better!

- Page 28 -
Main Menu

Here’s what the main menu looks like:

SWEEP

DISPLAY

STORAGE

OUTPUT

SAVE/
RECALL
CONFIG

We’ll discuss the details of the available sub menus in detail as we


read on, but here’s the high level of what each item does:

SCAN Allows the sweep frequency limits to be changed


along with the RBW and attenuator settings.
DISPLAY Turn the various traces on or off and set the
grid reference level and scale parameters.
STORAGE Save, display or compare a saved sweep.
OUTPUT Enable frequency generator mode (not yet
implemented) and set the transmitter Si4432 GPIO2
reference frequency.
SAVE RECALL Allows one to save and recall up to 5 sweep
setups.
CONFIG Calibration functions and other miscellaneous
hardware related settings.

- Page 29 -
The ‘SWEEP’ Menu

Selecting the ‘SWEEP’ item from the main menu brings up a sub-menu
that allows you to set the sweep frequencies in various ways:

SWEEP
START
SWEEP
STOP
SWEEP
CENTER
SWEEP
SPAN
FOCUS
FREQ
MORE->

<-BACK

The functions of the first five choices are comparable to the


equivalent commands as described in the Serial Interface command
descriptions.

When you request to change a frequency, the unit will display a


numerical keypad:

7 8 9

4 5 6 M

1 2 3 k

0 . < X

Frequencies may be entered in Hertz by entering the complete frequency


followed by the ‘X’ key, for example:

10000000X  10KHz

- Page 30 -
Or a frequency may be entered in Megahertz or Kilohertz using the ‘M’
and ‘k” keys, for example:

100M  100 Megahertz

Decimal points may also be used in either approach.

The “<” key is the backspace key.

The ‘MORE->’ button brings up more choices that allow you to do the
following:

RBW Allows you to select automatic mode or specify a


specific resolution bandwidth.
ATTEN Set the PE4302 attenuation.
MARKERS Allows the markers to be turned on or off, either
individually or all at once.

The ‘DISPLAY’ Menu

Selecting ‘DISPLAY’ from the main menu brings up a sub-menu with the
following choices:

TRACES

PREAMP
GAIN
REF
LEVEL
dB/DIV

SPUR
REDUCTION
DEFAULT
SETTINGS
<-BACK

- Page 31 -
The buttons do the following:

TRACES Brings up a sub-menu that allows the main sweep


trace and the gain trace to be toggled on or off.
You can also enable the average trace and set the
averaging value.
PREAMP GAIN Allows you to use the receiver Si4432’s AGC
function or to set a specific gain level.
REF LEVEL Sets the dB value for the top line of the grid.
dB/DIV Sets the number of decibels per horizontal line
on the grid.
SPUR REDUCTION Turns the capability on or off.
DEFAULT SETTINGS See the following:

Selecting the ‘DEFAULT SETTINGS’ item resets all of the sweep settings
to the “factory presets” (for lack of a better explanation). Most of
these can be changed by the user by means of a set of definitions in
the My_SA.h file:

Sweep Start Frequency AUTO_SWEEP_START


Sweep Stop Frequency AUTO_SWEEP_STOP
Grid dB/division AUTO_PWR_GRID
Preamp Gain AUTO_LNA
Grid Reference Level AUTO_REF_LEVEL
TX GPIO2 Frequency AUTO_REF_OUTPUT
Attenuator AUTO_ATTEN
RBW AUTO_RBW

These three parameters are hard coded and can’t be changed using the
definitions in the header file:

Default VFO Receiver


Gain Trace On
Sweep Trace On

If you understand how they are used in the software, you can change
the settings, but be careful!

- Page 32 -
The ‘STORAGE’ Menu

This menu allows you to ‘STORE”’ a sweep trace or ‘CLEAR’ a saved


trace. The ‘SUBTRACT’ option seems to simply display the stored trace
along with the active sweep.

The ‘OUTPUT’ Menu

The choices here are to put the unit into frequency ‘GENERATOR’ mode
and to set the frequency produced on the GPIO2 pin of the transmitter
Si4432 module. This signal can be used as a calibration source for the
unit.

I still haven’t figured out what the ‘GENERATOR’ mode does.

The ‘SAVE/RECALL’ Menu

This menu item allows the user to ‘SAVE’ and ‘RECALL’ up to five
different sweep setups (range, RBW, etc.).

The setups are saved in flash memory and can be recalled at any time.
The names of the files are “Save0” through “Save4”.

We could allow any number of names as well as free format names via
the serial input however that’s a bit hard on the touch screen
interface which currently doesn’t include an alphanumeric keypad.

The ‘CONFIG’ Menu

The options here include:

CALIBRATE Brings up a menu to perform the unit calibration.


TOUCH SCREEN Brings up another menu that allows you to
calibrate the ‘X’ and ‘Y’ coordinates on the
touch screen. You should do this the first time
you use the unit. A second option allows you to
scribble on the screen to see if the trace
actually follows your stylus.
IF FREQ Allows you to set the receiver (IF) frequency.

- Page 33 -
SAVE CONFIG Forces the “config” structure to be saved in the
flash memory after performing the calibration
procedure.
VERSION Like “Help – About”.

The ‘CALIBRATE’ Menu

The options here include:

TX FREQ Sets the crystal load capacitance value for the


transmitter Si4432, which is used to fine tune
the crystal frequency.
RX FREQ Does the same for the receiver Si4432.
ACTUAL POWER This is primarily used in the calibration
process. It allows you to specify the actual
power in dBm of a signal being observed to
calculate the proper position of the peak on the
grid.

Calibration Procedure
The calibration procedure is a three step process:

1. Tune the transmitter frequency


2. Tune the receiver frequency
3. Calibrate the input power reading

You’ll need some good test equipment to complete the process


accurately. A good calibrated signal generator and frequency counter
are the best tools to use. A good oscilloscope might be used also.

The procedure can be done using either the serial command input or the
touch screen menus, but is perhaps a bit simpler using the serial
command input.

- Page 34 -
Tuning the Transmitter (LO) Si4432 Module.

To tune the transmitter connect your frequency counter to the GPIO2


pin of the transmitter Si4432 (TP1 on Glenn’s Version 2 PCB); the
signal level at the ‘CAL_OUTPUT’ test point is probably too low to
drive a counter.

If you are doing the procedure using the serial command handler, use
the ‘VFO’ command to select the transmitter (LO) Si4432. If you are
using the touch screen menus, this is not necessary.

Using the ‘REF_FREQ’ command in the serial input set the GPIO2 output
frequency to the desired value to perform the calibration. If using
the touch screen, go to the ‘OUTPUT’ menu and choose the ‘REFERENCE’
option to set the frequency.

Use the ‘TUNE’ command in the serial input to set the transmitter
module’s crystal load capacitance until the desired frequency is
obtained. If using the touch screen, select the ‘CONFIG’ menu, then
‘CALIBRATE’ then ‘TX FREQ’ and enter the desired value using the
keypad.

If using the serial input, the numbers are entered in hexadecimal. For
a number of reasons, adding a hex keypad to the touch screen software
was rather difficult, so if you are using that approach, the value is
entered as a decimal number.

The default settings are found in My_SA.h and are set to 0x64 (100
decimal). Experience has shown these to be pretty close to the
required values.

Note that even though the range of values for the load capacitance
ranges from 0x00 to 0xFF (o to 255 decimal), the high order bit
(numbers higher than 127 in decimal) is not really part of the value,
but rather some type of overdrive if you will. See the description of
register 09h on page 14 of the Silicon Labs Application Note A440 for
an explanation.

Once satisfied that the transmitter frequency is accurate, use the


serial input ‘CONFIG_SAVE’ command to save the setting. If using the
touch screen, the ‘CONFIG SAVE’ is under the ‘CONFIG’ option on the
main menu.

- Page 35 -
Tuning the Receiver Si4432 Module

Once the transmitter frequency is correct, connect the ‘CAL_OUTPUT’


test point to the unit’s measurement input. You should see a definite
peak indication on the display (or web page) near the frequency you
set for the transmitter’s GPIO2 output.

Turn on marker #1 so you can see the numerical frequency and peak
level of the maximum peak. If using the web page, you can run your
mouse along the graph to see the maximum reading is.

Use the ‘VFO’ command to select the receiver Si4432 module if using
the serial command handler. If using the touch screen, this step is
not necessary.

Use the ‘TUNE’ command in the serial input or the ‘RX FREQ’ option in
the touch screen menu to set the receiver module’s crystal load
capacitance until the peak on the display is at the expected
frequency.

Once satisfied that the receiver frequency is accurate, use the


‘CONFIG_SAVE’ command to save the setting.

Calibrating the Input Power

With the following circuit on the output of the transmitter Si4432’s


GPIO2 pin, the “CAL_OUTPUT” should provide a power reference signal
fairly close to -30dBm (Glenn measured -28.5dBm on his Rigol spectrum
analyzer and I believe Erik reported an actual reading of -30.4dBm);
close enough for government work! Note that Glenn actually used
slightly different resistor values on his board; 56R and 3K9. The
values shown on the schematic are the proper values to use.

- Page 36 -
The component designations are from Glenn’s PCB and are included on
his Version 2 board.

You can connect the ‘CAL_OUTPUT’ to the input of the unit or use an
external input of known level to calibrate the power reading. Again,
make sure you have at least marker #1 enabled so you can see the
numerical data for the peak reading.

Use the serial input ‘ACTUAL_PWR’ command or the ‘ACTUAL POWER’ menu
selection (under the ‘CALIBRATE’ menu) to set the known peak power
level. That sets a calibration factor in the code that is saved in the
flash memory so whenever you restart the unit, the calibration should
be correct. You might also want to use the ‘FOCUS’ command to narrow
down the scan range and lower the ‘RBW’ when performing the
calibration.

There is no need to use the ‘CONFIG_SAVE’ command to save this


setting; it is done automatically.

Note that the maximum frequency that the GPIO2 pin is capable of
sending is 30MHz (you can set it from the serial input, the web page
or using the touch screen menus). But signals at higher frequencies
may be incorrect due to the characteristics of the input LPF. The
PE4302 attenuator also shows some increased loss at higher
frequencies.

If you have an accurate signal generator, the calibration can be


performed at any frequency close to what you intend to look at.

Update the “My_SA.h” Header File

In the “My_SA.h” header file are definitions of the values for the
crystal load capacitances:

#define TX_CAPACITANCE 0x64 (100 decimal)


#define RX_CAPACITANCE 0x64 (100 decimal)

You should change the values here to match what you came up with for
the crystal load capacitance values above. The values can be entered
here as either hexadecimal or decimal numbers. Those values will then
become your default values. Because of the way the configuration
values are saved it is possible that updates to new software versions
could erase your saved values if you don’t do this.

- Page 37 -
Error Handling
If a command entered via the serial command input causes some error
(usually an illegal input value), the user will be notified by means
of a message on the serial monitor (or other interface program).

These messages are documented in the explanations of the commands in


the section describing The Serial Command Handler.

If using the touch screen, error messages will be displayed on the TFT
display. Informational messages appear on a white background, warning
messages (again, usually illegal input values) are displayed on a
yellow background and fatal error messages are displayed on a red
background.

Here’s an example of a warning type message:

If a fatal error is encountered (so far there are none) execution will
be halted.

The parameter boxes on the web page will show errors next to the
appropriate box and some of them will also be shown on the display.

Known Bugs & Glitches


Entering Frequencies

When entering frequencies using the touch screen, the keypad allows a
decimal point to be used. For example, one could set the IF frequency
by entering:

433.92 followed by the “M” (for Megahertz) key

- Page 38 -
The ESP32 however doesn’t handle the floating point numbers with total
accuracy, and in this particular case, the frequency that actually
gets set is:

433,919,999 Hz which is probably close enough!

If the frequency is entered as:

433920 followed by the “k” (for Kilohertz) key or as


433920000 followed by the “X” key

The frequency will be correct.

The ‘PAUSE’ Command

If you use the ‘PAUSE’ command with the web page connected, the web
page will disconnect after a few minutes and sometimes the entire unit
will lock up requiring a reboot. I haven’t had a chance to look into
this.

Suggestion Box
I welcome any suggestions for further improvements. Please feel free
to email me at WA2FZW@ARRL.net.

- Page 39 -

You might also like