2018-01-01 06:06 PM
DMA update request to ADC works with timer 2 but not with timer 6 on stm32f7. The data sheet states that timer 6 should be able to generate a DMA request in section 25.2 in document RM0385. Can anyone confirm this is possible? I don't mind using timer 2 but for curiosity's sake.
2018-01-01 06:37 PM
Section 25.2 in RM0385 Rev 6 talks about the DAC not the ADC
You want the ADC to trigger the DMA, and the TIM to trigger the ADC
Table 94 (section 15.6) described the ADC's External Trigger. TIM6_TRGO is mentioned, so you'd need to configure TIM6 and route one of the sources (Update, CC1, CC2, etc) to the TRGO (Trigger Output) functionality.
2018-01-01 08:03 PM
Right, that was the idea. I am usingTIM6 to count up and then cause an update event. This then causes the ADC to convert and then send a DMA request to send the data to my buffer. I set an interruptHAL_ADC_ConvCpltCallback( ) andHAL_TIM_PeriodElapsedCallback( ) with nop's in them just to hit the breakpoint and prove I got somewhere or not. I always get to
HAL_TIM_PeriodElapsedCallback( ) but never break on HAL_ADC_ConvCpltCallback( ). When I use TIM2 or TIM8 it does work.
so as an implementation:
I use this in main( )
HAL_ADC_Start_DMA(&hadc1, (uint32_t*)rawData, bufferSize);
HAL_TIM_Base_Start(&htim6);�?�?
This in TIM6 setup
htim6.Instance = TIM6;
htim6.Init.Prescaler = 1;
htim6.Init.CounterMode = TIM_COUNTERMODE_UP;
htim6.Init.Period = 2250;
htim6.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
...
sMasterConfig.MasterOutputTrigger = TIM_TRGO_UPDATE;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;�?�?�?�?�?�?�?�?�?�?
This is ADC1 setup
hadc1.Instance = ADC1;
hadc1.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4;
hadc1.Init.Resolution = ADC_RESOLUTION_12B;
hadc1.Init.ScanConvMode = DISABLE;
hadc1.Init.ContinuousConvMode = DISABLE;
hadc1.Init.DiscontinuousConvMode = DISABLE;
hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_RISING;
hadc1.Init.ExternalTrigConv = ADC_EXTERNALTRIGCONV_T6_TRGO;
hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
hadc1.Init.NbrOfConversion = 1;
hadc1.Init.DMAContinuousRequests = DISABLE;
hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;�?�?�?�?�?�?�?�?�?�?�?�?