From 94fdf4495402afd6c01123cc189636bb4260abe2 Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Mon, 28 Mar 2022 14:39:40 +0200 Subject: [PATCH] Biased Module 17 baseband DAC output to Vdd/2 when idle --- platform/drivers/audio/outputStream_Mod17.cpp | 9 +++++---- platform/targets/Module17/platform.c | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/platform/drivers/audio/outputStream_Mod17.cpp b/platform/drivers/audio/outputStream_Mod17.cpp index cb39adb1..4927c3c1 100644 --- a/platform/drivers/audio/outputStream_Mod17.cpp +++ b/platform/drivers/audio/outputStream_Mod17.cpp @@ -44,14 +44,15 @@ static Thread *dmaWaiting = 0; */ void stopTransfer() { - TIM7->CR1 = 0; // Shutdown timer - DAC->CR = 0; // Disable DAC channels - DAC->SR = 0; // Clear status flags - // Stop DMA transfers DMA1_Stream5->CR = 0; DMA1_Stream6->CR = 0; + TIM7->CR1 = 0; // Shutdown timer + DAC->CR &= ~DAC_CR_EN2; // Disable only channel 2 + DAC->SR = 0; // Clear status flags + DAC->DHR12R1 = 2048; // Set channel 1 (RTX) to VDD/2 when idle + // Clear flags running = false; reqFinish = false; diff --git a/platform/targets/Module17/platform.c b/platform/targets/Module17/platform.c index e088884c..fc92b5f8 100644 --- a/platform/targets/Module17/platform.c +++ b/platform/targets/Module17/platform.c @@ -42,6 +42,12 @@ void platform_init() gpio_setMode(PTT_OUT, OUTPUT); gpio_clearPin(PTT_OUT); + /* Set analog output for baseband signal to an idle level of VDD/2 */ + gpio_setMode(BASEBAND_TX, INPUT_ANALOG); + RCC->APB1ENR |= RCC_APB1ENR_DACEN; + DAC->CR |= DAC_CR_EN1; + DAC->DHR12R1 = 2048; + nvm_init(); adc1_init(); i2c_init();