Skip to content

Commit

Permalink
Enable oversampling for all demodulators.
Browse files Browse the repository at this point in the history
  • Loading branch information
mobilinkd committed Jun 23, 2021
1 parent 7039d19 commit 0da7939
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions TNC/Fsk9600Demodulator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct Fsk9600Demodulator : IDemodulator
static_assert(audio::ADC_BUFFER_SIZE >= ADC_BLOCK_SIZE);

static constexpr uint32_t SAMPLE_RATE = 192000;
static constexpr uint16_t VREF = 4095;
static constexpr uint16_t VREF = 16383;

using bpf_coeffs_type = std::array<int16_t, FILTER_TAP_NUM>;
using bpf_bank_type = std::array<bpf_coeffs_type, 13>;
Expand Down Expand Up @@ -61,7 +61,7 @@ struct Fsk9600Demodulator : IDemodulator
demod_filter.init(bpf);
passall(kiss::settings().options & KISS_OPTION_PASSALL);

hadc1.Init.OversamplingMode = DISABLE;
hadc1.Init.OversamplingMode = ENABLE;
if (HAL_ADC_Init(&hadc1) != HAL_OK)
{
CxxErrorHandler();
Expand All @@ -72,7 +72,7 @@ struct Fsk9600Demodulator : IDemodulator
sConfig.Channel = AUDIO_IN;
sConfig.Rank = ADC_REGULAR_RANK_1;
sConfig.SingleDiff = ADC_SINGLE_ENDED;
sConfig.SamplingTime = ADC_SAMPLETIME_247CYCLES_5;
sConfig.SamplingTime = ADC_SAMPLETIME_6CYCLES_5;
sConfig.OffsetNumber = ADC_OFFSET_NONE;
sConfig.Offset = 0;
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
Expand Down
2 changes: 1 addition & 1 deletion TNC/Fsk9600Modulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void Fsk9600Modulator::init(const kiss::Hardware& hw)

SysClock72();

// Configure 80MHz clock for 192ksps.
// Configure 72MHz clock for 192ksps.
htim7.Init.Period = 374;
if (HAL_TIM_Base_Init(&htim7) != HAL_OK)
{
Expand Down
10 changes: 5 additions & 5 deletions TNC/M17Demodulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ void M17Demodulator::start()
polarity = kiss::settings().rx_rev_polarity() ? -1 : 1;
audio::virtual_ground = (VREF + 1) / 2;

// hadc1.Init.OversamplingMode = DISABLE;
// if (HAL_ADC_Init(&hadc1) != HAL_OK)
// {
// CxxErrorHandler();
// }
hadc1.Init.OversamplingMode = ENABLE;
if (HAL_ADC_Init(&hadc1) != HAL_OK)
{
CxxErrorHandler();
}

ADC_ChannelConfTypeDef sConfig;

Expand Down

0 comments on commit 0da7939

Please sign in to comment.