2017-02-01 05:33:31 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2016 by Jim McLaughlin KI6ZUM
|
|
|
|
|
* Copyright (C) 2016, 2017 by Andy Uribe CA6JAU
|
|
|
|
|
*
|
2017-02-03 02:08:59 +01:00
|
|
|
* Some of the code is based on work of Guus Van Dooren PE1PLM:
|
|
|
|
|
* https://github.com/ki6zum/gmsk-dstar/blob/master/firmware/dvmega/dvmega.ino
|
|
|
|
|
*
|
2017-02-01 05:33:31 +01:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#if !defined(ADF7021_H)
|
|
|
|
|
#define ADF7021_H
|
|
|
|
|
|
|
|
|
|
#include "Config.h"
|
|
|
|
|
|
2017-02-05 22:48:55 +01:00
|
|
|
#if defined(ENABLE_ADF7021)
|
2017-02-01 05:33:31 +01:00
|
|
|
|
2017-02-05 22:48:55 +01:00
|
|
|
/*
|
|
|
|
|
- Most of the registers values are obteined from ADI eval software:
|
|
|
|
|
http://www.analog.com/en/products/rf-microwave/integrated-transceivers-transmitters-receivers/low-power-rf-transceivers/adf7021.html
|
|
|
|
|
- or ADF7021 datasheet formulas:
|
|
|
|
|
www.analog.com/media/en/technical-documentation/data-sheets/ADF7021.pdf
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#define ADF7021_REG1_VHF 0x021F5041
|
|
|
|
|
#define ADF7021_REG1_UHF 0x00575041
|
|
|
|
|
|
|
|
|
|
/****** Support for 14.7456 MHz TCXO (modified RF7021SE boards) ******/
|
|
|
|
|
#if defined(ADF7021_14_7456)
|
|
|
|
|
|
|
|
|
|
// R = 4
|
|
|
|
|
#define ADF7021_PFD 3686400.0
|
|
|
|
|
|
|
|
|
|
// Deviation of modulator (REG 02)
|
|
|
|
|
#define ADF7021_DEV_DSTAR 42U
|
|
|
|
|
#define ADF7021_DEV_DMR 24U
|
|
|
|
|
#define ADF7021_DEV_YSF 32U
|
|
|
|
|
#define ADF7021_DEV_P25 22U
|
|
|
|
|
|
|
|
|
|
// TX/RX CLOCK register (REG 03)
|
|
|
|
|
#define ADF7021_REG3_DSTAR 0x2A4C4193
|
|
|
|
|
#define ADF7021_REG3_DMR 0x2A4C80D3
|
|
|
|
|
#define ADF7021_REG3_YSF 0x2A4C80D3
|
|
|
|
|
#define ADF7021_REG3_P25 0x2A4C80D3
|
|
|
|
|
|
|
|
|
|
// Discriminator bandwith, demodulator (REG 04)
|
|
|
|
|
// Bug in ADI evaluation software, use datasheet formula (4FSK)
|
|
|
|
|
#define ADF7021_DISC_BW_DSTAR 522U // K=85
|
|
|
|
|
#define ADF7021_DISC_BW_DMR 393U // K=32
|
|
|
|
|
#define ADF7021_DISC_BW_YSF 344U // K=28
|
|
|
|
|
#define ADF7021_DISC_BW_P25 393U // K=32
|
|
|
|
|
|
|
|
|
|
// Post demodulator bandwith (REG 04)
|
|
|
|
|
#define ADF7021_POST_BW_DSTAR 10U
|
|
|
|
|
#define ADF7021_POST_BW_DMR 65U
|
|
|
|
|
#define ADF7021_POST_BW_YSF 65U
|
|
|
|
|
#define ADF7021_POST_BW_P25 65U
|
|
|
|
|
|
|
|
|
|
// IF filter (REG 05)
|
|
|
|
|
#define ADF7021_REG5 0x000024F5
|
|
|
|
|
|
|
|
|
|
// IF CAL (fine cal, defaults) (REG 06)
|
|
|
|
|
#define ADF7021_REG6 0x05080B16
|
|
|
|
|
|
|
|
|
|
// AFC (off, defaults) (REG 10)
|
|
|
|
|
#define ADF7021_REG10 0x3296472A
|
|
|
|
|
|
|
|
|
|
// Slicer threshold for 4FSK demodulator (REG 13)
|
2017-02-06 01:23:00 +01:00
|
|
|
#define ADF7021_SLICER_TH_DSTAR 0U
|
2017-02-05 22:48:55 +01:00
|
|
|
#define ADF7021_SLICER_TH_DMR 51U
|
|
|
|
|
#define ADF7021_SLICER_TH_YSF 59U
|
|
|
|
|
#define ADF7021_SLICER_TH_P25 45U
|
|
|
|
|
|
|
|
|
|
/****** Support for 19.6800 MHz TCXO (original RF7021SE boards) ******/
|
|
|
|
|
#elif defined(ADF7021_19_6800)
|
|
|
|
|
|
|
|
|
|
// R = 4
|
|
|
|
|
#define ADF7021_PFD 4920000.0
|
|
|
|
|
|
|
|
|
|
// Deviation of modulator (REG 02)
|
|
|
|
|
#define ADF7021_DEV_DSTAR 32U
|
|
|
|
|
#define ADF7021_DEV_DMR 17U
|
|
|
|
|
#define ADF7021_DEV_YSF 24U
|
|
|
|
|
#define ADF7021_DEV_P25 16U
|
|
|
|
|
|
|
|
|
|
// TX/RX CLOCK register (REG 03)
|
|
|
|
|
#define ADF7021_REG3_DSTAR 0x2B1449E3
|
|
|
|
|
#define ADF7021_REG3_DMR 0x2B148123
|
|
|
|
|
#define ADF7021_REG3_YSF 0x2B148123
|
|
|
|
|
#define ADF7021_REG3_P25 0x2B148123
|
|
|
|
|
|
|
|
|
|
// Discriminator bandwith, demodulator (REG 04)
|
|
|
|
|
// Bug in ADI evaluation software, use datasheet formula (4FSK)
|
|
|
|
|
#define ADF7021_DISC_BW_DSTAR 583U // K=83
|
|
|
|
|
#define ADF7021_DISC_BW_DMR 397U // K=32
|
|
|
|
|
#define ADF7021_DISC_BW_YSF 347U // K=28
|
|
|
|
|
#define ADF7021_DISC_BW_P25 397U // K=32
|
|
|
|
|
|
|
|
|
|
// Post demodulator bandwith (REG 04)
|
2017-02-06 01:23:00 +01:00
|
|
|
#define ADF7021_POST_BW_DSTAR 9U
|
2017-02-05 22:48:55 +01:00
|
|
|
#define ADF7021_POST_BW_DMR 65U
|
|
|
|
|
#define ADF7021_POST_BW_YSF 65U
|
|
|
|
|
#define ADF7021_POST_BW_P25 65U
|
|
|
|
|
|
|
|
|
|
// IF filter (REG 05)
|
|
|
|
|
#define ADF7021_REG5 0x00003155
|
|
|
|
|
|
|
|
|
|
// IF CAL (coarse cal, defaults) (REG 06)
|
|
|
|
|
#define ADF7021_REG6 0x050972C6
|
|
|
|
|
|
|
|
|
|
// AFC (off, defaults) (REG 10)
|
|
|
|
|
#define ADF7021_REG10 0x3296354A
|
|
|
|
|
|
|
|
|
|
// Slicer threshold for 4FSK demodulator (REG 13)
|
2017-02-06 01:23:00 +01:00
|
|
|
#define ADF7021_SLICER_TH_DSTAR 0U
|
2017-02-05 22:48:55 +01:00
|
|
|
#define ADF7021_SLICER_TH_DMR 51U
|
|
|
|
|
#define ADF7021_SLICER_TH_YSF 59U
|
|
|
|
|
#define ADF7021_SLICER_TH_P25 45U
|
|
|
|
|
|
|
|
|
|
#endif
|
2017-02-01 05:33:31 +01:00
|
|
|
|
|
|
|
|
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
|
|
|
|
|
|
|
|
|
|
void Send_AD7021_control(void);
|
|
|
|
|
void Send_REG0_RX(void);
|
|
|
|
|
void Send_REG0_TX(void);
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|