diff options
Diffstat (limited to 'software')
-rw-r--r-- | software/rda1846dongle/Makefile | 20 | ||||
-rw-r--r-- | software/rda1846dongle/rda1846.c | 107 | ||||
-rw-r--r-- | software/rda1846dongle/rda1846.h | 3 | ||||
-rw-r--r-- | software/rda1846dongle/rda1846_defines.h | 14 | ||||
-rw-r--r-- | software/rda1846dongle/rda1846dongle.c | 8 |
5 files changed, 92 insertions, 60 deletions
diff --git a/software/rda1846dongle/Makefile b/software/rda1846dongle/Makefile index f9715c2..8f7dc3c 100644 --- a/software/rda1846dongle/Makefile +++ b/software/rda1846dongle/Makefile @@ -1,23 +1,31 @@ ## -## spreadspace teensy utils +## mur.sat ## +## Somewhen in the year 2012, mur.at will have a nano satellite launched +## into a low earth orbit (310 km above the surface of our planet). The +## satellite itself is a TubeSat personal satellite kit, developed and +## launched by interorbital systems. mur.sat is a joint venture of mur.at, +## ESC im Labor and realraum. ## -## Copyright (C) 2011 Christian Pointner <equinox@spreadspace.org> +## Please visit the project hompage at sat.mur.at for further information. +## ## -## This file is part of spreadspace teensy utils. +## Copyright (C) 2011 Christian Pointner <equinox@mur.at> +## +## This file is part of mur.sat. ## -## spreadspace teensy utils is free software: you can redistribute it and/or modify +## mur.sat 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 3 of the License, or ## any later version. ## -## spreadspace teensy utils is distributed in the hope that it will be useful, +## mur.sat 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 spreadspace teensy utils. If not, see <http://www.gnu.org/licenses/>. +## along with mur.sat. If not, see <http://www.gnu.org/licenses/>. ## NAME := rda1846dongle diff --git a/software/rda1846dongle/rda1846.c b/software/rda1846dongle/rda1846.c index fec9c05..eeb5ba1 100644 --- a/software/rda1846dongle/rda1846.c +++ b/software/rda1846dongle/rda1846.c @@ -1,24 +1,33 @@ /* - * spreadspace avr utils * + * mur.sat * - * Copyright (C) 2013 Christian Pointner <equinox@spreadspace.org> - * Othmar Gsenger <otti@wirdorange.org> + * Somewhen in the year 2012, mur.at will have a nano satellite launched + * into a low earth orbit (310 km above the surface of our planet). The + * satellite itself is a TubeSat personal satellite kit, developed and + * launched by interorbital systems. mur.sat is a joint venture of mur.at, + * ESC im Labor and realraum. * - * This file is part of spreadspace avr utils. + * Please visit the project hompage at sat.mur.at for further information. * - * spreadspace avr utils is free software: you can redistribute it and/or modify + * + * Copyright (C) 2013 Christian Pointner <equinox@mur.at> + * + * This file is part of mur.sat. + * + * mur.sat 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 3 of the License, or * any later version. * - * spreadspace avr utils is distributed in the hope that it will be useful, + * mur.sat 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 spreadspace avr utils. If not, see <http://www.gnu.org/licenses/>. + * along with mur.sat. If not, see <http://www.gnu.org/licenses/>. + * */ #include "LUFA/Drivers/Peripheral/TWI.h" @@ -109,15 +118,17 @@ static uint8_t rda1846_read_register(const uint8_t addr, uint16_t* data) } -void rda1846_soft_reset(void) -{ - rda1846_write_register(RDA1846_REG_CTL, RDA1846_CTL_SOFT_RST); -} void rda1846_init(void) { TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 200000)); - // switch to 2m Band (134 ~ 174 MHz) +} + +void rda1846_reg_init(void) +{ + rda1846_write_register(RDA1846_REG_CTL, RDA1846_CTL_SOFT_RST); + rda1846_write_register(RDA1846_REG_CTL, RDA1846_CTL_PDN); + rda1846_write_register(RDA1846_REG_RF_BAND, RDA1846_RF_BAND_2M); // rda1846_write_register(RDA1846_REG_RF_BAND, RDA1846_RF_BAND_70CM); @@ -126,11 +137,12 @@ void rda1846_init(void) rda1846_write_register(RDA1846_REG_ADCLK, RDA1846_ADCLK_FREQ); rda1846_write_register(RDA1846_REG_CLK_MODE, RDA1846_CLK_MODE); - rda1846_write_register(RDA1846_REG_CTL, RDA1846_CTL_CH_12K5 | RDA1846_CTL_RX_M_TX_M); +// rda1846_write_register(RDA1846_REG_CTL, RDA1846_CTL_CH_12K5 | RDA1846_CTL_RX_M_TX_M | RDA1846_CTL_PDN); + rda1846_write_register(RDA1846_REG_CTL, RDA1846_CTL_CH_25K | RDA1846_CTL_RX_M_TX_M | RDA1846_CTL_PDN); // rda1846_write_register(RDA1846_REG_TX_VOICE, RDA1846_TX_VOICE_NONE); -// rda1846_write_register(RDA1846_REG_TX_VOICE, RDA1846_TX_VOICE_MIC); - rda1846_write_register(RDA1846_REG_TX_VOICE, RDA1846_TX_VOICE_TONE2); + rda1846_write_register(RDA1846_REG_TX_VOICE, RDA1846_TX_VOICE_MIC); +// rda1846_write_register(RDA1846_REG_TX_VOICE, RDA1846_TX_VOICE_TONE2); // rda1846_write_register(RDA1846_REG_DTMF_CTL, RDA1846_DTMF_DUAL | RDA1846_DTMF_EN); // rda1846_write_register(RDA1846_REG_INT, RDA1846_INT_DTMF_IDLE); @@ -138,35 +150,9 @@ void rda1846_init(void) rda1846_gpio_default(); } -void rda1846_gpio_default(void) -{ - rda1846_write_register(RDA1846_REG_GPIO, RDA1846_GPIO_7_VOX | RDA1846_GPIO_6_SQ | - RDA1846_GPIO_5_TXON_RF | RDA1846_GPIO_4_RXON_RF | - RDA1846_GPIO_2_INT); -} - -void rda1846_gpio_AA(void) -{ - rda1846_write_register(RDA1846_REG_GPIO, RDA1846_GPIO_7_HIGH | RDA1846_GPIO_6_LOW | - RDA1846_GPIO_5_HIGH | RDA1846_GPIO_4_LOW | - RDA1846_GPIO_3_HIGH | RDA1846_GPIO_2_LOW | - RDA1846_GPIO_1_HIGH | RDA1846_GPIO_0_LOW); -} - -void rda1846_gpio_55(void) -{ - rda1846_write_register(RDA1846_REG_GPIO, RDA1846_GPIO_7_LOW | RDA1846_GPIO_6_HIGH | - RDA1846_GPIO_5_LOW | RDA1846_GPIO_4_HIGH | - RDA1846_GPIO_3_LOW | RDA1846_GPIO_2_HIGH | - RDA1846_GPIO_1_LOW | RDA1846_GPIO_0_HIGH); -} - -void rda1846_gpio_off(void) +void rda1846_soft_reset(void) { - rda1846_write_register(RDA1846_REG_GPIO, RDA1846_GPIO_7_HI_Z | RDA1846_GPIO_6_HI_Z | - RDA1846_GPIO_5_HI_Z | RDA1846_GPIO_4_HI_Z | - RDA1846_GPIO_3_HI_Z | RDA1846_GPIO_2_HI_Z | - RDA1846_GPIO_1_HI_Z | RDA1846_GPIO_0_HI_Z); + rda1846_write_register(RDA1846_REG_CTL, RDA1846_CTL_SOFT_RST); } void rda1846_powerdown(void) @@ -222,6 +208,39 @@ void rda1846_transmit(void) rda1846_write_register(RDA1846_REG_CTL, data); } + +void rda1846_gpio_default(void) +{ + rda1846_write_register(RDA1846_REG_GPIO, RDA1846_GPIO_7_VOX | RDA1846_GPIO_6_SQ | + RDA1846_GPIO_5_TXON_RF | RDA1846_GPIO_4_RXON_RF | + RDA1846_GPIO_2_INT); +} + +void rda1846_gpio_AA(void) +{ + rda1846_write_register(RDA1846_REG_GPIO, RDA1846_GPIO_7_HIGH | RDA1846_GPIO_6_LOW | + RDA1846_GPIO_5_HIGH | RDA1846_GPIO_4_LOW | + RDA1846_GPIO_3_HIGH | RDA1846_GPIO_2_LOW | + RDA1846_GPIO_1_HIGH | RDA1846_GPIO_0_LOW); +} + +void rda1846_gpio_55(void) +{ + rda1846_write_register(RDA1846_REG_GPIO, RDA1846_GPIO_7_LOW | RDA1846_GPIO_6_HIGH | + RDA1846_GPIO_5_LOW | RDA1846_GPIO_4_HIGH | + RDA1846_GPIO_3_LOW | RDA1846_GPIO_2_HIGH | + RDA1846_GPIO_1_LOW | RDA1846_GPIO_0_HIGH); +} + +void rda1846_gpio_off(void) +{ + rda1846_write_register(RDA1846_REG_GPIO, RDA1846_GPIO_7_HI_Z | RDA1846_GPIO_6_HI_Z | + RDA1846_GPIO_5_HI_Z | RDA1846_GPIO_4_HI_Z | + RDA1846_GPIO_3_HI_Z | RDA1846_GPIO_2_HI_Z | + RDA1846_GPIO_1_HI_Z | RDA1846_GPIO_0_HI_Z); +} + + int16_t rda1846_get_rssi(void) { uint16_t data; @@ -289,7 +308,7 @@ uint8_t rda1846_set_freq_kHz(int32_t freq) /* return 1; */ freq = freq<<3; - uint8_t ret = rda1846_write_register(RDA1846_REG_FREQH, ((freq>>16) & 0x0000FFFF)); + uint8_t ret = rda1846_write_register(RDA1846_REG_FREQH, ((freq>>16) & 0x00003FFF)); if(ret) return 1; diff --git a/software/rda1846dongle/rda1846.h b/software/rda1846dongle/rda1846.h index c1db4a1..12b2c5a 100644 --- a/software/rda1846dongle/rda1846.h +++ b/software/rda1846dongle/rda1846.h @@ -33,9 +33,10 @@ #ifndef MURSAT_rda1846_h_INCLUDED #define MURSAT_rda1846_h_INCLUDED -void rda1846_soft_reset(void); void rda1846_init(void); +void rda1846_reg_init(void); +void rda1846_soft_reset(void); void rda1846_powerdown(void); void rda1846_wakeup(void); diff --git a/software/rda1846dongle/rda1846_defines.h b/software/rda1846dongle/rda1846_defines.h index a6281dd..bfcc5e8 100644 --- a/software/rda1846dongle/rda1846_defines.h +++ b/software/rda1846dongle/rda1846_defines.h @@ -77,11 +77,11 @@ // init values -#define RDA1846_RF_BAND_2M 0x00C0 // select 2m Band -#define RDA1846_RF_BAND_70CM 0x0000 // select 70cm Band +#define RDA1846_RF_BAND_2M 0x00E4 // select 2m Band +#define RDA1846_RF_BAND_70CM 0x0024 // select 70cm Band #define RDA1846_XTAL_FREQ 12288 // 12.288 MHz #define RDA1846_ADCLK_FREQ 6144 // 12.288/2 MHz -#define RDA1846_CLK_MODE (1<<0) // 12-14 MHz +#define RDA1846_CLK_MODE 0x0F11 // 12-14 MHz // ctl @@ -170,10 +170,10 @@ // tx voice channel -#define RDA1846_TX_VOICE_MIC 0x0000 -#define RDA1846_TX_VOICE_TONE2 0x4000 -#define RDA1846_TX_VOICE_GPIO1 0x8000 -#define RDA1846_TX_VOICE_NONE 0xC000 +#define RDA1846_TX_VOICE_MIC 0x0958 +#define RDA1846_TX_VOICE_TONE2 0x4958 +#define RDA1846_TX_VOICE_GPIO1 0x8958 +#define RDA1846_TX_VOICE_NONE 0xC958 // DTMF ctl diff --git a/software/rda1846dongle/rda1846dongle.c b/software/rda1846dongle/rda1846dongle.c index 757356d..310e2ad 100644 --- a/software/rda1846dongle/rda1846dongle.c +++ b/software/rda1846dongle/rda1846dongle.c @@ -29,6 +29,7 @@ * along with mur.sat. If not, see <http://www.gnu.org/licenses/>. * */ + #include <avr/io.h> #include <avr/wdt.h> #include <avr/interrupt.h> @@ -129,7 +130,7 @@ static void handle_cmd(uint8_t cmd) case '!': reset2bootloader(); break; case 'r': rda1846_soft_reset(); printf("soft resetting RDA1846.\r\n"); break; - case 'i': rda1846_init(); printf("initializing RDA1846.\r\n"); break; + case 'i': rda1846_reg_init(); printf("initializing RDA1846.\r\n"); break; case 'F': set_default_freq(); break; case 'g': rda1846_gpio_off(); printf("GPIO off\r\n"); break; @@ -139,6 +140,7 @@ static void handle_cmd(uint8_t cmd) case 's': print_status(); break; case 'd': print_dtmf(); break; case 'D': rda1846_dump_register(); break; + case 'p': rda1846_powerdown(); break; case 'P': rda1846_wakeup(); break; @@ -160,8 +162,10 @@ int main(void) cpu_init(); led_init(); usbio_init(); - sei(); + rda1846_init(); + + sei(); for(;;) { int16_t BytesReceived = usbio_bytes_received(); while(BytesReceived > 0) { |