Software Defined Radio - thoughts on P2 application

bob_g4bbybob_g4bby Posts: 30
edited 2020-07-10 - 17:50:05 in Propeller 2
Just thinking aloud here,

Over the past 20 years, the amateur radio scene has seen a disruptive change in hardware design brought about by software defined radio. Hams pioneered it in fact. Here's an article that introduced it to many of us https://sites.google.com/site/thesdrinstitute/A-Software-Defined-Radio-for-the-Masses. No more superheterodyne circuitry.

The sdr principle is simple: On receive a small part of the radio spectrum (say 3.7-3.72 MHz) is mixed with an RF oscillator (say at 3.7MHz). After low-pass filtering the difference signal spans 0-8kHz or maybe as high as 0-192kHz. Actually two signals are produced, 90deg out of phase with each other using a Tayloe detector (Dan Tayloe perfected it). These two signals are digitised by a cheap stereo, low-noise 24bit sound card chip into two streams of integers, usually labelled I (in phase) and Q (quadrature).

From there on, the signal path is all digital until the sound output dac, amplifier and speaker. The platforms that hams have used range from multicore PCs, through RasPIs down to DSPIC33 chips. A pal of mine in northern England has developed an HF radio with the DSPIC33 - he can be heard most weeks chatting with other hams all over Europe. He gets good signal quality reports. He's also a keen cave explorer, and has developed 'cave radios' for surface-to-ground communications and for cave surveying. (VLF signals penetrate rock to a degree). He runs his radios at between 8k - 16ksamples/second - adequate for the 3kHz wide signals used on-air.

He's programmed the dsp on a 70MHz dspic33 in C, on a sample-by-sample basis - he doesn't process arrays of samples due to compute/memory constraints. The DSPIC is used to control the radio hardware as well - tuning, band change etc. He's recently switched to using a dual-core DSPIC and split the tasks. One core does the hardware control and the other the DSP. He still complains that the cpus are only 16 bit and that requires all sorts of maths tricks to avoid signal degradation. Quite a lot of original work and also looking back to the older dsp techniques for ideas - he's very clever to get so much out of that cpu.

So it begs the question: what could be achieved with a 200MHz 32 bit P2 with cordic engine and dsp instructions? The signal processing breaks down into a number of stages - maybe around six - for which the COGs would seem to be a natural fit, data being handshaked between the stages in a pipeline. Probably an external A/D would still be needed for receiver input because of very low noise requirement, but the P2s' internal converters could be used for mic input, speaker output and possibly transmit output (the latter then being mixed up to the required RF band by other circuitry). DSP sample rates might improve on the 16ksample/s that my pal achieved. 32bit arithmetic with 64 bit intermediate results would be much easier to manage. There might be enough processing time spare to do a spectrum display - always good for searching for signals.

Most of the DSP primitives would be assembly code for speed. Gluing the primitives together to make the complete radio - TAQOZ every time - forth is great for interactive prototyping. To provide stimuli and measure responses, the programming language LabView for Windows is fantastic and the Community edition is free for non-commercial use. It suits hardware engineers very well; like forth you get quick results. High speed serial link(s) could link P2 and PC during development to exercise the dsp in real-time. For a standalone radio, then there are plenty of small displays we know the propeller can drive and would make good front panels.

The latest SD radios use very high speed A/Ds to convert the whole of the short wave band to a digital stream which is then processed by a large fpga. Both these devices are power hogs, expensive and a dog to develop - the fpga tools are very slow. Thus this technique is not the best for portable narrowband equipment, but great for high speed data and the intelligence community!

If we stick to the lower speed sdr technique, the P2 is more simple to program than most cpus and well suited for battery operation, 2-3W at most. Not forgetting it would save quite a few other parts too.

I'm looking forward to see how much 'radio' can be squeezed into the P2 - I'm sure it's more than people think. Any other radio heads - have you been thinking about this too?

Cheers, Bob G4BBY

Comments

  • Have no idea, but sounds simple enough!

    This is AM modulation, sounds like, right?

    Wonder if you could generate the 3.7 MHz with the Prop2... Well, I'm sure you could, but maybe have to pick a special crystal frequency...

    ADC with 20 kHz bandwidth sounds like should work...

    But, googling, I found this right away:
    https://www.analog.com/media/en/training-seminars/design-handbooks/Software-Defined-Radio-for-Engineers-2018/SDR4Engineers.pdf

    It talks about this ADF7030 chip. Looks like it does everything for $5.
    Hard to beat that...

    Looks like you could control it over SPI with your P2 though...
  • Wait, that chip is at a different frequency, I think...
    Actually, Mouser doesn't seem to have anything that works at 3.7 MHz...
  • Actually, I remember something now from last time I toyed with looking at this...

    Can the RTL-SDR work for this?
    This one appears like it could: https://www.amazon.com/RTL-SDR-Blog-RTL2832U-Software-Defined/dp/B011HVUEME

    Would be a LOT easier, if it did...
  • For 80 m, looks like you have to do a hardware mod for it to work:
    https://www.rtl-sdr.com/rtl-sdr-direct-sampling-mode/
  • PropGuy2PropGuy2 Posts: 272
    edited 2020-07-09 - 18:55:58
    Actually I have been working on a HF / SSB radio design for the past year or so. I completely ran out of memory with the P1. And now ramping up with the P2 chip. It is surprising how difficult and expensive it is to design a SSB rig. The software time and component cost rise quickly. This especially true if you are planning on a medium to large production run, mostly to compete with the ICOM, Kenwood and Elecraft that start at $2000. $3000, $4000 Thousand dollars? The radio I am working on will have a price point of between $400 and $500 Dollars, using the P2 chip and traditional superheterodyne circuitry. To get there and to beat out the Chinese, it will be minimal, SSB & CW, 50 Watts out and easy to use (think Heath Kit and Knight Kit back in the day) Would anyone buy a radio like this or is this pipe drams for today's hams, beginner or not?
    1789 x 1135 - 519K
    2939 x 2286 - 1M
  • bob_g4bbybob_g4bby Posts: 30
    edited 2020-07-09 - 19:58:09
    You most probably wouldn't attempt direct RF generation with the P2, there'd be too many low level spurious signals. You'd use the P2 to generate a baseband signal that is up-converted with a low-noise RF oscillator to the required band. We know this works. Popular RF oscillators tunable by the P2 over a wide frequency range are the SI5131 (cheap) and earlier SI570 (a bit more money).

    My pal has developed code to receive and transmit AM, FM, single sideband, double sideband, CW and so on. That's 'just' down to the maths.

    I like the ACORN - the 50W output is a plus, many such radios are low power only. Great for portable. The chinese transceivers are difficult competitiion even if some of them have poor signal purity.

    I use a Multus Proficio, bought as semi-populated pcb together with a 7" chinese tablet - see www.qrz.com and type in my callsign G4BBY. It only delivers 6W, so I added a 100W amplifier kit.


  • The P2 ADC can sample 3.7MHz directly. I'll make no claims whether the sensitivity is good enough for radio reception. :wink: It works well for a 1Vpp video signal.

    The P2 should be able to generate a fairly clean RF signal directly.* The streamer has Goertel mode which was intended to output sine waves and observe the output. There is also the chroma modulator, which is a quadrature modulator. Both of these operate like a Direct Digital Synthesizer.

    *This assumes you don't use the P2 PLL. It's phase noise is not quite good enough. The P2 could use a 80-125MHz crystal oscillator to keep the phase noise under control. Unfortunately, the reduced clock rate will reduce ADC performance. But we can run 4 ADCs in parallel. There is a chance that the DAC is not up to serious RF usage.

    Goertzel mode has a slight annoyance for RF receiver usage: the sampling rate will be based on a whole number of cycles of the digital oscillator. So when changing tuning frequencies, the sample rate will change as well.
  • A lot of sdr 'application envelope exploration' to be done then! Hams are notoriously ingenious at repurposing chips for radio use. e.g. The Hermes-lite hf band sdr is based on a broadband modem chip, it makes a good performer too. The smartpin systems will have many people thinking hard.

    As regards P2 a/d for receiver input - it does need trying, not to dismiss it before that. I wonder whether the P2s' extensive power supply system and decoupling network helps tame noise levels enough?

    Running ADCs in parallel - my chinese oscilloscope does that to achieve higher performance at lower cost.

    Most multiband HF sdrs cover the range 2-30MHz. Some to 60MHz.

    I remember when PC based sdrs first appeared, that the mother-board sound chips were noticeably noisier than the high end sound cards from M-Audio and the like. Better than 16 bit, with the lowest s/n spec and highest dynamic range were the norm for best HF sdr, before high speed direct sampling took over.
  • Starred... this is an area I'm interested in myself, though primarily the ISM bands (I'm not licensed). There are a lot of transceiver chips like the CC1101 out there that can be used with the Prop for VHF/UHF, at least for digital stuff. I started a project a few months ago that uses one to sweep through a band and plot a crude waterfall based on the signal strength: http://forums.parallax.com/discussion/171460/p2-based-waterfall-display-for-ism-band-radios#latest
    Haven't done much with it lately...couldn't nail down the cause of the staircase effect on some signals.

    I'd love to see what can be done in HF though...every once in awhile I'll lurk on HF to see what parts of the world I can pick up here.
  • Maybe the P2 could interface to a Lime LMS8001+chip (100 kHz – 12 GHz)

    LMS8001 is a single chip up/down RF frequency shifter with continuous coverage up to 10 GHz.

    https://limemicro.com/technology/lms8001/

    Specs:https://limemicro.com/technology/

    It also has a companion board:

    LMS8001 Companion

    The LMS8001 Companion board provides a highly integrated, highly configurable, four-channel frequency shifter platform, utilising the LMS8001A integrated circuit.

    https://www.crowdsupply.com/lime-micro/limesdr-mini/updates/lms8001-companion-extends-coverage-to-10-ghz





  • bob_g4bbybob_g4bby Posts: 30
    edited 2020-07-19 - 22:48:37
    Just thinking where the P2 scores over the alternatives for sdr - there are so many cheap computing platforms about these days - why choose P2?:-

    1. Lower power for battery operation - run the cpu at the lowest clock speed the application needs. Avoid unnecessary activity within the chip
    2. Control of SPI devices such as RF oscillators, low noise A/D by SMARTPIN - no driver chip needed and reduces code size and retains full bus speed
    3. Measurement of V or I within radio requires no extra a/ds - for the transmitter o/p power meter
    4. Rotary user controls can be read - no extra parts and little software needed to read shaft encoders or analogue voltage thanks to SMARTPIN
    5. No external decoders for bandswitch selection needed - a massive 64 I/O pins to use!
    6. Saving radio settings - very good flash memory support
    7. Saving and playing signal recordings, station frequency lists, providing bespoke radio applications, upgrades, bug fixes - very good SD card support
    8. Microphone input - no external a/d needed
    9. Speaker output - no external d/a needed
    10. Choice of sample-by-sample or 2^n buffer by buffer dsp - no need for external RAM, internal 512kbyte hub ram means there is enough room for either
    11. Front panel display - no need for driver chips, good hardware / software support of many display types from 2 line LCD to hdmi
    12. P.C. link - USB / serial support from SMARTPIN to enable PC control, data transfer
    13. The above chip savings means a smaller pcb is required, so good for handheld devices
    14. Easy expansion - Two or more P2s can communicate over high speed serial link to share the radio processing or provide data decoding - SMARTPIN makes this trivial
    15. The cordic solver and other dsp related instructions bring fft and other time consuming dsp at audio bandwidths within reach on a low cost, low power platform
    16. Faster dsp - use of N multiple COGS linked in a signal 'pipeline' greatly reduces the time taken to process a signal buffer as compared with single core platforms like dspic33
  • PropGuy2PropGuy2 Posts: 272
    edited 2020-07-12 - 12:06:51
    bob_g4bby - This is exactly why I have been working (and waiting) for the P2 chip. I already have partnered with a super experienced RF engineer type. It is really a mixture of hardware and software, and a good processor. Noise in general , and phase stuff is always a problem. Bottom line is, that I may or may not use all the capabilities of the P2 chip. The reason being I want to make the coding as simple as possible, so other hams can modify the program to suit their needs. Sure there will be a robust operating system in place, but no tricky algorithms. I am planning on a 5 to 10 year run on the SSB / HF design I am working on. FYI -the reason I am NOT using DSP / SDR stuff is that these chips may or may not be in production in the long term. Tech advances and stuff goes End of Life - A problem I am having now with components made in China.
  • bob_g4bbybob_g4bby Posts: 30
    edited 2020-07-14 - 18:47:35
    Having read through the P2 forum a bit more about the internal a/ds, I stand by what I said about using an external stereo a/d for receiver input. An internal a/d will be far too noisy to encode incoming signals which range from microvolts to fractions of a volt, 0Hz to maybe as high as 192kHz. Here's a good paper that explains a bit about that http://gnarc.org/wp-content/uploads/2015/02/Software-Defined-Radio-SDR-for-Amateur-Radio-2015-02-11.pdf. An external a/d can be placed in a quiet area of groundplane located near the tayloe down-converter, heavily decoupled power, and away from the P2 environment.

    The P2 still reduces the parts count overall and promises some serious signal processing.
  • The Kahn method of generating single side band modulation is interesting because it allows the use of a Class E transmitter final stage (90% efficient) instead of a linear amplifier (50% efficient). This means no large, hot, heavy heatsink and 1/2 the power supply requirement. Lower cost fast switching transistors needed instead of RF linear types as well. Here's a paper on it

    The amplifier is driven by a frequency modulated signal and powered from an amplitude modulated source, which 'magically' combine to produce SSB. This forum is developing a small HF transceiver using that principle, albeit with a very poor choice of processor ;-)

    Why mention this in a P2 forum? The microphone input is passed through a hilbert transform to produce in-phase and quadrature signal streams. These are converted to polar format ( amplitude / phase ) : The amplitude signal then varies the power amplifier supply voltage. The phase signal is used to vary the frequency of an RF oscillator, most suitable are direct digital synthesis devices which are capable of glitch free, rapid frequency changes but it's possible things like SI5351 would do. So the P2 cartesian to polar instruction in the cordic solver would speed the signal path significantly and the PWM feature of a smartpin would be useful for the power supply drive signal. Makes yer fink, dunnit?
  • bob_g4bby wrote:
    The microphone input is passed through a hilbert transform to produce in-phase and quadrature signal streams.

    Actually, there's a method that works better than the Hilbert transform for producing quadrature signal components. I describe it here:

    https://forums.parallax.com/discussion/comment/1020855/#Comment_1020855

    It's based upon this paper by Clay S. Turner:

    https://www.iro.umontreal.ca/~mignotte/IFT3205/Documents/TipsAndTricks/AnEfficientAnalyticSignalGenerator.pdf

    -Phil
  • PropGuy2 wrote: »
    Actually I have been working on a HF / SSB radio design for the past year or so. I completely ran out of memory with the P1. And now ramping up with the P2 chip. It is surprising how difficult and expensive it is to design a SSB rig. The software time and component cost rise quickly. This especially true if you are planning on a medium to large production run, mostly to compete with the ICOM, Kenwood and Elecraft that start at $2000. $3000, $4000 Thousand dollars? The radio I am working on will have a price point of between $400 and $500 Dollars, using the P2 chip and traditional superheterodyne circuitry. To get there and to beat out the Chinese, it will be minimal, SSB & CW, 50 Watts out and easy to use (think Heath Kit and Knight Kit back in the day) Would anyone buy a radio like this or is this pipe drams for today's hams, beginner or not?

    I'd be a buyer. Sounds like a great project and involves two of my favorite things, radios and Propellers! Please keep us informed, I'd love to follow along.

  • Thanks for the up vote Jonathan - Right now I am wanting to become super familiar with the Smart Pin ADC & DAC functions. Likewise for a decent / clean / "beautiful" VGA tile driver. No one sees my exquisite PCB circuit, no one sees my agonizingly crafted SPIN2 code, everyone sees the enclosure and operators screen. If anyone finds a VGA driver or any SPIN2 code snippets for ADC /DAC/ SD / VGA / i2c / SPI, that actually work no matter what, pass them along.
  • Download Pnut

    http://forums.parallax.com/discussion/171196/pnut-spin2-latest-version-v34u-debugger-improved/p1

    It has

    ADC_to_VGA_millivolts.spin2

    VGA_1280x1024_text_160x85.spin2

    vga_text_demo.spin2

    Plus others
Sign In or Register to comment.