summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--software/rda1846dongle/rda1846.c8
-rw-r--r--software/rda1846dongle/rda1846_defines.h62
-rw-r--r--software/rda1846dongle/rda1846dongle.c2
3 files changed, 54 insertions, 18 deletions
diff --git a/software/rda1846dongle/rda1846.c b/software/rda1846dongle/rda1846.c
index 921296c..695f0e7 100644
--- a/software/rda1846dongle/rda1846.c
+++ b/software/rda1846dongle/rda1846.c
@@ -34,6 +34,8 @@
#include <stdio.h>
#include "rda1846.h"
+//#define QUARTZ_12M288
+#define QUARTZ_13M
#include "rda1846_defines.h"
static uint8_t rda1846_write_register_raw(const uint8_t addr, const uint16_t data)
@@ -184,6 +186,10 @@ void rda1846_reg_init(void)
// rda1846_write_register(RDA1846_REG_TX_VOICE, RDA1846_TX_VOICE_TONE2);
// rda1846_write_register(RDA1846_REG_DTMF_T2, 6689);
+ rda1846_write_register(RDA1846_REG_DTMF_C01, (RDA1846_DTMF_C0 << 8) | RDA1846_DTMF_C1);
+ rda1846_write_register(RDA1846_REG_DTMF_C23, (RDA1846_DTMF_C1 << 8) | RDA1846_DTMF_C3);
+ rda1846_write_register(RDA1846_REG_DTMF_C45, (RDA1846_DTMF_C3 << 8) | RDA1846_DTMF_C5);
+ rda1846_write_register(RDA1846_REG_DTMF_C67, (RDA1846_DTMF_C6 << 8) | RDA1846_DTMF_C7);
rda1846_write_register(RDA1846_REG_DTMF_CTL, RDA1846_DTMF_DUAL | RDA1846_DTMF_EN);
rda1846_write_register(RDA1846_REG_INT, RDA1846_INT_DTMF_IDLE);
@@ -352,7 +358,7 @@ void rda1846_set_volume(int8_t vol)
uint16_t data;
if(vol < -30 || vol > 0)
return;
-
+
if(vol >= -15)
data = 0x000F | (((vol + 15)<<4) & 0xF0);
else
diff --git a/software/rda1846dongle/rda1846_defines.h b/software/rda1846dongle/rda1846_defines.h
index 6b9c29a..379ce3b 100644
--- a/software/rda1846dongle/rda1846_defines.h
+++ b/software/rda1846dongle/rda1846_defines.h
@@ -76,7 +76,13 @@
#define RDA1846_REG_DTMF_OUT 0x6C
//freq
+#ifdef QUARTZ_12M288
#define RDA1846_FREQ_CORR_2M 73.1428567759
+#endif // QUARTZ_12M288
+#ifdef QUARTZ_13M
+#define RDA1846_FREQ_CORR_2M 69.136878448
+#endif // QUARTZ_13M
+
#define RDA1846_FREQ_CORR_1M5 RDA1846_FREQ_CORR_2M/1.5
#define RDA1846_FREQ_CORR_70CM RDA1846_FREQ_CORR_2M/3.0
@@ -94,30 +100,40 @@
#define RDA1846_BAND_70CM_LOW 400000 // kHz
#define RDA1846_BAND_70CM_HIGH 520000 // kHZ
+#ifdef QUARTZ_12M288
#define RDA1846_XTAL_FREQ 12288 // 12.288 MHz
#define RDA1846_ADCLK_FREQ 6144 // 12.288/2 MHz
#define RDA1846_CLK_MODE 0x0F11 // 12-14 MHz
+#endif // QUARTZ_12M288
+
+#ifdef QUARTZ_13M
+#define RDA1846_XTAL_FREQ 13000 // 13.000 MHz
+#define RDA1846_ADCLK_FREQ 6500 // 13.000/2 MHz
+#define RDA1846_CLK_MODE 0x0F11 // 12-14 MHz
+#endif // QUARTZ_13M
+
+
// ctl
-#define RDA1846_CTL_CH_25K 0x3000
-#define RDA1846_CTL_CH_12K5 0x0000
-#define RDA1846_CTL_CH_RESET 0xCFFF
+#define RDA1846_CTL_CH_25K 0x3000
+#define RDA1846_CTL_CH_12K5 0x0000
+#define RDA1846_CTL_CH_RESET 0xCFFF
-#define RDA1846_CTL_TAIL_ELIM 0x0800
+#define RDA1846_CTL_TAIL_ELIM 0x0800
-#define RDA1846_CTL_RX_A_TX_A 0x0200
-#define RDA1846_CTL_RX_A_TX_M 0x0100
-#define RDA1846_CTL_RX_M_TX_M 0x0000
+#define RDA1846_CTL_RX_A_TX_A 0x0200
+#define RDA1846_CTL_RX_A_TX_M 0x0100
+#define RDA1846_CTL_RX_M_TX_M 0x0000
-#define RDA1846_CTL_MUTE 0x0080
-#define RDA1846_CTL_TX 0x0040
-#define RDA1846_CTL_RX 0x0020
-#define RDA1846_CTL_VOX 0x0010
-#define RDA1846_CTL_SQ 0x0008
-#define RDA1846_CTL_PDN 0x0004
-#define RDA1846_CTL_CHIP_CAL 0x0002
-#define RDA1846_CTL_SOFT_RST 0x0001
+#define RDA1846_CTL_MUTE 0x0080
+#define RDA1846_CTL_TX 0x0040
+#define RDA1846_CTL_RX 0x0020
+#define RDA1846_CTL_VOX 0x0010
+#define RDA1846_CTL_SQ 0x0008
+#define RDA1846_CTL_PDN 0x0004
+#define RDA1846_CTL_CHIP_CAL 0x0002
+#define RDA1846_CTL_SOFT_RST 0x0001
// flag
@@ -205,7 +221,8 @@
#define dtmf_tone_freq_hz(value) (uint16_t)round(value/4.096)
#define dtmf_tone_freq_value(hz) (uint16_t)round(hz*4.096)
-// DTMF frequencies @ 12.288 MHz - these are the defaults...
+#ifdef QUARTZ_12M288
+// DTMF frequencies @ 12.288 MHz - these are the defaults... are they?
#define RDA1846_DTMF_C0 0x61 // 697 Hz
#define RDA1846_DTMF_C1 0x5B // 770 Hz
#define RDA1846_DTMF_C2 0x53 // 852 Hz
@@ -214,5 +231,18 @@
#define RDA1846_DTMF_C5 0x1E // 1336 Hz
#define RDA1846_DTMF_C6 0x0A // 1477 Hz
#define RDA1846_DTMF_C7 0xF6 // 1633 Hz
+#endif // QUARTZ_12M8
+
+#ifdef QUARTZ_13M
+// DTMF frequencies @ 13 MHz - these are the defaults...
+#define RDA1846_DTMF_C0 0x61 // 697 Hz
+#define RDA1846_DTMF_C1 0x5E // 770 Hz
+#define RDA1846_DTMF_C2 0x57 // 852 Hz
+#define RDA1846_DTMF_C3 0x4B // 941 Hz
+#define RDA1846_DTMF_C4 0x31 // 1209 Hz
+#define RDA1846_DTMF_C5 0x1E // 1336 Hz
+#define RDA1846_DTMF_C6 0x0F // 1477 Hz
+#define RDA1846_DTMF_C7 0xFB // 1633 Hz
+#endif // QUARTZ_13M
#endif
diff --git a/software/rda1846dongle/rda1846dongle.c b/software/rda1846dongle/rda1846dongle.c
index e0297a7..7bb0912 100644
--- a/software/rda1846dongle/rda1846dongle.c
+++ b/software/rda1846dongle/rda1846dongle.c
@@ -43,7 +43,7 @@
#include "rda1846.h"
#include "rda1846_defines.h"
-#define DEFAULT_FREQ_2M 145000
+#define DEFAULT_FREQ_2M 145900
#define DEFAULT_FREQ_1M5 230000
#define DEFAULT_FREQ_70CM 435000
int32_t default_freq = DEFAULT_FREQ_2M;