sunnuntai, 17. toukokuu 2020

Inspecting SDRSharp.PanView.dll - peak hold mod

Spectrum analyzer peak hold modification
Visual Studio Community Edition 2019
dotPeek

Export SDRSharp.PanView.dll to VS project with dotPeek. Copy also SDRSharp.Radio.dll into same folder because PanView.dll uses it.
pv2.jpg

Modify code in SpectrumAnalyzer.cs

  public class SpectrumAnalyzer : UserControl
  {
        // ADD
    private int _performCounter = 0;
    ...

public SpectrumAnalyzer()
{
  ...
  this._graphics = Graphics.FromImage((Image) this._buffer);
  // ADD
 _buffer.MakeTransparent();
...

Add method (clear FFT from app using dll)
public void resetKeepFFT()
{
    _performCounter = 0;
}
 
private void DrawLayers()
{
       if (this._buffer.Width <= 30 || this._buffer.Height <= 30)
        return;
      // ADD
      if (_performCounter < 50) this._graphics.Clear(Color.Black);
      ...

private void Perform(bool force)
{
      ...
      this._performNeeded = false;
     // ADD
      _performCounter++;
}

pv1.jpg

https://i.ibb.co/TKNzwxx/pv1.jpg
 

keskiviikko, 13. toukokuu 2020

Inspecting SpectrumSpy software

SDR#
SpectrumSpy
dotPeek & Visual Studio 2019 Community Edition

Files required to reverse engineer SpectrumSpy with dotPeek
dotpeek1.jpg
dotpeek2.jpg
Export to VS project
dotpeek3.jpg
Some code error fixes required so that one can build project
MainForm.cs
    private class RenderingContext
    {
      private UnsafeBuffer _partialIQBuffer = UnsafeBuffer.Create(32768, sizeof (Complex));
=> private unsafe UnsafeBuffer _partialIQBuffer = UnsafeBuffer.Create(32768, sizeof (Complex));

private unsafe void ProcessFFT
...
        if (renderWaterfallLine)
          this.BeginInvoke((Delegate) (() => this.waterfall.Render(this._power, 8192)));
=>
        if (renderWaterfallLine)
          this.BeginInvoke((Delegate) (Action) (() => this.waterfall.Render(this._power, 8192)));

AssemblyInfo.cs
Add #pragma
#pragma warning disable CS0618 // Type or member is obsolete
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
#pragma warning restore CS0618 // Type or member is obsolete

maanantai, 27. huhtikuu 2020

SDRSharp (Telerik UI versions) FFT peek hold plug-in

C#, .NET 4.6, Visual Studio 2019 community edition
https://github.com/OH1GIU-P/SDRSharpFFTpTelerik

SDR# (r1717 and later versions, which use Telerik UI controls) FFTpPlugin plug-in screen scrapes SDR# FFT and shows it in a window and keeps peaks visible. Start button shows peak hold FFT window and stop button hides it. Tested with FFT settings:
fft-set.jpg

This version of the FFT peek hold plug-in is compiled with SDR# r1732 SDRSharp.Common, SDRSharp.Radio and SDRSharp.Panview dll's and button colors are tuned for better visibility in Telerik UI.

SDRSharp.FFTpPluginTelerik\SDRSharp.FFTpPlugin\bin\Release\SDRSharp.FFTpPluginE.dll

SDR# plugins.xml magic line:
<add key="FFTpPluginE" value="SDRSharp.FFTpPlugin.FFTpPlugin,SDRSharp.FFTpPluginE"/>

Use free tuning and set frequency tuning to the either side of the FFT for best results (as shown in images below)

fft-k1.jpg

fft-k2.jpg

 

 

maanantai, 20. huhtikuu 2020

CC1120 + Arduino + rc-switch

Hardware:
Arduino Uno
ccRF 3 click board  https://www.mikroe.com/ccrf-3-click

Unknown OOK device transmitting at 433.902 MHz.
undev433.jpg

IPEX to SMA antenna adapter
ipex.jpg


ASK/OOK
Transparent serial mode
https://github.com/OH1GIU-P/arduino-cc1120


#include <RCSwitch.h>
#include <SPI.h>
#include "cc1120.h"

/*
 CHANBW
 8 kHz      0x19
 10 kHz     0x14
 12.5 kHz   0x10
 15.38 kHz  0x0D
 18.18 kHz  0x0B
 20 kHz     0x0A
 25 kHz     0x08
 28.5 kHz   0x07
 33.3 kHz   0x06
 40 kHz     0x05
 50 kHz     0x04

 433.902 MHz
 FREQ2 0x6C
 FREQ1 0x79
 FREQ0 0x99
*/
 
RCSwitch rcs = RCSwitch();

#define LIMIT               3500
#define PRINT_INFO          1
//#define RCS                 1
#define RCS_RX              "Received "
#define RCS_SEP             " / "
#define RCS_UNKNOWN_ENC     "Unknown encoding"
#define RCS_BIT             "bit "
#define RCS_PROTOCOL        "Protocol: "

struct cc_status {
 uint8_t res : 4;
 uint8_t state : 3;
 uint8_t chip_ready : 1;
};
union cc_st {
  struct cc_status ccst;
  uint8_t v;
};

union cc_st ccstatus;

#ifdef RCS
#else
volatile uint32_t duration = 0;
volatile bool     chg      = false;
#endif

void setup() {
  Serial.begin(9600);
  pinMode(RESET_PIN, OUTPUT);
  pinMode(SS_PIN, OUTPUT);
  pinMode(GDO0_PIN, INPUT_PULLUP);
  digitalWrite(SS_PIN, HIGH);
  digitalWrite(RESET_PIN, HIGH);

  SPI.begin();

  strobeSPI(SNOP);
#ifdef PRINT_INFO  
  printStatus();
#endif

  uint8_t v;

  writeSPI(IOCFG0, SERIAL_RX);
  writeSPI(SYNC_CFG1, SMARTRF_SETTING_SYNC_CFG1);
  writeSPI(MODCFG_DEV_E, SMARTRF_SETTING_MODCFG_DEV_E);
  writeSPI(DCFILT_CFG, SMARTRF_SETTING_DCFILT_CFG);
  writeSPI(PREAMBLE_CFG1, SMARTRF_SETTING_PREAMBLE_CFG1);
  writeSPI(IQIC, SMARTRF_SETTING_IQIC);
  writeSPI(CHAN_BW, SMARTRF_SETTING_CHAN_BW);
  writeSPI(MDMCFG0, SMARTRF_SETTING_MDMCFG0);
  writeSPI(MDMCFG1, SMARTRF_SETTING_MDMCFG1);
  writeSPI(AGC_REF, SMARTRF_SETTING_AGC_REF);
  writeSPI(AGC_CS_THR, SMARTRF_SETTING_AGC_CS_THR);
  writeSPI(AGC_CFG1, SMARTRF_SETTING_AGC_CFG1);
  writeSPI(FIFO_CFG, SMARTRF_SETTING_FIFO_CFG);
  writeSPI(FS_CFG, SMARTRF_SETTING_FS_CFG);
  writeSPI(PKT_CFG0, SMARTRF_SETTING_PKT_CFG0);
  writeSPI(PKT_CFG1, SMARTRF_SETTING_PKT_CFG1);
  writeSPI(PKT_CFG2, SMARTRF_SETTING_PKT_CFG2);
  writeSPI(PA_CFG2, SMARTRF_SETTING_PA_CFG2);

  writeExtAddrSPI(IF_MIX_CFG, SMARTRF_SETTING_IF_MIX_CFG);
  writeExtAddrSPI(FREQOFF_CFG, SMARTRF_SETTING_FREQOFF_CFG);
  writeExtAddrSPI(FREQ2, SMARTRF_SETTING_FREQ2);
  writeExtAddrSPI(FREQ1, SMARTRF_SETTING_FREQ1);
  writeExtAddrSPI(FREQ0, SMARTRF_SETTING_FREQ0);
  writeExtAddrSPI(FS_DIG1, SMARTRF_SETTING_FS_DIG1);
  writeExtAddrSPI(FS_DIG0, SMARTRF_SETTING_FS_DIG0);
  writeExtAddrSPI(FS_CAL1, SMARTRF_SETTING_FS_CAL1);
  writeExtAddrSPI(FS_CAL0, SMARTRF_SETTING_FS_CAL0);
  writeExtAddrSPI(FS_DIVTWO, SMARTRF_SETTING_FS_DIVTWO);
  writeExtAddrSPI(FS_DSM0, SMARTRF_SETTING_FS_DSM0);
  writeExtAddrSPI(FS_DVC0, SMARTRF_SETTING_FS_DVC0);
  writeExtAddrSPI(FS_PFD, SMARTRF_SETTING_FS_PFD);
  writeExtAddrSPI(FS_PRE, SMARTRF_SETTING_FS_PRE);
  writeExtAddrSPI(FS_REG_DIV_CML, SMARTRF_SETTING_FS_REG_DIV_CML);
  writeExtAddrSPI(FS_SPARE, SMARTRF_SETTING_FS_SPARE);
  writeExtAddrSPI(FS_VCO0, SMARTRF_SETTING_FS_VCO0);
  writeExtAddrSPI(XOSC5, SMARTRF_SETTING_XOSC5);
  writeExtAddrSPI(XOSC1, SMARTRF_SETTING_XOSC1);
  writeExtAddrSPI(SERIAL_STATUS, SMARTRF_SETTING_SERIAL_STATUS);

#ifdef PRINT_INFO
  v = readExtAddrSPI(PARTVERSION);
  Serial.print(F("PARTVERSION "));
  Serial.println(v, HEX);
  v = readExtAddrSPI(PARTNUMBER);
  Serial.print(F("PARTNUMBER "));
  Serial.println(v, HEX);
#endif

  strobeSPI(SRX);
  delay(5);
  v = readExtAddrSPI(MARCSTATE);
  Serial.print(F("MARCSTATE "));
  Serial.println(v, BIN);

#ifdef RCS
  rcs.enableReceive(0);
#else
  attachInterrupt(digitalPinToInterrupt(GDO0_PIN), isr, CHANGE);
#endif
}

void loop() {
#ifdef RCS
  if (rcs.available()) {
    uint32_t v = rcs.getReceivedValue();
    if (v != 0) {
      Serial.print(F(RCS_RX));
      Serial.print(v);
      Serial.print(F(RCS_SEP));
      Serial.print(rcs.getReceivedBitlength());
      Serial.print(F(RCS_BIT));
      Serial.print(F(RCS_PROTOCOL));
      Serial.println(rcs.getReceivedProtocol());
    }
    else {
      Serial.print(F(RCS_UNKNOWN_ENC));
    }
    rcs.resetAvailable();
  }
#else
  if (chg) {
    chg = false;
    if (duration > LIMIT) {
      Serial.println(duration);
    }
  }
#endif
}

void printStatus() {
  Serial.println();
  Serial.print(F("Chip ready: "));
  Serial.println(ccstatus.ccst.chip_ready, HEX);
  Serial.print(F("State: "));
  Serial.println(ccstatus.ccst.state, HEX);
  Serial.println();  
}

#ifdef RCS
#else
void isr() {
  static uint32_t lastTi = 0;
 
  uint32_t ti = micros();
  duration = ti - lastTi;
  chg = true;
  lastTi = ti;
}
#endif

uint8_t readSPI(uint8_t addr) {
  digitalWrite(SS_PIN, LOW);
  ccstatus.v = SPI.transfer(R_BIT | addr);
  uint8_t v = SPI.transfer(0x00);
  digitalWrite(SS_PIN, HIGH);
  return v;
}

void writeSPI(uint8_t addr, uint8_t value) {
  digitalWrite(SS_PIN, LOW);
  ccstatus.v = SPI.transfer(addr);
  ccstatus.v = SPI.transfer(value);
  digitalWrite(SS_PIN, HIGH);
}

void strobeSPI(uint8_t cmd)
{
  digitalWrite(SS_PIN, LOW);
  ccstatus.v = SPI.transfer(R_BIT | cmd);
  digitalWrite(SS_PIN, HIGH);
}

uint8_t readExtAddrSPI(uint8_t addr) {
  uint8_t v;
  digitalWrite(SS_PIN, LOW);
  ccstatus.v = SPI.transfer(R_BIT | EXT_ADDR);
  SPI.transfer(addr);
  v = SPI.transfer(0xff);
  digitalWrite(SS_PIN, HIGH);
  return v;
}

void writeExtAddrSPI(uint8_t addr, uint8_t value) {
  digitalWrite(SS_PIN, LOW);
  ccstatus.v = SPI.transfer(EXT_ADDR);
  ccstatus.v = SPI.transfer(addr);
  ccstatus.v = SPI.transfer(value);
  digitalWrite(SS_PIN, HIGH);
}

/* Address Config = No address check */
/* Bit Rate = 1.2 */
/* Carrier Frequency = 433.902 */
/* Deviation = 3.997803 */
/* Device Address = 0 */
/* Manchester Enable = false */
/* Modulation Format = ASK/OOK */
/* PA Ramping = false */
/* Packet Bit Length = 0 */
/* Packet Length = 3 */
/* Packet Length Mode = Variable */
/* Performance Mode = High Performance */
/* RX Filter BW = 25.000000 */
/* Symbol rate = 1.2 */
/* TX Power = 12.5 */
/* Whitening = false */
/***************************************************************
 *  SmartRF Studio(tm) Export
 *
 *  Radio register settings specifed with C-code
 *  compatible #define statements.
 *
 *  RF device: CC1120
 *
 ***************************************************************/

#ifndef SMARTRF_CC1120_H
#define SMARTRF_CC1120_H

#define SMARTRF_RADIO_CC1120
//#define SMARTRF_SETTING_IOCFG3           0xB0
//#define SMARTRF_SETTING_IOCFG2           0x08
//#define SMARTRF_SETTING_IOCFG1           0xB0
#define SMARTRF_SETTING_IOCFG0           0x09
//#define SMARTRF_SETTING_SYNC3            0xAA
//#define SMARTRF_SETTING_SYNC2            0xAA
//#define SMARTRF_SETTING_SYNC1            0xAA
//#define SMARTRF_SETTING_SYNC0            0xAA
#define SMARTRF_SETTING_SYNC_CFG1        0x1F
#define SMARTRF_SETTING_MODCFG_DEV_E     0x1B
#define SMARTRF_SETTING_DCFILT_CFG       0x1C
#define SMARTRF_SETTING_PREAMBLE_CFG1    0x00
#define SMARTRF_SETTING_IQIC             0xC6
#define SMARTRF_SETTING_CHAN_BW          0x0A
#define SMARTRF_SETTING_MDMCFG1          0x06
#define SMARTRF_SETTING_MDMCFG0          0x4A
#define SMARTRF_SETTING_AGC_REF          0x20
#define SMARTRF_SETTING_AGC_CS_THR       0x19
#define SMARTRF_SETTING_AGC_CFG1         0x0A
#define SMARTRF_SETTING_FIFO_CFG         0x00
#define SMARTRF_SETTING_FS_CFG           0x14
#define SMARTRF_SETTING_PKT_CFG2         0x07
#define SMARTRF_SETTING_PKT_CFG1         0x00
#define SMARTRF_SETTING_PKT_CFG0         0x20
#define SMARTRF_SETTING_PA_CFG2          0x3C
#define SMARTRF_SETTING_IF_MIX_CFG       0x00
#define SMARTRF_SETTING_FREQOFF_CFG      0x23 // 0x22
#define SMARTRF_SETTING_FREQ2            0x6C
#define SMARTRF_SETTING_FREQ1            0x79  
#define SMARTRF_SETTING_FREQ0            0x99
#define SMARTRF_SETTING_FS_DIG1          0x00
#define SMARTRF_SETTING_FS_DIG0          0x5F
#define SMARTRF_SETTING_FS_CAL1          0x40
#define SMARTRF_SETTING_FS_CAL0          0x0E
#define SMARTRF_SETTING_FS_DIVTWO        0x03
#define SMARTRF_SETTING_FS_DSM0          0x33
#define SMARTRF_SETTING_FS_DVC0          0x17
#define SMARTRF_SETTING_FS_PFD           0x50
#define SMARTRF_SETTING_FS_PRE           0x6E
#define SMARTRF_SETTING_FS_REG_DIV_CML   0x14
#define SMARTRF_SETTING_FS_SPARE         0xAC
#define SMARTRF_SETTING_FS_VCO0          0xB4
#define SMARTRF_SETTING_XOSC5            0x0E
#define SMARTRF_SETTING_XOSC1            0x03
#define SMARTRF_SETTING_SERIAL_STATUS    0x08

// Pins
#define GDO0_PIN        2
#define RESET_PIN       7
#define SS_PIN          10

#define SERIAL_RX       0x09

#define R_BIT           0x80

// CC1120 registers
#define IOCFG3          0x00
#define IOCFG2          0x01
#define IOCFG1          0x02
#define IOCFG0          0x03
#define SYNC3           0x04
#define SYNC2           0x05
#define SYNC1           0x06
#define SYNC0           0x07
#define SYNC_CFG1       0x08
#define SYNC_CFG0       0x09
#define DEVIATION_M     0x0A
#define MODCFG_DEV_E    0x0B
#define DCFILT_CFG      0x0C
#define PREAMBLE_CFG1   0x0D
#define PREAMBLE_CFG0   0x0E
#define FREQ_IF_CFG     0x0F
#define IQIC            0x10
#define CHAN_BW         0x11
#define MDMCFG1         0x12
#define MDMCFG0         0x13
#define SYMBOL_RATE2    0x14
#define SYMBOL_RATE1    0x15
#define SYMBOL_RATE0    0x16
#define AGC_REF         0x17
#define AGC_CS_THR      0x18
#define AGC_GAIN_ADJUST 0x19
#define AGC_CFG3        0x1A
#define AGC_CFG2        0x1B
#define AGC_CFG1        0x1C
#define AGC_CFG0        0x1D
#define FIFO_CFG        0x1E
#define DEV_ADDR        0x1F
#define SETTLING_CFG    0x20
#define FS_CFG          0x21
#define WOR_CFG1        0x22
#define WOR_CFG0        0x23
#define WOR_EVENT0_MSB  0x24
#define WOR_EVENT0_LSB  0x25
#define PKT_CFG2        0x26
#define PKT_CFG1        0x27
#define PKT_CFG0        0x28
#define RFEND_CFG1      0x29
#define RFEND_CFG2      0x2A
#define PA_CFG2         0x2B
#define PA_CFG1         0x2C
#define PA_CFG0         0x2D
#define PKT_LEN         0x2E
#define EXT_ADDR        0x2F
#define FIFO            0x3F

// Extended register space
#define IF_MIX_CFG        0x00
#define FREQOFF_CFG       0x01
#define FREQ2             0x0C
#define FREQ1             0x0D
#define FREQ0             0x0E
#define FS_DIG1           0x12
#define FS_DIG0           0x13
#define FS_CAL1           0x16
#define FS_CAL0           0x17
#define FS_DIVTWO         0x19
#define FS_DSM0           0x1B
#define FS_DVC0           0x1D
#define FS_PFD            0x1F
#define FS_PRE            0x20
#define FS_REG_DIV_CML    0x21
#define FS_SPARE          0x22
#define FS_VCO0           0x27
#define XOSC5             0x32
#define XOSC1             0x36
#define RSSI1             0x71
#define RSSI0             0x72
#define MARCSTATE         0x73
#define PARTNUMBER        0x8F
#define PARTVERSION       0x90
#define SERIAL_STATUS     0x91
#define MODEM_STATUS1     0x92
#define MODEM_STATUS0     0x93
#define MARC_STATUS1      0x94
#define MARC_STATUS0      0x95
#define NUM_RXBYTES       0xD7
#define FIFO_NUM_RXBYTES  0xD9

// CC1120 command strobes
#define SRES            0x30
#define SFSTXON         0x31
#define SXOFF           0x32
#define SCAL            0x33
#define SRX             0x34
#define STX             0x35
#define SIDLE           0x36
#define SAFC            0x37
#define SWOR            0x38
#define SPWD            0x39
#define SFRX            0x3A
#define SFTX            0x3B
#define SWORRST         0x3C
#define SNOP            0x3D

#endif // CC1120_H

 

lauantai, 11. huhtikuu 2020

TI CC1120 & Arduino Uno - 3

scr1.jpg
RX

void setup() {
  Serial.begin(9600);
  pinMode(RESET_PIN, OUTPUT);
  pinMode(SS_PIN, OUTPUT);
  pinMode(GDO0_PIN, INPUT); // ccRF3 GDO0 pin
  digitalWrite(SS_PIN, HIGH);
  digitalWrite(RESET_PIN, HIGH);

  SPI.begin();

  strobeSPI(SNOP);  
  printStatus();

  // CRC off
  uint8_t v = readSPI(PKT_CFG1);
  bitClear(v, 2);
  bitClear(v, 3);
  writeSPI(PKT_CFG1, v);
  // SYNC off
  v = readSPI(SYNC_CFG0);
  bitClear(v, 2);
  bitClear(v, 3);
  bitClear(v, 4);
  writeSPI(SYNC_CFG0, v);

  writeSPI(IOCFG0, RXFIFO_THR_PKT); // ccRF3 GDO0 pin configured for #define RXFIFO_THR_PKT  0x01
  writeSPI(SYNC_CFG1, SMARTRF_SETTING_SYNC_CFG1);
  writeSPI(MODCFG_DEV_E, SMARTRF_SETTING_MODCFG_DEV_E);
  writeSPI(DCFILT_CFG, SMARTRF_SETTING_DCFILT_CFG);
  writeSPI(PREAMBLE_CFG1, SMARTRF_SETTING_PREAMBLE_CFG1);
  writeSPI(IQIC, SMARTRF_SETTING_IQIC);
  writeSPI(CHAN_BW, SMARTRF_SETTING_CHAN_BW);
  writeSPI(MDMCFG0, SMARTRF_SETTING_MDMCFG0);
  writeSPI(SYMBOL_RATE2, SMARTRF_SETTING_SYMBOL_RATE2);
  writeSPI(AGC_REF, SMARTRF_SETTING_AGC_REF);
  writeSPI(AGC_CS_THR, SMARTRF_SETTING_AGC_CS_THR);
  writeSPI(AGC_CFG1, SMARTRF_SETTING_AGC_CFG1);
  writeSPI(AGC_CFG0, SMARTRF_SETTING_AGC_CFG0);
  writeSPI(FIFO_CFG, SMARTRF_SETTING_FIFO_CFG);
  writeSPI(FS_CFG, SMARTRF_SETTING_FS_CFG);
  writeSPI(PKT_CFG0, SMARTRF_SETTING_PKT_CFG0);
  writeSPI(PA_CFG2, SMARTRF_SETTING_PA_CFG2);
  writeSPI(PA_CFG0, SMARTRF_SETTING_PA_CFG0);
  writeSPI(PKT_LEN, SMARTRF_SETTING_PKT_LEN);

  writeExtAddrSPI(IF_MIX_CFG, SMARTRF_SETTING_IF_MIX_CFG);
  writeExtAddrSPI(FREQOFF_CFG, SMARTRF_SETTING_FREQOFF_CFG);
  writeExtAddrSPI(FREQ2, SMARTRF_SETTING_FREQ2);
  writeExtAddrSPI(FREQ1, SMARTRF_SETTING_FREQ1);
  writeExtAddrSPI(FS_DIG1, SMARTRF_SETTING_FS_DIG1);
  writeExtAddrSPI(FS_DIG0, SMARTRF_SETTING_FS_DIG0);
  writeExtAddrSPI(FS_CAL1, SMARTRF_SETTING_FS_CAL1);
  writeExtAddrSPI(FS_CAL0, SMARTRF_SETTING_FS_CAL0);
  writeExtAddrSPI(FS_DIVTWO, SMARTRF_SETTING_FS_DIVTWO);
  writeExtAddrSPI(FS_DSM0, SMARTRF_SETTING_FS_DSM0);
  writeExtAddrSPI(FS_DVC0, SMARTRF_SETTING_FS_DVC0);
  writeExtAddrSPI(FS_PFD, SMARTRF_SETTING_FS_PFD);
  writeExtAddrSPI(FS_PRE, SMARTRF_SETTING_FS_PRE);
  writeExtAddrSPI(FS_REG_DIV_CML, SMARTRF_SETTING_FS_REG_DIV_CML);
  writeExtAddrSPI(FS_SPARE, SMARTRF_SETTING_FS_SPARE);
  writeExtAddrSPI(FS_VCO0, SMARTRF_SETTING_FS_VCO0);
  writeExtAddrSPI(XOSC5, SMARTRF_SETTING_XOSC5);
  writeExtAddrSPI(XOSC1, SMARTRF_SETTING_XOSC1);
 
  v = readSPI(CHAN_BW);
  Serial.print(F("CHAN_BW "));
  Serial.println(v, HEX);
  writeSPI(CHAN_BW, 0x18);
  v = readSPI(CHAN_BW);
  Serial.print(F("CHAN_BW "));
  Serial.println(v, HEX);
  v = readExtAddrSPI(PARTVERSION);
  Serial.print(F("PARTVERSION "));
  Serial.println(v, HEX);
  v = readExtAddrSPI(PARTNUMBER);
  Serial.print(F("PARTNUMBER "));
  Serial.println(v, HEX);

  v = readExtAddrSPI(FREQ1);
  Serial.print(F("FREQ1 "));
  Serial.println(v, HEX);
  writeExtAddrSPI(FREQ1, 0x16);
  v = readExtAddrSPI(FREQ1);
  Serial.print(F("FREQ1 "));
  Serial.println(v, HEX);

  strobeSPI(SRX);
  delay(5);
  v = readExtAddrSPI(MARCSTATE);
  Serial.print(F("MARCSTATE "));
  Serial.println(v, BIN);
}

ccRF3 GDO0 pin configured for #define RXFIFO_THR_PKT  0x01
5:0 GPIO0_CFG 0x3C R/W Output selection
Default: EXT_OSC_EN

uint8_t checkRX() {
  if (digitalRead(GDO0_PIN)) {
    while (digitalRead(GDO0_PIN));
    return 1;
  }
  else {
    return 0;
  }
}