README.txt PhasorToy Documentation for the XEM7320 version William Carter Version 0.40 June 30 2020 Welcome to the Fun with Phasors Demo No, not those kinds of phasers... I'm talking about the much more fun mathematical concept of phasors. What's the purpose of the PhasorToy Demo? The PhasorToy demo is meant for educational purposes only and is not designed to do over the air transmissions. I mention that because this demo doesn't address the normal signal conditioning required to connect the DAC outputs to a HF transmitter. Always abide by spectrum restrictions in your area. For the US the FCC has pertinent documentation. The demo is designed to: - Allow users to have a lab tool for generating a number of waveforms. - Allow users to experiment with a few simple Modulation schemes. The first release only does modulation but the intention is to complete the demo with Demodulation for supported schemes. - Demonstrate an alternate way to create ZYNQ based FPGA designs that focus on the HDL flow. - Discuss FPGA platform tradeoffs and issues - Get your minds thinking about implementing MODEM concepts into logic using the HDL flow. - If you are new to OCTAVE you might find some interesting ideas in the provided script What can I do with PhasorToy? You can interact with the FPGA platform to create a number of waveforms including tones, chirp, FSK, PSK and AM modulation. This might be useful for stimulating analog inputs for other projects or just as an exercise in playing with the waveforms and seeing a visual representation on an oscilloscope. You can create and send FSK, PSK, and 4-QPSK messages. You can also see if you can demodulate messages. PhasorToy Requirements - An Opal Kelly XEM7320 with one ZmodDAC1411 SYZYGY pod. - GNU OCTAVE is recommended though not required - An oscilloscope with a bandwidth of at least 100 MHz is highly recommended. At a minimum you need a way to capture complex waveforms with significant durations. PhasorToy Assets - PhasorToy.m OCTAVE script for simulating waveforms and creating configuration commands that control the hardware - A Win10 PhasorToy.exe, and okFrontPanel.dll that configures the FPGA and runs the demo - 6 Command files generated by PhasorToy.m - The XEM7320_PhasorToy.vhd toplevel design source file A 30 Second Course in Communications You probably know that a vector is a scalar mathematical concept that conveys magnitude and direction. Now, if you tie the 'tail' end of a vector to a fixed point, let's say the origin of a polar graph, and kick the 'head' end to send it spinning you've got yourself a phasor. A phasor has magnitude and angle and perhaps radial velocity. If the radial, or angular, speed of the phasor is constant it can represent a single tone. The time it takes for the phasor to make one complete pass through the polar representation of 0 radians or degrees can represent the frequency of that tone. Of course, a phasor isn't restricted to having a fixed magnitude or length. If you create a carrier tone and change the phasor magnitude as it spins you are doing AM modulation. You can also periodically change the angular speed to some other angular speed and do FSK or frequency shift-keying. If you only have two speeds this is BFSK or binary frequency shift-keying. As you suspect, it's possible to have more than 2 frequencies for M-FSK modulation. Now, if you can picture an FSK waveform it becomes clear that each frequency could represent a symbol, or value, and stringing a number of FSK symbols one after the other creates an encoded message. In fact, the concept of shift-keying is nifty enough to find a place in a lot of phasor manipulation schemes. AM and shift-keyed approaches are only the beginning of phasor manipulation fun. What would happen of you were to periodically negate the magnitude of your phasor? It would first send it to the polar quadrant opposite of the one in which it was and also send it spinning in the opposite direction. This is how to do BPSK, which is equivalent to shifting the phasor by 180 degrees. You can do a number of phase shift-keying manipulations on your phasor. It's possible to have more than one phase shift position relative to a 0 phase reference tone. The demo shows one way to do 4-QPSK in which there are 4 phase offsets or 2-bit symbols. Of course there are a lof of ways to manipulate your phasors as it spins. There's PM and FM for example. But those are for another demo as the discussion gets a bit more compicated. But don't let that stop you from thinking about other ways to manipulate your phasor. Conceptually, the difference between phase and frequency is hard to grasp. What would happen if you were to negate your phasor just as it were about to cross the 0 and 180 degree angle positions? I bet you can come up with other ways to manipulate your phasor to accomplish some function. Being able to visualize what's happening helps with imagining and that's what this demo is all about. Wouldn't it be nice if you could create a phasor in an FPGA? Well, the PhasorToy demo is here to show you that you can. All it takes is creating the right structures and using them correctly. Using modulation and demodulation to send and receive information can get pretty complicated and no 30 second introduction could possibly mention the details. But this should be enough to get the gears in your mind grinding away and the demo should be sufficient for some interesting experimentation. A brief Description of the PhasorToy HW and SW design This version of the PhasorToy demo uses the XEM7320. I've released it so that you can compare how the demo works on the Opal Kelly XEM7320 and the Eclypse-Z7 from Digilent. This is an all HDL design on an Artix A7-75T. The board has a USB 3.0 port for FPGA configuration and data transfer between a PC and the target platform. Opal Kelly does not supply schematics and users must use encrypted pre-compiled IP to use the USB 3.0 interface. The board does have a SYZYGY transceiver port and a standard 14-pin JTAG header compatible with the Digilent HSx programming cables. This is important because it allow Vivador Hardware Manager to communicate with the board and any debugging cores like and ILA. Creating the design for this demo was a great deal easier than for the ZYNQ based Eclypse-Z7 for a number of reasons: - only 1 software application to develop - All HDL means no dancing with VIvado SDK tools - The entire design can be simulated in VIvado ISIM The basic component of the PhasorToy demo is the NCO, or Numerically controlled oscillator. My NCO IP is based on the phase accumulator concept. The Phase accumulator basically represents a phasor. If the Phase accumulator is changing at a constant rate the upper bits can be used as a pointer into a look-up table that contains sine data. It's the Phase Accumulator that provides the phasor angular position and radial velocity that we need. It's the sine table that provides the sampled waveform amplitude. Let's call the value that gets added to the phase accumulator an FTW, or frequency tuning word. If this is fixed, then the phase accumulator will overflow at a constant rate. It's the Phase Accumulator to provides the angular velocity for out phasor and depends on the clock rate at which it runs as well as the FTW. The overflow rate represents the waveform frequency. It's a simple concept with powerful applications. You can read about this by heading to the Analog Devices website and finding application notes about devices using DDS. My version of the NCO or DDS uses 1 Artix 36K BRAM to provide 8192 18-bit simultaneous sine and cosine amplitudes per 360 degree polar rotation at a 100 MHz Fs. This gives an angular resolution of 0.0439453125 degrees. Perhaps you can do better but I'm pretty pleased with it. I'm not wasting BRAMs, that's for sure. The Phase accumulator has a 32-bit width which allow for creating a few decades of range of signals from a few hertz to a few MHz without further signal conditioning. I'll let the reader work out the details as not all implementations of what I've just described will give the same results. One step up the heirachy is the SIG_GEN component that uses 2 NCOs and a dual-port ram that can contain a sequence of FTWs, along with other information that we might need to modulation. The SIG_GEN has all of the logic needed to run the NCO's in various modes producing each waveform type. This demo has 1 SIG_GEN. As it can produce simultaneous sine and cosine from each NCO that's plenty for a 2 channel DAC. There is an ILA in the SIG_GEN so that you can see data that comes out of the sequencer BRAM. You should be able to open Vivado and connect to it. How do I use the PhasorToy Demo? Connect a ZmodDAC 1411 to SYZYGY Port B on the XEM7320. Connect the XmodDAC outputs to your oscilloscope. The ZmodDAC is designed to drive 50 ohm loads and I use a direct 50 ohm SMA to SMA connectino into the scope through an adapter. The scope input is set for 50 ohms. If you want to calibrate the zMODs for amplitude and offset you should terminate to 50 ohms. An alternate way to do this would be to have a tee at the scope and connect one side to the scope, set for 1 M ohm input and the other connected to a 50 ohm terminator. Compared to the ZYNQ demo this is pretty straight-forward. Simple open a WIN10 COmmand Prompt terminal and cd to where the PhaasorToy.exe and okFrontPanel.dll are located. You can provide 1 command line argument to open a command text file generated by the OCTAVE PhasorToy.m script. For example to run the Dem in AM mode: PhasorToy -f AMcmd.txt If you execute PhasorToy without the -f argument it will simply run a write/read test of the sequencer LUT. At this point you can use the PhasorToy.m OCTAVE script to try out you own waveforms. Please read through the script carefully before starting as it has a lot of useful information. There are commented out lines for creating ascii txt files with new commands. Using OCTAVE and the Instrument Control package on Linux it's probably possible to run the hardware directly from OCTAVE but I'm developing this project on Win10 and like having files around for reference anyway. One thing to keep in mind is that the default setting for your oscilloscope is to use a sin(x)/x visual representation for the display and that can result in misleading interpretations of what you have. But we're using sinewaves so the scope just make everything look better. The PhasorToy.m contains most of the documentation for the demo and plots pretty much what you should see on an oscilloscope. The AM and PSK waveforms out of the DACs currently have about half the amplitude that they should. - for TONE, CHIRP, AM modes CH1 is a sinewave and CH2 is a cosine wave of the same frequency - for BPSK and 4-QPSK CH1 is the modulated signal and CH2 is a reference signal to check symbol phase What are the limitations for Version 0.4? If you've been reading to this point you realize that having a 'MO' demo without the 'DEM' side means that this version can't get past 0.5 as it's only half done. I also have other pressing things to do so I'm releasing the as it stands today with the expectation, that if there's interest, I'll add the missing half of the demo later. I haven't bothered to deal with the calibration aspects of the ZmodDAC as this demo doesn't require it. I should note here that because of the way that Digilent implemented their Eclypse-Z7 using their pods on the Opal Kelly FPGA platform has issues. For one thing the Digilent ZMODs so far have calibration data that at this point is not accessible by the Opal Kelly Front Panel application. This means that it will be harder to do offset and gain calibration for the DAC and ADC pods. The SYZYGY standard is still in its infancy so I suppose that there is work to do. There's no point in having all of the burden of Plug and Play if vendors don't want to play nicely. I already have a list of things that I want to change as well as assets that might not have made it into this release. Feel free to provide questions and comments to the Digilent Project Vault Forum. Enjoy!