kopia lustrzana https://github.com/Qyon/STM32_RTTY
removed more functions without any effect, added possibility of change RTTY shift
rodzic
bde3d8e445
commit
3b0db73473
18
config.h
18
config.h
|
@ -33,16 +33,22 @@
|
||||||
#define APRS_COMMENT " Hello from the sky!"
|
#define APRS_COMMENT " Hello from the sky!"
|
||||||
#define RTTY_TO_APRS_RATIO 5 //transmit APRS packet with each x RTTY packet
|
#define RTTY_TO_APRS_RATIO 5 //transmit APRS packet with each x RTTY packet
|
||||||
|
|
||||||
//*************frequency********************
|
//*************TX Frequencies********************
|
||||||
#define RTTY_FREQUENCY 434.500f //Mhz middle frequency
|
#define RTTY_FREQUENCY 434.500f //Mhz middle frequency
|
||||||
#define APRS_FREQUENCY 432.500f //Mhz middle frequency
|
#define APRS_FREQUENCY 432.500f //Mhz middle frequency
|
||||||
//************rtty speed*********************** si4032
|
|
||||||
|
//************RTTY Shift*********************** si4032
|
||||||
|
#define RTTY_DEVIATION 0x2 // RTTY shift = RTTY_DEVIATION x 270Hz
|
||||||
|
|
||||||
|
//************RTTY Speed*********************** si4032
|
||||||
#define RTTY_SPEED 75 // RTTY baudrate
|
#define RTTY_SPEED 75 // RTTY baudrate
|
||||||
// SHIFT is always 450Hz
|
|
||||||
//************rtty bits************************ si4032
|
//************rtty bits************************ si4032
|
||||||
#define RTTY_7BIT 1 // if 0 --> 5 bits
|
#define RTTY_7BIT 1 // if 0 --> 5 bits
|
||||||
|
|
||||||
//************rtty stop bits******************* si4032
|
//************rtty stop bits******************* si4032
|
||||||
#define RTTY_USE_2_STOP_BITS 0
|
#define RTTY_USE_2_STOP_BITS 0
|
||||||
|
|
||||||
//********* power definition**************************
|
//********* power definition**************************
|
||||||
#define TX_POWER 0 // PWR 0...7 0- MIN ... 7 - MAX
|
#define TX_POWER 0 // PWR 0...7 0- MIN ... 7 - MAX
|
||||||
// 0 --> -1dBm
|
// 0 --> -1dBm
|
||||||
|
@ -54,9 +60,11 @@
|
||||||
// 6 --> 17dBm
|
// 6 --> 17dBm
|
||||||
// 7 --> 20dBm
|
// 7 --> 20dBm
|
||||||
//****************************************************
|
//****************************************************
|
||||||
// WARNING: do not use this in flying tracker!
|
|
||||||
|
// Switch sonde ON/OFF via Button
|
||||||
#define ALLOW_DISABLE_BY_BUTTON 1
|
#define ALLOW_DISABLE_BY_BUTTON 1
|
||||||
//********** frame delay in msec**********************
|
|
||||||
|
//********** Frame Delay in msec**********************
|
||||||
#define tx_delay 5000
|
#define tx_delay 5000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
28
main.c
28
main.c
|
@ -48,7 +48,6 @@ volatile uint8_t disable_armed = 0;
|
||||||
|
|
||||||
void send_rtty_packet();
|
void send_rtty_packet();
|
||||||
uint16_t gps_CRC16_checksum (char *string);
|
uint16_t gps_CRC16_checksum (char *string);
|
||||||
// int srednia (int dana);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,7 +82,7 @@ void TIM2_IRQHandler(void) {
|
||||||
radio_disable_tx();
|
radio_disable_tx();
|
||||||
}
|
}
|
||||||
} else if (send_rtty_status == rttyOne) {
|
} else if (send_rtty_status == rttyOne) {
|
||||||
radio_rw_register(0x73, 0x02, 1);
|
radio_rw_register(0x73, RTTY_DEVIATION, 1);
|
||||||
GPIO_SetBits(GPIOB, RED);
|
GPIO_SetBits(GPIOB, RED);
|
||||||
} else if (send_rtty_status == rttyZero) {
|
} else if (send_rtty_status == rttyZero) {
|
||||||
radio_rw_register(0x73, 0x00, 1);
|
radio_rw_register(0x73, 0x00, 1);
|
||||||
|
@ -143,25 +142,26 @@ int main(void) {
|
||||||
GPIO_SetBits(GPIOB, RED);
|
GPIO_SetBits(GPIOB, RED);
|
||||||
USART_SendData(USART3, 0xc);
|
USART_SendData(USART3, 0xc);
|
||||||
|
|
||||||
// radio_rw_register(0x02, 0xff, 0);
|
|
||||||
// radio_rw_register(0x03, 0xff, 0);
|
|
||||||
// radio_rw_register(0x04, 0xff, 0);
|
|
||||||
radio_soft_reset();
|
radio_soft_reset();
|
||||||
// setting TX frequency
|
// setting RTTY TX frequency
|
||||||
radio_set_tx_frequency(RTTY_FREQUENCY);
|
radio_set_tx_frequency(RTTY_FREQUENCY);
|
||||||
|
|
||||||
// setting TX power
|
// setting TX power
|
||||||
radio_rw_register(0x6D, 00 | (TX_POWER & 0x0007), 1);
|
radio_rw_register(0x6D, 00 | (TX_POWER & 0x0007), 1);
|
||||||
|
|
||||||
|
// initial RTTY modulation
|
||||||
radio_rw_register(0x71, 0x00, 1);
|
radio_rw_register(0x71, 0x00, 1);
|
||||||
// radio_rw_register(0x87, 0x08, 0);
|
|
||||||
// radio_rw_register(0x02, 0xff, 0);
|
// possibly without any effect...
|
||||||
// radio_rw_register(0x75, 0xff, 0);
|
// radio_rw_register(0x12, 0x20, 1);
|
||||||
// radio_rw_register(0x76, 0xff, 0);
|
|
||||||
// radio_rw_register(0x77, 0xff, 0);
|
// Temperature Value Offset
|
||||||
radio_rw_register(0x12, 0x20, 1);
|
|
||||||
radio_rw_register(0x13, 0x00, 1);
|
radio_rw_register(0x13, 0x00, 1);
|
||||||
|
|
||||||
|
// Temperature Sensor Calibration
|
||||||
radio_rw_register(0x12, 0x00, 1);
|
radio_rw_register(0x12, 0x00, 1);
|
||||||
|
|
||||||
|
// ADC configuration
|
||||||
radio_rw_register(0x0f, 0x80, 1);
|
radio_rw_register(0x0f, 0x80, 1);
|
||||||
rtty_buf = buf_rtty;
|
rtty_buf = buf_rtty;
|
||||||
tx_on = 0;
|
tx_on = 0;
|
||||||
|
@ -184,7 +184,6 @@ int main(void) {
|
||||||
ublox_get_last_data(&gpsData);
|
ublox_get_last_data(&gpsData);
|
||||||
USART_Cmd(USART1, DISABLE);
|
USART_Cmd(USART1, DISABLE);
|
||||||
int8_t temperature = radio_read_temperature();
|
int8_t temperature = radio_read_temperature();
|
||||||
// uint16_t voltage = (uint16_t) srednia(ADCVal[0] * 600 / 4096);
|
|
||||||
uint16_t voltage = (uint16_t) ADCVal[0] * 600 / 4096;
|
uint16_t voltage = (uint16_t) ADCVal[0] * 600 / 4096;
|
||||||
aprs_send_position(gpsData, temperature, voltage);
|
aprs_send_position(gpsData, temperature, voltage);
|
||||||
USART_Cmd(USART1, ENABLE);
|
USART_Cmd(USART1, ENABLE);
|
||||||
|
@ -202,7 +201,6 @@ void send_rtty_packet() {
|
||||||
start_bits = RTTY_PRE_START_BITS;
|
start_bits = RTTY_PRE_START_BITS;
|
||||||
int8_t si4032_temperature = radio_read_temperature();
|
int8_t si4032_temperature = radio_read_temperature();
|
||||||
|
|
||||||
// voltage = srednia(ADCVal[0] * 600 / 4096);
|
|
||||||
voltage = ADCVal[0] * 600 / 4096;
|
voltage = ADCVal[0] * 600 / 4096;
|
||||||
GPSEntry gpsData;
|
GPSEntry gpsData;
|
||||||
ublox_get_last_data(&gpsData);
|
ublox_get_last_data(&gpsData);
|
||||||
|
@ -223,7 +221,7 @@ void send_rtty_packet() {
|
||||||
(gpsData.alt_raw / 1000), si4032_temperature, voltage, gpsData.sats_raw,
|
(gpsData.alt_raw / 1000), si4032_temperature, voltage, gpsData.sats_raw,
|
||||||
gpsData.ok_packets, gpsData.bad_packets,
|
gpsData.ok_packets, gpsData.bad_packets,
|
||||||
flaga);
|
flaga);
|
||||||
CRC_rtty = 0xffff; //possibly not neccessary??
|
// CRC_rtty = 0xffff; //possibly not neccessary??
|
||||||
CRC_rtty = gps_CRC16_checksum(buf_rtty + 4);
|
CRC_rtty = gps_CRC16_checksum(buf_rtty + 4);
|
||||||
sprintf(buf_rtty, "%s*%04X\n", buf_rtty, CRC_rtty & 0xffff);
|
sprintf(buf_rtty, "%s*%04X\n", buf_rtty, CRC_rtty & 0xffff);
|
||||||
rtty_buf = buf_rtty;
|
rtty_buf = buf_rtty;
|
||||||
|
|
3
radio.c
3
radio.c
|
@ -26,9 +26,6 @@ void radio_set_tx_frequency(const float freq_in_mhz) {
|
||||||
uint8_t fb = (uint8_t) ((((uint8_t)((freq_in_mhz * (30.0f / SI4032_CLOCK)) / 10) - 24) - (24 * hbsel)) / (1 + hbsel));
|
uint8_t fb = (uint8_t) ((((uint8_t)((freq_in_mhz * (30.0f / SI4032_CLOCK)) / 10) - 24) - (24 * hbsel)) / (1 + hbsel));
|
||||||
uint8_t gen_div = 3; // constant - not possible to change!
|
uint8_t gen_div = 3; // constant - not possible to change!
|
||||||
uint16_t fc = (uint16_t) (((freq_in_mhz / ((SI4032_CLOCK / gen_div) * (hbsel + 1))) - fb - 24) * 64000);
|
uint16_t fc = (uint16_t) (((freq_in_mhz / ((SI4032_CLOCK / gen_div) * (hbsel + 1))) - fb - 24) * 64000);
|
||||||
|
|
||||||
radio_rw_register(0x72, 10, 1);
|
|
||||||
|
|
||||||
radio_rw_register(0x75, (uint8_t) (0b01000000 | (fb & 0b11111) | ((hbsel & 0b1) << 5)), 1);
|
radio_rw_register(0x75, (uint8_t) (0b01000000 | (fb & 0b11111) | ((hbsel & 0b1) << 5)), 1);
|
||||||
radio_rw_register(0x76, (uint8_t) (((uint16_t)fc >> 8) & 0xff), 1);
|
radio_rw_register(0x76, (uint8_t) (((uint16_t)fc >> 8) & 0xff), 1);
|
||||||
radio_rw_register(0x77, (uint8_t) ((uint16_t)fc & 0xff), 1);
|
radio_rw_register(0x77, (uint8_t) ((uint16_t)fc & 0xff), 1);
|
||||||
|
|
Ładowanie…
Reference in New Issue