Signal generator

The signal generator example program is currently being developed so this page is also work in progress. The signal generator will be included in the next library release which is expected to happen by the end of May.

Things that remain to be done

  • Web
    • Hardware connection schematic
  • Program
    • Support for graphics display

The signal generator example program turns the RFzero into a semi-professional signal source from 2289 Hz to 200 MHz and beyond. In addition to a single frequency source the RFzero can also generate two-tone, I/Q, H3A or spread spectrum signals or be used as a sweep generator too. It is also possible to control various attenuators making the output level variable.

The hardware used during the development of the signal generator.

The amplitude and frequency can be controlled via a keypad, rotary encoders or via the USB port. Different kinds of displays can also be used.

If you want to work very closely with the Si5351A you can try the SigTest example program that allows direct register manipulation among other things.


Getting started

If you upload the signal generator program without having a “proper” I2C bus H/W, i.e. with pull-up resistors to 3V3 on both SDA (D8) and SCL (D9) pins which may be as stand-alone resistors or on an SX1509 module, the program will stop executing and the USB port will freeze. If so please see the I2C, SX1509 and MCP23017 paragraph at the bottom of the page.

The first time you run he signal generator program you will have to enter the configuration mode and evoke the “wr defaults” command to setup the EEPROM in the correct way. Otherwise the parameters may be gibberish.


Frequency

The frequency range for all the output modes, except I/Q-modulation, is 2289 Hz to 200 MHz and beyond. The closer the frequency gets to 300 MHz the less likely it is that the Si5351A PLL locks. This means that the frequency is highly unstable or not even generated. The lower end of the frequency range for the I/Q-modulation is 3,492 MHz.

The frequency can be changed using the keypad, MMI command or by turning the frequency rotary encoder.

The step value of the frequency rotary encoder can be changed by clicking the frequency rotary encoder push button (1 MHz -> 100 kHz -> 10 kHz -> 1 kHz -> 100 Hz -> 10 Hz -> 1 Hz -> 1 MHz …) in single frequency modes. In dual frequency output modes clicking the frequency rotary encoder will toggle between f0 and f1. The step value of the frequency rotary encoder can also be changed by using the keypad, menu or MMI.

Single frequency modes are: push-pull, I/Q and spread spectrum.

Dual frequency modes: two-tone, H3A and sweep.

Set the frequency in single frequency modes

  • Frequency rotary encoder
  • Keypad
    <F>FREQ<Enter>
    where FREQ is the frequency in Hz
    Pressing <*> after the second position pads the input with “000”
  • Menu
    Not possible
  • MMI
    wr freq FREQ
    where FREQ is the frequency in Hz

Set the frequencies in dual frequency modes

  • Frequency rotary encoder where the “>” indicated the active frequency
  • Keypad
    <F>FREQ <*><0><Enter>
    <F>FREQ <*><1><Enter>
    where FREQ is the frequency in Hz, <0> is for frequency0 and <1> is for frequency1
    Pressing <*> after the second position pads the input with “000”
  • Menu
    Not possible
  • MMI
    wr freq FREQ PORT
    where
    – FREQ is the frequency in Hz
    – PORT is the port 0/1 or start/stop for the sweep mode

Set the frequency step value

  • Frequency rotary encoder push button
    Click
    only in single frequency output modes otherwise it toggles between f0 and f1
  • Keypad
    <F><*>FREQ <Enter>
    where FREQ is the frequency step in Hz
  • Menu
    Not yet defined
  • MMI
    wr fstep STEP
    where STEP the step frequency is from 1 Hz to 10 MHz. Please note that if the settings are saved to the memory the step frequency will be rounded up to nearest power of 10 integer.

Amplitude

If you have connected an external attenuator it is possible to change the amplitude of the output from the RFzero. The attenuator defines the insertion loss and minimum output level.

In two-tone, H3A and sweep modes the amplitude is calculated using the f0.

The amplitude can be changed using the keypad, MMI command or by turning the amplitude rotary encoder. The step value of the amplitude rotary encoder can be changed by clicking the amplitude rotary encoder push button (toggles between 1 dB or the decimal resolution of the used attenuator), using the keypad, menu or MMI.

Set the amplitude

  • Amplitude rotary encoder
  • Keypad
    <A>AMPL<Enter>
    where AMPL is the amplitude in dBm
  • Menu
    Not possible
  • MMI
    wr ampl AMPL

Set the amplitude step value

  • Amplitude rotary encoder push button
    Click toggles between 1 dB and decimal step
  • Keypad
    Not possible.
  • Menu
    Not yet defined
  • MMI
    wr astep STEP
    where STEP is “one” for 1 dB step or “dec” for decimal step

Output modes

The RFzero can be set into different output modes

  • Push-pull (default)
  • Two-tone
  • I/Q-modulation
  • H3A modulation
  • Sweep
  • Spread spectrum

After changing mode it may be relevant to set the frequency/~ies again. The frequency range for all modes, except I/Q-modulation, is 2289 Hz to 200 MHz and beyond. The closer the frequency is to 300 MHz the less likely it is that the Si5351A gets out of lock and that the frequency is not made or highly unstable. The lower end of the frequency range for the I/Q-modulation is 3,492 MHz.

Each output mode has a keypad, menu and MMI command that sets the mode.

Push-pull

This mode has the highest power and the best spurious and harmonic performance. Especially the even harmonic are very low. This is also the default mode for most lab work.

Example of a push-pull signal.

Set the output mode

  • Keypad
    <*><0><Enter>
  • Menu
    Output mode | Push-pull
  • MMI
    wr output 0

Two-tone

The two-tone mode is very useful for testing the linearity of amplifiers. To release the full potential T1 has to be changed from the factory mounted transformer to a combiner.

Example of the a two-tone signal.

Set the output mode

  • Keypad
    <*><1><Enter>
  • Menu
    Output mode | Two-tone
  • MMI
    wr output 1

I/Q-modulation

I/Q-modulation consist of two signals, with the same frequency, that are 90° out of phase.

Example of I/Q-modulation signals.

To release the full potential T1 has to be removed. The I and Q signals can then be found on CON4 and CON5.

Set the output mode

  • Keypad
    <*><2><Enter>
  • Menu
    Output mode | I/Q
  • MMI
    wr output 2

H3A modulation

This is a variant of amplitude modulation (AM), where only one of the side bands is generated. In the receiver it will sound like normal AM.

Example of a H3A modulation signal with a 1 kHz tone.

The amplitude of the side band (f1) is about 10 dB lower than the carrier (f0).

Set the output mode

  • Keypad
    <*><3><Enter>
  • Menu
    Output mode | H3A
  • MMI
    wr output 3

Sweep

Sweeps between the start and stop frequencies using either 51, 101, 301 or 501 points and with a dwell time between 2 ms and 1024 ms.

Example of a sweep spectrum signal using max hold. Some glitches can be expected.

When the sweep starts a pulse, low to high, with a duration similar to the dwell time is made on A1.

During the sweep a DC voltage ramp, 0 V to 3,3 V, is present on A0.

Example of the sweep trigger (purple) and DC voltage ramp (yellow).

To enable the sweep mode please perform the below steps

  1. Set the sweep output mode
  2. Set the start frequency (f0) or use what is already set
  3. Set the stop frequency (f1) or use what is already set
  4. Set the number of sweep points and dwell time

It is not necessary to set the sweep output mode again if changing the sweep parameters, i.e. sweep points and dwell time, f0 and f1.

Set the output mode

  • Keypad
    <*><4><Enter>
  • Menu
    Output mode | Sweep
  • MMI
    wr output 4

Toggle the sweep on/off

  • Keypad
    <*><4><*><Enter>
  • Menu
    Not yet defined
  • MMI start/stop frequencies respectively
    wr sweep 1
    wr sweep 0

Set the number of sweep points, dwell time and start the sweep

  • Keypad
    <*><4><*>POINTS<*>TIME<Enter>
    where
    – POINTS is the number of sweep points 51, 101, 301 and 501
    – TIME is the dwell time from 2 ms to 1024 ms
  • Menu
    Output mode | Sweep | POINTS
    Output mode | Sweep | TIME
  • MMI
    wr sweep POINTS TIME
    where
    – POINTS is the number of sweep points 51, 101, 301 and 501
    – TIME is the dwell time from 2 ms to 1024 ms

Set the start and stop frequencies

  • Keypad
    <F>FREQ<*><0><Enter>
    <F>FREQ<*><1><Enter>
    where FREQ is the frequency in Hz, <0> is for frequency0 and <1> is for frequency1
    Pressing <*> after the second position pads the input with “000”
  • Menu
    Not yet defined
  • MMI start/stop frequencies respectively
    wr freq FREQ 0
    wr freq FREQ 1
    where FREQ is the frequency in Hz

Spread spectrum

The RFzero can be set to generate a spread spectrum signal with a modulation amplitude from 0,1% to 1,5% of the signal frequency.

To enable spread spectrum is a two step process

  1. Set the spread spectrum output mode
  2. Set the frequency and modulation

To disable the spread spectrum output mode set a different output mode.

Example of a spread spectrum signal.

Set the spread spectrum output mode

  • Keypad
    <*><5><Enter>
  • Menu
    Output mode | Spread
  • MMI
    wr output 5

Set the spread spectrum frequency and modulation

  • Keypad
    <*><5><*>AMPL<Enter>
    where AMPL is modulation amplitude percentage in 0,1% increments from 0,1% to 1,5%, but multiplied by 10, e.g. 10 for 1%
    The current frequency is used or set a new one
  • Menu
    Not yet defined
  • MMI
    wr spread AMPL
    where AMPL is modulation amplitude percentage in 0,1% increments from 0,1% to 1,5%
    The current frequency is used or set a new one

Saving, recalling and viewing settings

The settings can be recalled and saved to the memory, i.e. the EEPROM of the RFzero.

When the RFzero signal generator program starts the settings from memory 0 is loaded. But the RF is always off.

It is only possible to save, recall or view the settings when the program is in run mode.

Recall settings from memory

  • Keypad
    <#>NUMBER<#><Enter>
    where NUMBER is the memory number
  • Menu
    Memory | Recall | NUMBER
  • MMI
    rd mem NUMBER
    where NUMBER is the memory number

Save the current settings to memory

  • Keypad
    <#>NUMBER<*><Enter>
    where NUMBER is the memory number
  • Menu
    Memory | Save | Number
  • MMI
    wr mem NUMBER
    where NUMBER is the memory number

Please note that the step frequency will be rounded up to nearest power of 10 integer, and the sweep dwell time will be rounded up to nearest power of 2 integer.

Save settings to memory

  • Keypad
    Not possible
  • Menu
    Not possible
  • MMI
    wr mem NUMBER MODE FREQ0 FREQ1 FSTEP ATT ASTEP SWPTS SWPTIME SSAMPL
    where
    – NUMBER is the memory number
    – MODE is the output mode number
    – FREQ0 is the f0
    – FREQ1 is the f1
    – FSTEP is the frequency step value in Hz
    – ATT is the attenuation level
    – ASTEP is the attenuation step “one” or “dec”
    – SWPTS is the number of sweep points
    – SWPTIME s the sweep dwell time
    – SSAMPL is the spread spectrum amplitude

All values have to be included even if they are not used for the actual output mode. Thus valid but dummy values can be used.

Please note that the step frequency will be rounded up to nearest power of 10 integer, and the sweep dwell time will be rounded up to nearest power of 2 integer.

Viewing the settings

  • Keypad
    Not possible
  • Menu
    Not possible
  • MMI
    rd set

The settings are listed on the USB port.


Keypad command overview

CategoryCommandSyntaxNote
AmplitudeSet the amplitude<A>AMPL<Enter>
Negative sign<#>
Decimal separator<∗>
FrequencySet the frequency<F>FREQ<Enter>For single frequency modes
<F>FREQ<#>0<Enter>For sweep mode start frequency
<F>FREQ<#>1<Enter>For sweep mode stop frequency
<F>FREQ<#>PORT<Enter>For dual frequency modes
Add 000<∗>Pad the input with three zeros
Increment/decrement value<F><∗>FREQ<Enter>
Output modeSet push-pull<∗>0<Enter>
Set two-tone<∗>1<Enter>
Set I/Q<∗>2<Enter>
Set H3A<∗>3<Enter>
Set sweep<∗>4<Enter>
Set sweep parameters<∗><4><∗>POINTS<*>TIME<Enter>Also starts the sweep
Start/stop sweeping<∗>4<∗><Enter>
Set spread spectrum<∗>5<Enter>
Set modulation amplitude<∗><5><∗>AMPL<∗><Enter>AMPL is x10%, e.g. 10 for 1%
MemoryRecall from memory<#>NUMBER<#><Enter>
Save to memory<#>NUMBER<∗><Enter>Save the current settings to memory

Menu overview

Awaiting the maturity of the signal generator program to ensure an easy and consistent use.


Configuration

The configuration of the program is done via the USB port, 9600 Baud, 8 bits, no parity and one stop bit, using a terminal program (e.g. Arduino IDE Serial Monitor, Termite Terminal (Windows), CuteCom (Linux) or Terminal (Mac OS)). Please connect the RFzero via a USB B cable to your computer and connect the terminal program to the right COM port in the terminal program. The RFzero identifies itself as an Arduino Zero (Windows Device Manager).

If you don’t see the RFzero> or RFzero config> prompts please press the enter key. When you want to execute a command you don’t have to enter the prompt but only the command and parameters after the >.

All input to the RFzero must be in lowercase.

To enter the configuration mode please enter   config   at the RFzero> prompt, i.e.

RFzero> config

To see the available commands please enter   ?   at the RFzero config> prompt, i.e.

RFzero config> ?

To leave the configuration mode please enter   exit   at the RFzero config> prompt, i.e.

RFzero config> exit

When in configuration mode, i.e. when you see the RFzero config> prompt, the most frequent commands are

rd cfg

to see the configuration that will be used after exiting the configuration mode.

wr defaults

to set most of parameters to their default values. Please see the actual example program for the specific default values.

wr display MODE

to set the display mode where MODE is

  • 0: None
  • 1: LCD 16 characters and two lines
  • 2: LCD 20 characters and four lines
  • 3: Graphics display (type pending)

wr rotenc TYPE

to set the type of the rotary encoder type.

  • 0: Full step
  • 1: Half step

If you have set the right rotary encoder type you will experience one step per click. If you on the other hand experience two steeps per click you have a full step rotary encoder but are using a half step configuration. If you experience you have to turn two click to get one step you are using a help step rotary encoder in a full step configuration.

Both the amplitude and the frequency rotary encoders have to be of the same type.

wr att MODE

to set the attenuator mode where MODE

  • 0: None
  • 1: 6 bits 0-31,5 dB in 0,5 dB steps connected to the SX1509
  • 2: 7 bits 0-127 dB in 1 dB steps connected to the SX1509
  • 3: 8 bits 0-127,5 dB in 0,5 dB steps connected to the SX1509
  • 4: 9 bits 0-76,5 dB in 0,5 dB steps connected a MCP23017
  • 5: 11 bits 0-106,5 dB in 0,5 dB steps connected a MCP23017

Please also see the Attenuator section below.

wr sx1509 ADDR

to set the SX1509 I2C address in hex 3E, 3F, 70 or 71. Set to 0 is no SX1509 is connected. If set to 0 only the MMI commands via the USB port can be used.

The most used address is 0x3E.

wr mcp23017 ADDR

to set the MCP23017 I2C address in hex between 20 and 27. Set it to 0 if not in use.

The most used address is 0x20.

wr pwr INDEX LEVEL

to calibrate the power LEVEL in dBm for INDEX where

  • 0: 100 kHz
  • 1: 300 kHz
  • 2: 1 MHz
  • 3: 10 MHz
  • 4: 100 MHz
  • 5: 200 MHz
  • 6: 280 MHz
  • 7: 290 MHz

E.g. to set the level at 100 MHz to 14,5 dBm

wr pwr 4 14.5

Please remember that the level must include the insertion loss of the optional attenuator and low pass filter bank.

Please see the Calibration section below for a more detailed explanation about the calibration.

wr filter INDEX CONTROL

to set the ULN2803A low pass filter CONTROL bit pattern, in hex, vs the highest frequency used for INDEX where

  • 0: 2 MHz
  • 1: 4 MHz
  • 2: 5 MHz
  • 3: 10 MHz
  • 4: 22 MHz
  • 5: 49 MHz
  • 6: 110 MHz
  • 7: 250 MHz

E.g. to set the control bits to 0x04 for the 10 MHz low pass filter

wr filter 3 4

Above 250 MHz all bits are 0.


Calibration

You can calibrate your RFzero to match your specific solution which includes the Si5351A, T1 (the standard transformer, combiner or nothing), attenuator type and low pas filter bank. The signal generator program has a set of general default values measured using a standard RFzero, i.e. T1 is a transformer and no attenuator or low pass filter bank connected.

If you want you can calibrate your setup in the configuration mode using the “wr pwr” command. But you will need a good watt-meter that can measure the power from -20 dBm to 15 dBm.

Example of the maximum output power vs frequency of a typical RFzero.

If you have an attenuator connected the actual power vs frequency is the maximum power minus the attenuation.

Below is a description of the different frequency intervals, their characteristics and how the power is found.

Below 30 kHz

Below 30 kHz the output power is set to uncalibrated and as the picture above shows it is typically below -15 dBm.

Between 30 kHz and 100 kHz

Between 30 kHz and 100 kHz the power level is calculated using a hard coded formula. The formula has been made with a curve fit tool. If you want to make your own calibration you can enter your measurements into e.g. MyCurveFit, and see which formula and coefficients have the best fit. The one already in the signal generator is a third order polynomial. Then enter the formula in the

int maxPower(const unsigned int freq);

function located in the global.cpp file.

Between 100 kHz and 290 MHz

Between 100 kHz and 290 the actual power level shown is calculated by interpolating between the power level set in the configuration.

Above 290 MHz

When operating the Si5351A high above its 200 MHz maximum frequency sooner or later the PLL will not lock. This means that some output may be present, but it will be highly unstable. At what output frequency this occurs depends on the actual device. However, empirically 280 MHz to 290 is doable for all devices. But the way from 280 MHz over 290 MHz, where interpolation is still used, and towards 300 MHz also shows a steady decline in power as the above picture shows. Due to this behavior the output power above 290 MHz is displayed shown as uncalibrated.


Hardware

You may use the signal generator example program without connecting anything else than a computer to the USB port. However, if you want to have a semi-professional signal generator connecting a display (LCD or graphics), two rotary encoders with push buttons, a 4×4 keypad and two extra push buttons, an attenuator and a low pass filter bank will be a great extension.

The signal generator block schematic showing all the entities.

If you want to attenuate the harmonics you will also need a low pass filter bank which is controlled on D7 to D0 or via the on-board ULN2803A

“Shopping list” and overview of the hardware entities and options.

EntityMinimumMediumMaximum
RFzeroXXX
Display (20×4 LCD is recommended)XX
SX1509 port expanderXX
Keypad 4x4XX
Frequency rotary encoder with push buttonXX
RF on/off buttonXX
Menu buttonXX
Amplitude rotary encoder with push buttonX
AttenuatorX
MCP23017 port expander if the attenuator uses more than 7 bitsX

The 4×4 keypad, rotary encoders with push buttons, display, SX1509 and MCP23017 are available from many sources. The attenuator can be professional surplus, a cheap module or a do-it-yourself type.

The 4×4 keypad, rotary encoders with push buttons, RF on/off push button and Menu on/off push button will effectively make a 5×4 keypad that is connected to the SX1509.

Here is a schematic (missing??) that shows how to wire all the entities together. Once the SX1509 and the rotary encoders have been connected you can load the SigGen_SX1509test example program to verify your work. This can be very helpful in case of troubleshooting rather than to use the “big” signal generator program.

EntityPinConnected to entityConnected to pin
SX1509GNDRFzeroGND
3V3RFzero3V3
SDARFzeroD8/SDA
SCLRFzeroD9/SCL
INTRFzeroD17
IO0Keypad
Amplitude rotary encoder
5
Push button Y
IO1Keypad
Frequency rotary encoder
6
Push button Y
IO2Keypad
RF on/off
7
Push button Y
IO3Keypad
Menu on/off
8
Push button Y
IO4AttenuatorBit 0, LSB
IO5AttenuatorBit 1
IO6AttenuatorBit 2
IO7AttenuatorBit 3
IO8Keypad1
IO9Keypad2
IO10Keypad3
IO11Keypad4
IO12Amplitude rotary encoder
Frequency rotary encoder
RF on/off
Menu on/off
Push button X
Push button X
Push button X
Push button X
IO13AttenuatorBit 4
IO14AttenuatorBit 5
IO15AttenuatorBit 6, MSB
Keypad (see also note below)1SX1509IO8
2SX1509IO9
3SX1509IO10
4SX1509IO11
5SX1509IO0
6SX1509IO1
7SX1509IO2
8SX1509IO3
Amplitude rotary encoderGNDRFzeroGND
ARFzeroA2
BRFzeroA3
Push button XSX1509IO0
Push button YSX1509IO1
Frequency rotary encoderGNDRFzeroGND
ARFzeroA5
BRFzeroA4
Push button XSX1509IO12
Push button YSX1509IO1
RF on/offPush button XSX1509IO12
Push button YSX1509IO2
Menu on/offPush button XSX1509IO12
Push button YSX1509IO3
MCP23017GNDRFzeroGND
3V3RFzero3V3
SDARFzeroD8/SDA
SCLRFzeroD9/SCL
GPA-GPBAttenuatorDepends on att.

Display

If you use a HD44780 compatible LCD connect it to the JP12 LCD connector in the normal way. Alternatively you may connect a ?? graphics display. The type of display must be set in the configuration.

Connections for a graphical display controlled via SPI.

DisplaySignalRFzero
Not connectedMISOD16
SDI/MOSIMOSID18
SCKSCKD19

This section will be moved to the general display description when the graphics display has been implemented in all of the example programs.

Keypad

Adding a 4×4 standard keypad to your RFzero will make it easy to change e.g. amplitude or frequency. To make it even easier to remember which keys to use the <B> and <D> keys can be modified using a scalpel so the <B> key will look like an <F> for frequency, and the <D> key will look like an <Enter> key arrow.

Example of a keypad where the <B> and <D> keys have been modified to look like an <F> and <Enter> arrow by removing the red parts of the letters.

Attenuator

If you want to have a variable output from your RFzero you will have to add an attenuator. It can be a simple module found on e.g eBay or professional surplus found on e.g. a flea market. They come in a million different sizes, attenuation ranges and resolutions.

Example of a simple 6 bits, 31,5 dB in 0,5 dB steps attenuator.

Example of a professional 7 bits, 127 dB in 1 dB steps attenuator.

A number of “standard” attenuators have been implemented in the signal generator example program. More can be added. You can do this yourself or ask for a it to be added. Since there are many different kinds of ways to control RF attenuators this cannot be generalized. Thus it has to be hard coded.

Implemented attenuator types and the attenuator mode.

Max attenuation [dB]Steps [dB]BitsTypeControllerPinsMSBLSBActiveMode
31,5         0,56PE4302
SKY12347
SX1509IO[14:13]+IO[7:4]IO[14]IO[4]Low1
31,5         0,56GenericSX1509IO[14:13]+IO[7:4]IO[14]IO[4]High2
63,0         1,06GenericSX1509IO[14:13]+IO[7:4]IO[14]IO[4]High3
127,0         1,07GenericSX1509IO[15:13]+IO[7:4]IO[15]IO[4]High4
127,5         0,58GenericMCP23017GPA[7:0]GPA[7]GPA[0]High5
76,5         0,512RFzeroMCP23017GPA[3:0]+GPB[7:0]GPA[3]GPB[0]Mixed6
106,5         0,516RFzeroMCP23017GPA[7:0]+GPB[7:0]GPB[7]GPA[0]Mixed7

I2C, SX1509 and MCP23017

Both the SX1509 and MCP23017 are connected to the RFzero via the I2C/Wire bus. Please remember to connect the pull-up resistors yourself if you use the bare IC. Most ready made modules already have the pull-up resistors mounted.

If no pull-up resistors are connected the I2C bus then it will hang, and it will cause the program and USB port to hang too. This is not unique to the RFzero but is a general thing in Arduino.

If the program hangs connect a resistor, 4,7 kΩ to 10 kΩ , from D8 to 3V3 and another one from D9 to 3V3. Then try to upload the program again, while being prepared to double click the reset button, until the uploading is successful. You may then, in the configuration, set both the SX1509 and the MCP23017 addresses to 0 which disables the activation and use of the I2C bus.

You can see more tricks in the troubleshooting guide.