cancel
Showing results for 
Search instead for 
Did you mean: 

Tim12 TGRO is missing in cubemx.

LLuca.1
Associate II

In cubemx, the config of Tim12 TGRO is missing.

0693W00000D0YEiQAN.pngWhere in tim1, i can config it under Trigger Out Parameter. This feature is required by DMA request generator.

I tried manually add some code to init this, but none of them work.

/* USER CODE BEGIN TIM12_Init 1 */
  TIM_MasterConfigTypeDef sMasterConfig = {0};
  sMasterConfig.MasterOutputTrigger = TIM_TRGO_OC1REF;
  sMasterConfig.MasterOutputTrigger2 = TIM_TRGO2_RESET;
  sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
  HAL_TIMEx_MasterConfigSynchronization(&htim12, &sMasterConfig);
  /* USER CODE END TIM12_Init 1 */

The DMA is used to transfer GPIO to memory

uint32_t test[100] __attribute__((section(".ARM.__at_0x24000000")));
 
//ignore some code here
 
HAL_DMA_Start(&hdma_dma_generator0,&GPIOB->IDR,test,100);

4 REPLIES 4
TDK
Guru

TIM12 doesn't have a TRGO signal.

Only master timers have this capability.

This is not available to be configured by HAL because of limitations in the library.

/**
  * @brief  Configures the TIM in master mode.
  * @param  htim TIM handle.
  * @param  sMasterConfig pointer to a TIM_MasterConfigTypeDef structure that
  *         contains the selected trigger output (TRGO) and the Master/Slave
  *         mode.
  * @retval HAL status
  */
HAL_StatusTypeDef HAL_TIMEx_MasterConfigSynchronization(TIM_HandleTypeDef *htim,
                                                        TIM_MasterConfigTypeDef *sMasterConfig)
{
  uint32_t tmpcr2;
  uint32_t tmpsmcr;
 
  /* Check the parameters */
  assert_param(IS_TIM_MASTER_INSTANCE(htim->Instance));
  ...

/****** TIM Instances : master mode available (TIMx_CR2.MMS available )********/
#define IS_TIM_MASTER_INSTANCE(INSTANCE)   (((INSTANCE) == TIM1)   || \
                                            ((INSTANCE) == TIM2)   || \
                                            ((INSTANCE) == TIM3)   || \
                                            ((INSTANCE) == TIM4)   || \
                                            ((INSTANCE) == TIM5)   || \
                                            ((INSTANCE) == TIM6)   || \
                                            ((INSTANCE) == TIM7)   || \
                                            ((INSTANCE) == TIM8)   || \
                                            ((INSTANCE) == TIM15))

If you feel a post has answered your question, please click "Accept as Solution".

Which STM32?

> Only master timers have this capability.

No. TRGO from various timers can trigger not only other timers, but in newer STM32 also DMAMUX/DMA, and ADC.

0693W00000D0YfoQAF.png 

JW

Thx for reply.

It is stm32H743VIT.

Thx for reply.

I would wonder if i could use something like this.

0693W00000D0ePrQAJ.pngI configured TM1_CH1 as DMA request. The TM1_CH1 output a 1MHz PWM wave.

HAL_DMA_Start(&hdma_tim1_ch1,&GPIOB->IDR,test,100);

As far as i understand, DMA is like a interupt, so the request is not concerned with the srcAddr. But this failed to run.

Am i wrong? Hoping to hear from you!