kopia lustrzana https://github.com/sq2ips/m20-custom-firmware
Multiple frequency support.
rodzic
334dcbe4a7
commit
31bd3d53b4
|
@ -161,10 +161,10 @@ Before building the firmware you fist need to configure parameters located in th
|
|||
Parameters list:
|
||||
| parameter | type (and unit) | description |
|
||||
|-----------|------|-------------|
|
||||
| `QRG_FSK4` | float[] (in Hz) | Transmitted frequencies array, switched in a loop, add new frequencies after a comma in braces. |
|
||||
| `PAYLOAD_ID` | uint16 | Payload ID transmitted in Horus Binary frame, in order to conduct a flight you need to request one for your callsign, more information in the [Protocol documentation](https://github.com/projecthorus/horusdemodlib/wiki#how-do-i-transmit-it). For testing ID 256 is used |
|
||||
| `TIME_PERIOD` | uint (in seconds) | Time between transmition of frames. Should not be lower than 4. |
|
||||
| `GPS_TYPE` | uint | Type of GPS module, eather 1 for u-blox MAX-M10M, 2 for XM1110 module. For identifying the module see [GPS](#gps) section. |
|
||||
| `QRG_FSK4` | uint (in Hz) | Frequency of 4FSK Horus transmition. |
|
||||
| `PA_FSK4` | uint | Number from 0 to 63. See the table bellow. |
|
||||
| `RF_BOOST_ACTIVE` | bool | State of RF TX boost, amplifies signal by around 15dB. (In off state the boost cricut is attenuating the signal, when less output power is needed it's better to decrease `PA_FSK4` than turning it off.) |
|
||||
| `ADF_FREQ_CORRECTION` | uint (multiples of 244Hz) | Frequency correction for transmitted signal |
|
||||
|
@ -279,7 +279,7 @@ It will need some time to download an install the packages, after it finishes ru
|
|||
```bash
|
||||
docker run --rm -v .:/opt/m20 m20:latest
|
||||
```
|
||||
It will build the code and after finishing you should see a memory usage table, the compiled binaries should be in the `build/` directory.
|
||||
It will build the code and after finishing you should see a memory usage table, the compiled binaries should be in the `build/` directory.
|
||||
|
||||
# Flashing the firmware
|
||||
## Connecting
|
||||
|
|
|
@ -3,23 +3,25 @@
|
|||
#ifndef INC_CONFIG_H_
|
||||
#define INC_CONFIG_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
/*-----------------------------------------------------------------*/
|
||||
// Sonde configuration, parameters that should be changed
|
||||
|
||||
const static float QRG_FSK4[] = {435100000}; // Transmitted frequencies array, switched in a loop, add new frequencies (in Hz) after a comma in braces.
|
||||
|
||||
#define PAYLOAD_ID 256 // Sonde payload ID 256 - for 4FSKTEST-V2
|
||||
|
||||
#define TIME_PERIOD 6 // Time betwen starts of transmissions (in seconds) (must be more than 3)
|
||||
|
||||
#define GPS_TYPE 1 // Type of GPS module: 1 - u-blox | 2 - XM1110
|
||||
|
||||
#define QRG_FSK4 435100000 // Frequency fo horus modulation (in Hz)
|
||||
|
||||
#define PA_FSK4 10 // RF power setting for horus transmission values 0-63
|
||||
#define RF_BOOST_ACTIVE 1 // RF booster enabled for transmissions about 15dB gain, but more power consumed - normally should be ON(1).
|
||||
|
||||
#define ADF_FREQ_CORRECTION 19 // correction of frequency from crystal inaccuracy in 270Hz steps. To be individually set for each sonde.
|
||||
#define ADF_FREQ_CORRECTION 19 // correction of frequency from crystal inaccuracy in 244Hz steps. To be individually set for each sonde.
|
||||
|
||||
#define LED_MODE 2 // 0 - disabled, 1 - flashes when prepairing tx data before transmit, 2 - GPS fix indication
|
||||
#define LED_PERIOD 5 // time between LED lighting
|
||||
|
|
|
@ -313,8 +313,8 @@ void adf_setup(void) {
|
|||
adf_reset_config();
|
||||
adf_set_r_divider(
|
||||
1); // We will be using whole 9(or 8)MHz for freq reference for adf7012
|
||||
adf_set_frequency(QRG_FSK4); // Temporarily set freq for CW - it is going to
|
||||
// be changed later when turning on TX
|
||||
adf_set_frequency(QRG_FSK4[0]); // Temporarily set freq for CW - it is going
|
||||
// to be changed later when turning on TX
|
||||
adf_set_pll_enable(ADF_ON);
|
||||
adf_write_config();
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ static uint16_t current_2_bit = 0;
|
|||
static bool FSK_Active = false;
|
||||
static char *buffer;
|
||||
static uint8_t buffer_len;
|
||||
static uint8_t QRGCounter = 0;
|
||||
|
||||
void FSK4_stop_TX() {
|
||||
TIM2->DIER &= ~(TIM_DIER_UIE); /* Disable the interrupt */
|
||||
|
@ -85,7 +86,9 @@ void FSK4_start_TX(char *buff, uint8_t len) {
|
|||
buffer_len = len;
|
||||
// adf_setup();
|
||||
current_2_bit = 0; // reset counter of current position of bit address
|
||||
adf_RF_on(QRG_FSK4, PA_FSK4); // turn on radio TX
|
||||
adf_RF_on(QRG_FSK4[QRGCounter++], PA_FSK4); // turn on radio TX
|
||||
if (QRGCounter >= sizeof(QRG_FSK4) / sizeof(QRG_FSK4[0]))
|
||||
QRGCounter = 0;
|
||||
FSK_Active = true; // change status
|
||||
TIM2->CR1 &= (uint16_t)(~((uint16_t)TIM_CR1_CEN)); // Disable the TIM Counter
|
||||
uint16_t timer2StartValue =
|
||||
|
@ -93,8 +96,8 @@ void FSK4_start_TX(char *buff, uint8_t len) {
|
|||
1; // timer value calculated according to baud rate 999 for 100bd
|
||||
TIM2->ARR = timer2StartValue; // set timer counter max value to pre-set value
|
||||
// for baudrate (auto-reload register)
|
||||
TIM2->CR1 |= TIM_CR1_CEN; // enable timer again
|
||||
TIM2->DIER |= TIM_DIER_UIE; // Enable the interrupt
|
||||
FSK4_timer_handler(); // force execution of procedure responsible for
|
||||
// interrupt handling
|
||||
TIM2->CR1 |= TIM_CR1_CEN; // enable timer again
|
||||
TIM2->DIER |= TIM_DIER_UIE; // Enable the interrupt
|
||||
FSK4_timer_handler(); // force execution of procedure responsible for
|
||||
// interrupt handling
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue