From: drowe67 Date: Tue, 16 Sep 2014 07:56:52 +0000 (+0000) Subject: fixed low level 256Hz tone bug, was init issue in DAC, thanks Rick and Michael and... X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=11bb93c7da8bb5737a7b66a908585a377a3f29cc;p=freetel-svn-tracking.git fixed low level 256Hz tone bug, was init issue in DAC, thanks Rick and Michael and Matt for support and suggestions git-svn-id: https://svn.code.sf.net/p/freetel/code@1843 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/stm32/Makefile b/codec2-dev/stm32/Makefile index 9fc660b2..8915dec6 100644 --- a/codec2-dev/stm32/Makefile +++ b/codec2-dev/stm32/Makefile @@ -153,6 +153,7 @@ src/init.c dac_ut.elf: $(DAC_UT_SRCS) $(CC) $(CFLAGS) -O0 $^ -o $@ $(LIBPATHS) $(LIBS) + $(OBJCOPY) -O binary dac_ut.elf dac_ut.bin ADCDAC_UT_SRCS=\ src/adcdac_ut.c \ @@ -304,6 +305,7 @@ src/stm32f4_adc.o: src/stm32f4_adc.c sm1000.elf: $(SM1000_SRCS) src/stm32f4_dac.o src/stm32f4_adc.o $(CC) $(CFLAGS) -O3 $^ -o $@ $(LIBPATHS) $(LIBS) + $(OBJCOPY) -O binary sm1000.elf sm1000.bin FREEDV_TX_PROFILE_SRCS=\ src/freedv_tx_profile.c \ diff --git a/codec2-dev/stm32/src/sm1000_main.c b/codec2-dev/stm32/src/sm1000_main.c index 9683172a..147dad6d 100644 --- a/codec2-dev/stm32/src/sm1000_main.c +++ b/codec2-dev/stm32/src/sm1000_main.c @@ -54,15 +54,6 @@ int main(void) { //led_pwr(1); led_ptt(0); led_rt(0); led_err(0); - /* - TODO: - [ ] UT analog interfaces from file IO - [ ] UTs for simultaneous tx & rx on analog interfaces - [ ] detect program assert type errors with a blinky - [ ] timer tick function to measure 10ms-ish type times - [ ] switch debouncing? - [ ] light led with bit errors - */ /* clear filter memories */ @@ -112,7 +103,7 @@ int main(void) { fdmdv_16_to_8_short(adc8k, &adc16k[FDMDV_OS_TAPS_16K], nin); nout = freedv_rx(f, &dac8k[FDMDV_OS_TAPS_8K], adc8k); //for(i=0; ifdmdv_stats.sync); led_err(f->total_bit_errors); @@ -120,7 +111,6 @@ int main(void) { } } - } /* while(1) ... */ } diff --git a/codec2-dev/stm32/src/stm32f4_dac.c b/codec2-dev/stm32/src/stm32f4_dac.c index 28dc258e..2115fa34 100644 --- a/codec2-dev/stm32/src/stm32f4_dac.c +++ b/codec2-dev/stm32/src/stm32f4_dac.c @@ -152,9 +152,18 @@ static void dac1_config(void) DMA_InitTypeDef DMA_InitStructure; NVIC_InitTypeDef NVIC_InitStructure; - /* DAC channel11Configuration */ - - DAC_InitStructure.DAC_Trigger = DAC_Trigger_T6_TRGO; + /* DAC channel 1 Configuration */ + + /* + This line fixed a bug that cost me 5 days, bad wave amplitude + value, and some STM32F4 periph library bugs caused triangle wave + geneartion to be enable resulting in a low level tone on the + SM1000, that we thought was caused by analog issues like layour + or power supply biasing + */ + DAC_StructInit(&DAC_InitStructure); + + DAC_InitStructure.DAC_Trigger = DAC_Trigger_T6_TRGO; DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None; DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable; DAC_Init(DAC_Channel_1, &DAC_InitStructure); @@ -211,8 +220,9 @@ static void dac2_config(void) DMA_InitTypeDef DMA_InitStructure; NVIC_InitTypeDef NVIC_InitStructure; - /* DAC channel2 Configuration */ + /* DAC channel 2 Configuration (see notes in dac1_config() above) */ + DAC_StructInit(&DAC_InitStructure); DAC_InitStructure.DAC_Trigger = DAC_Trigger_T6_TRGO; DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None; DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable; @@ -261,6 +271,7 @@ static void dac2_config(void) /* Enable DMA for DAC Channel 2 */ DAC_DMACmd(DAC_Channel_2, ENABLE); + } /******************************************************************************/