Fix bug when setting Si4063 frequency. Remove unnecessary GPS debug and delays. Add Si4063 debug printout. Find a suitable frequency offset multiplier to achieve 270 Hz tone spacing for Horus 4FSK.

pull/60/head
Mikael Nousiainen 2023-09-14 10:19:13 +03:00
rodzic b646e81e25
commit 922e60814d
4 zmienionych plików z 16 dodań i 9 usunięć

Wyświetl plik

@ -146,16 +146,20 @@ static void si4603_set_shutdown(bool active)
static void si4063_set_state(uint8_t state)
{
log_info("Si4063: Set state %02x\n", state);
si4063_send_command(SI4063_COMMAND_CHANGE_STATE, 1, &state);
}
void si4063_enable_tx()
{
log_info("Si4063: Enable TX\n");
si4063_set_state(SI4063_STATE_TX);
log_info("Si4063: After enable TX\n");
}
void si4063_inhibit_tx()
{
log_info("Si4063: Inhibit TX\n");
si4063_set_state(SI4063_STATE_READY);
}
@ -180,6 +184,8 @@ void si4063_set_tx_frequency(const uint32_t frequency_hz)
uint32_t f_pfd, n, m;
float ratio, rest;
log_info("Si4063: Set frequency %lu\n", frequency_hz);
/* Set the output divider according to the recommended ranges in the si406x datasheet */
if (frequency_hz < 177000000UL) {
outdiv = 24;
@ -248,6 +254,8 @@ void si4063_set_tx_power(uint8_t power)
power & 0x7F // Power level from 00..7F
};
log_info("Si4063: Set TX power %02x\n", power);
si4063_send_command(SI4063_COMMAND_SET_PROPERTY, sizeof(data), data);
}
@ -275,6 +283,8 @@ void si4063_set_frequency_deviation(uint32_t deviation)
deviation & 0xFF
};
log_info("Si4063: Set freq deviation %lu\n", deviation);
si4063_send_command(SI4063_COMMAND_SET_PROPERTY, sizeof(data), data);
}
@ -289,6 +299,8 @@ void si4063_set_modulation_type(si4063_modulation_type type)
0x08 // 0x08 = Direct modulation source (MCU-controlled)
};
log_info("Si4063: Set modulation type %d\n", type);
switch (type) {
case SI4063_MODULATION_TYPE_CW:
// Pure carrier wave modulation (for modulating via frequency offset, e.g. for RTTY)

Wyświetl plik

@ -10,7 +10,7 @@
#define log_error printf
#define log_warn printf
#define log_info printf
#define log_debug printf
#define log_debug(...)
#define log_trace(...)
#else

Wyświetl plik

@ -177,12 +177,6 @@ int main(void)
radio_handle_main_loop();
//NVIC_SystemLPConfig(NVIC_LP_SEVONPEND, DISABLE);
//__WFI();
#ifdef DFM17
//DFM17 testing... delete next two lines eventually
log_info("Fix: %d, Time: %02d:%02d:%02d.\n", (int) current_gps_data.fix_ok, current_gps_data.hours, current_gps_data.minutes, current_gps_data.seconds);
delay_ms(1000);
#endif //DFM17
}
}

Wyświetl plik

@ -59,7 +59,7 @@ bool radio_start_transmit_si4063(radio_transmit_entry *entry, radio_module_state
return false;
}
si4063_set_tx_frequency(((float) entry->frequency) / 1000000.0f);
si4063_set_tx_frequency(entry->frequency);
si4063_set_tx_power(entry->tx_power);
si4063_set_frequency_offset(frequency_offset);
si4063_set_modulation_type(modulation_type);
@ -234,7 +234,8 @@ inline void radio_handle_data_timer_si4063()
break;
}
si4063_set_frequency_offset(tone_index + HORUS_FREQUENCY_OFFSET_SI4063);
// NOTE: The factor of 23 will produce a tone spacing of about 270 Hz, which is the standard spacing for Horus 4FSK
si4063_set_frequency_offset(tone_index * 23 + HORUS_FREQUENCY_OFFSET_SI4063);
radio_shared_state.radio_symbol_count_interrupt++;
break;