STM32F4xx_HAL_Driver  1.8.3
TIM Peripheral Control functions

Peripheral Control functions. More...

+ Collaboration diagram for TIM Peripheral Control functions:

Functions

HAL_StatusTypeDef HAL_TIM_OC_ConfigChannel (TIM_HandleTypeDef *htim, const TIM_OC_InitTypeDef *sConfig, uint32_t Channel)
 Initializes the TIM Output Compare Channels according to the specified parameters in the TIM_OC_InitTypeDef. More...
 
HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel (TIM_HandleTypeDef *htim, const TIM_OC_InitTypeDef *sConfig, uint32_t Channel)
 Initializes the TIM PWM channels according to the specified parameters in the TIM_OC_InitTypeDef. More...
 
HAL_StatusTypeDef HAL_TIM_IC_ConfigChannel (TIM_HandleTypeDef *htim, const TIM_IC_InitTypeDef *sConfig, uint32_t Channel)
 Initializes the TIM Input Capture Channels according to the specified parameters in the TIM_IC_InitTypeDef. More...
 
HAL_StatusTypeDef HAL_TIM_OnePulse_ConfigChannel (TIM_HandleTypeDef *htim, TIM_OnePulse_InitTypeDef *sConfig, uint32_t OutputChannel, uint32_t InputChannel)
 Initializes the TIM One Pulse Channels according to the specified parameters in the TIM_OnePulse_InitTypeDef. More...
 
HAL_StatusTypeDef HAL_TIM_ConfigOCrefClear (TIM_HandleTypeDef *htim, const TIM_ClearInputConfigTypeDef *sClearInputConfig, uint32_t Channel)
 Configures the OCRef clear feature. More...
 
HAL_StatusTypeDef HAL_TIM_ConfigClockSource (TIM_HandleTypeDef *htim, const TIM_ClockConfigTypeDef *sClockSourceConfig)
 Configures the clock source to be used. More...
 
HAL_StatusTypeDef HAL_TIM_ConfigTI1Input (TIM_HandleTypeDef *htim, uint32_t TI1_Selection)
 Selects the signal connected to the TI1 input: direct from CH1_input or a XOR combination between CH1_input, CH2_input & CH3_input. More...
 
HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro (TIM_HandleTypeDef *htim, const TIM_SlaveConfigTypeDef *sSlaveConfig)
 Configures the TIM in Slave mode. More...
 
HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro_IT (TIM_HandleTypeDef *htim, const TIM_SlaveConfigTypeDef *sSlaveConfig)
 Configures the TIM in Slave mode in interrupt mode. More...
 
HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStart (TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc, const uint32_t *BurstBuffer, uint32_t BurstLength)
 Configure the DMA Burst to transfer Data from the memory to the TIM peripheral. More...
 
HAL_StatusTypeDef HAL_TIM_DMABurst_MultiWriteStart (TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc, const uint32_t *BurstBuffer, uint32_t BurstLength, uint32_t DataLength)
 Configure the DMA Burst to transfer multiple Data from the memory to the TIM peripheral. More...
 
HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStop (TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc)
 Stops the TIM DMA Burst mode. More...
 
HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStart (TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength)
 Configure the DMA Burst to transfer Data from the TIM peripheral to the memory. More...
 
HAL_StatusTypeDef HAL_TIM_DMABurst_MultiReadStart (TIM_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength, uint32_t DataLength)
 Configure the DMA Burst to transfer Data from the TIM peripheral to the memory. More...
 
HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStop (TIM_HandleTypeDef *htim, uint32_t BurstRequestSrc)
 Stop the DMA burst reading. More...
 
HAL_StatusTypeDef HAL_TIM_GenerateEvent (TIM_HandleTypeDef *htim, uint32_t EventSource)
 Generate a software event. More...
 
uint32_t HAL_TIM_ReadCapturedValue (const TIM_HandleTypeDef *htim, uint32_t Channel)
 Read the captured value from Capture Compare unit. More...
 

Detailed Description

Peripheral Control functions.

TIM Peripheral Control functions.

  ==============================================================================
                   ##### Peripheral Control functions #####
  ==============================================================================
 [..]
   This section provides functions allowing to:
      (+) Configure The Input Output channels for OC, PWM, IC or One Pulse mode.
      (+) Configure External Clock source.
      (+) Configure Complementary channels, break features and dead time.
      (+) Configure Master and the Slave synchronization.
      (+) Configure the DMA Burst Mode.

Function Documentation

◆ HAL_TIM_ConfigClockSource()

HAL_StatusTypeDef HAL_TIM_ConfigClockSource ( TIM_HandleTypeDef htim,
const TIM_ClockConfigTypeDef sClockSourceConfig 
)

Configures the clock source to be used.

Parameters
htimTIM handle
sClockSourceConfigpointer to a TIM_ClockConfigTypeDef structure that contains the clock source information for the TIM peripheral.
Return values
HALstatus

Definition at line 5304 of file stm32f4xx_hal_tim.c.

◆ HAL_TIM_ConfigOCrefClear()

HAL_StatusTypeDef HAL_TIM_ConfigOCrefClear ( TIM_HandleTypeDef htim,
const TIM_ClearInputConfigTypeDef sClearInputConfig,
uint32_t  Channel 
)

Configures the OCRef clear feature.

Parameters
htimTIM handle
sClearInputConfigpointer to a TIM_ClearInputConfigTypeDef structure that contains the OCREF clear feature and parameters for the TIM peripheral.
Channelspecifies the TIM Channel This parameter can be one of the following values:
  • TIM_CHANNEL_1: TIM Channel 1
  • TIM_CHANNEL_2: TIM Channel 2
  • TIM_CHANNEL_3: TIM Channel 3
  • TIM_CHANNEL_4: TIM Channel 4
Return values
HALstatus

Definition at line 5174 of file stm32f4xx_hal_tim.c.

◆ HAL_TIM_ConfigTI1Input()

HAL_StatusTypeDef HAL_TIM_ConfigTI1Input ( TIM_HandleTypeDef htim,
uint32_t  TI1_Selection 
)

Selects the signal connected to the TI1 input: direct from CH1_input or a XOR combination between CH1_input, CH2_input & CH3_input.

Parameters
htimTIM handle.
TI1_SelectionIndicate whether or not channel 1 is connected to the output of a XOR gate. This parameter can be one of the following values:
  • TIM_TI1SELECTION_CH1: The TIMx_CH1 pin is connected to TI1 input
  • TIM_TI1SELECTION_XORCOMBINATION: The TIMx_CH1, CH2 and CH3 pins are connected to the TI1 input (XOR combination)
Return values
HALstatus

Definition at line 5458 of file stm32f4xx_hal_tim.c.

◆ HAL_TIM_DMABurst_MultiReadStart()

HAL_StatusTypeDef HAL_TIM_DMABurst_MultiReadStart ( TIM_HandleTypeDef htim,
uint32_t  BurstBaseAddress,
uint32_t  BurstRequestSrc,
uint32_t *  BurstBuffer,
uint32_t  BurstLength,
uint32_t  DataLength 
)

Configure the DMA Burst to transfer Data from the TIM peripheral to the memory.

Parameters
htimTIM handle
BurstBaseAddressTIM Base address from where the DMA will start the Data read This parameter can be one of the following values:
  • TIM_DMABASE_CR1
  • TIM_DMABASE_CR2
  • TIM_DMABASE_SMCR
  • TIM_DMABASE_DIER
  • TIM_DMABASE_SR
  • TIM_DMABASE_EGR
  • TIM_DMABASE_CCMR1
  • TIM_DMABASE_CCMR2
  • TIM_DMABASE_CCER
  • TIM_DMABASE_CNT
  • TIM_DMABASE_PSC
  • TIM_DMABASE_ARR
  • TIM_DMABASE_RCR
  • TIM_DMABASE_CCR1
  • TIM_DMABASE_CCR2
  • TIM_DMABASE_CCR3
  • TIM_DMABASE_CCR4
  • TIM_DMABASE_BDTR
BurstRequestSrcTIM DMA Request sources This parameter can be one of the following values:
  • TIM_DMA_UPDATE: TIM update Interrupt source
  • TIM_DMA_CC1: TIM Capture Compare 1 DMA source
  • TIM_DMA_CC2: TIM Capture Compare 2 DMA source
  • TIM_DMA_CC3: TIM Capture Compare 3 DMA source
  • TIM_DMA_CC4: TIM Capture Compare 4 DMA source
  • TIM_DMA_COM: TIM Commutation DMA source
  • TIM_DMA_TRIGGER: TIM Trigger DMA source
BurstBufferThe Buffer address.
BurstLengthDMA Burst length. This parameter can be one value between: TIM_DMABURSTLENGTH_1TRANSFER and TIM_DMABURSTLENGTH_18TRANSFERS.
DataLengthData length. This parameter can be one value between 1 and 0xFFFF.
Return values
HALstatus

Definition at line 4870 of file stm32f4xx_hal_tim.c.

◆ HAL_TIM_DMABurst_MultiWriteStart()

HAL_StatusTypeDef HAL_TIM_DMABurst_MultiWriteStart ( TIM_HandleTypeDef htim,
uint32_t  BurstBaseAddress,
uint32_t  BurstRequestSrc,
const uint32_t *  BurstBuffer,
uint32_t  BurstLength,
uint32_t  DataLength 
)

Configure the DMA Burst to transfer multiple Data from the memory to the TIM peripheral.

Parameters
htimTIM handle
BurstBaseAddressTIM Base address from where the DMA will start the Data write This parameter can be one of the following values:
  • TIM_DMABASE_CR1
  • TIM_DMABASE_CR2
  • TIM_DMABASE_SMCR
  • TIM_DMABASE_DIER
  • TIM_DMABASE_SR
  • TIM_DMABASE_EGR
  • TIM_DMABASE_CCMR1
  • TIM_DMABASE_CCMR2
  • TIM_DMABASE_CCER
  • TIM_DMABASE_CNT
  • TIM_DMABASE_PSC
  • TIM_DMABASE_ARR
  • TIM_DMABASE_RCR
  • TIM_DMABASE_CCR1
  • TIM_DMABASE_CCR2
  • TIM_DMABASE_CCR3
  • TIM_DMABASE_CCR4
  • TIM_DMABASE_BDTR
BurstRequestSrcTIM DMA Request sources This parameter can be one of the following values:
  • TIM_DMA_UPDATE: TIM update Interrupt source
  • TIM_DMA_CC1: TIM Capture Compare 1 DMA source
  • TIM_DMA_CC2: TIM Capture Compare 2 DMA source
  • TIM_DMA_CC3: TIM Capture Compare 3 DMA source
  • TIM_DMA_CC4: TIM Capture Compare 4 DMA source
  • TIM_DMA_COM: TIM Commutation DMA source
  • TIM_DMA_TRIGGER: TIM Trigger DMA source
BurstBufferThe Buffer address.
BurstLengthDMA Burst length. This parameter can be one value between: TIM_DMABURSTLENGTH_1TRANSFER and TIM_DMABURSTLENGTH_18TRANSFERS.
DataLengthData length. This parameter can be one value between 1 and 0xFFFF.
Return values
HALstatus

Definition at line 4534 of file stm32f4xx_hal_tim.c.

◆ HAL_TIM_DMABurst_ReadStart()

HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStart ( TIM_HandleTypeDef htim,
uint32_t  BurstBaseAddress,
uint32_t  BurstRequestSrc,
uint32_t *  BurstBuffer,
uint32_t  BurstLength 
)

Configure the DMA Burst to transfer Data from the TIM peripheral to the memory.

Parameters
htimTIM handle
BurstBaseAddressTIM Base address from where the DMA will start the Data read This parameter can be one of the following values:
  • TIM_DMABASE_CR1
  • TIM_DMABASE_CR2
  • TIM_DMABASE_SMCR
  • TIM_DMABASE_DIER
  • TIM_DMABASE_SR
  • TIM_DMABASE_EGR
  • TIM_DMABASE_CCMR1
  • TIM_DMABASE_CCMR2
  • TIM_DMABASE_CCER
  • TIM_DMABASE_CNT
  • TIM_DMABASE_PSC
  • TIM_DMABASE_ARR
  • TIM_DMABASE_RCR
  • TIM_DMABASE_CCR1
  • TIM_DMABASE_CCR2
  • TIM_DMABASE_CCR3
  • TIM_DMABASE_CCR4
  • TIM_DMABASE_BDTR
BurstRequestSrcTIM DMA Request sources This parameter can be one of the following values:
  • TIM_DMA_UPDATE: TIM update Interrupt source
  • TIM_DMA_CC1: TIM Capture Compare 1 DMA source
  • TIM_DMA_CC2: TIM Capture Compare 2 DMA source
  • TIM_DMA_CC3: TIM Capture Compare 3 DMA source
  • TIM_DMA_CC4: TIM Capture Compare 4 DMA source
  • TIM_DMA_COM: TIM Commutation DMA source
  • TIM_DMA_TRIGGER: TIM Trigger DMA source
BurstBufferThe Buffer address.
BurstLengthDMA Burst length. This parameter can be one value between: TIM_DMABURSTLENGTH_1TRANSFER and TIM_DMABURSTLENGTH_18TRANSFERS.
Note
This function should be used only when BurstLength is equal to DMA data transfer length.
Return values
HALstatus

Definition at line 4819 of file stm32f4xx_hal_tim.c.

◆ HAL_TIM_DMABurst_ReadStop()

HAL_StatusTypeDef HAL_TIM_DMABurst_ReadStop ( TIM_HandleTypeDef htim,
uint32_t  BurstRequestSrc 
)

Stop the DMA burst reading.

Parameters
htimTIM handle
BurstRequestSrcTIM DMA Request sources to disable.
Return values
HALstatus

Definition at line 5054 of file stm32f4xx_hal_tim.c.

◆ HAL_TIM_DMABurst_WriteStart()

HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStart ( TIM_HandleTypeDef htim,
uint32_t  BurstBaseAddress,
uint32_t  BurstRequestSrc,
const uint32_t *  BurstBuffer,
uint32_t  BurstLength 
)

Configure the DMA Burst to transfer Data from the memory to the TIM peripheral.

Parameters
htimTIM handle
BurstBaseAddressTIM Base address from where the DMA will start the Data write This parameter can be one of the following values:
  • TIM_DMABASE_CR1
  • TIM_DMABASE_CR2
  • TIM_DMABASE_SMCR
  • TIM_DMABASE_DIER
  • TIM_DMABASE_SR
  • TIM_DMABASE_EGR
  • TIM_DMABASE_CCMR1
  • TIM_DMABASE_CCMR2
  • TIM_DMABASE_CCER
  • TIM_DMABASE_CNT
  • TIM_DMABASE_PSC
  • TIM_DMABASE_ARR
  • TIM_DMABASE_RCR
  • TIM_DMABASE_CCR1
  • TIM_DMABASE_CCR2
  • TIM_DMABASE_CCR3
  • TIM_DMABASE_CCR4
  • TIM_DMABASE_BDTR
BurstRequestSrcTIM DMA Request sources This parameter can be one of the following values:
  • TIM_DMA_UPDATE: TIM update Interrupt source
  • TIM_DMA_CC1: TIM Capture Compare 1 DMA source
  • TIM_DMA_CC2: TIM Capture Compare 2 DMA source
  • TIM_DMA_CC3: TIM Capture Compare 3 DMA source
  • TIM_DMA_CC4: TIM Capture Compare 4 DMA source
  • TIM_DMA_COM: TIM Commutation DMA source
  • TIM_DMA_TRIGGER: TIM Trigger DMA source
BurstBufferThe Buffer address.
BurstLengthDMA Burst length. This parameter can be one value between: TIM_DMABURSTLENGTH_1TRANSFER and TIM_DMABURSTLENGTH_18TRANSFERS.
Note
This function should be used only when BurstLength is equal to DMA data transfer length.
Return values
HALstatus

Definition at line 4481 of file stm32f4xx_hal_tim.c.

◆ HAL_TIM_DMABurst_WriteStop()

HAL_StatusTypeDef HAL_TIM_DMABurst_WriteStop ( TIM_HandleTypeDef htim,
uint32_t  BurstRequestSrc 
)

Stops the TIM DMA Burst mode.

Parameters
htimTIM handle
BurstRequestSrcTIM DMA Request sources to disable
Return values
HALstatus

Definition at line 4718 of file stm32f4xx_hal_tim.c.

◆ HAL_TIM_GenerateEvent()

HAL_StatusTypeDef HAL_TIM_GenerateEvent ( TIM_HandleTypeDef htim,
uint32_t  EventSource 
)

Generate a software event.

Parameters
htimTIM handle
EventSourcespecifies the event source. This parameter can be one of the following values:
  • TIM_EVENTSOURCE_UPDATE: Timer update Event source
  • TIM_EVENTSOURCE_CC1: Timer Capture Compare 1 Event source
  • TIM_EVENTSOURCE_CC2: Timer Capture Compare 2 Event source
  • TIM_EVENTSOURCE_CC3: Timer Capture Compare 3 Event source
  • TIM_EVENTSOURCE_CC4: Timer Capture Compare 4 Event source
  • TIM_EVENTSOURCE_COM: Timer COM event source
  • TIM_EVENTSOURCE_TRIGGER: Timer Trigger Event source
  • TIM_EVENTSOURCE_BREAK: Timer Break event source
Note
Basic timers can only generate an update event.
TIM_EVENTSOURCE_COM is relevant only with advanced timer instances.
TIM_EVENTSOURCE_BREAK are relevant only for timer instances supporting a break input.
Return values
HALstatus

Definition at line 5137 of file stm32f4xx_hal_tim.c.

◆ HAL_TIM_IC_ConfigChannel()

HAL_StatusTypeDef HAL_TIM_IC_ConfigChannel ( TIM_HandleTypeDef htim,
const TIM_IC_InitTypeDef sConfig,
uint32_t  Channel 
)

Initializes the TIM Input Capture Channels according to the specified parameters in the TIM_IC_InitTypeDef.

Parameters
htimTIM IC handle
sConfigTIM Input Capture configuration structure
ChannelTIM Channel to configure This parameter can be one of the following values:
  • TIM_CHANNEL_1: TIM Channel 1 selected
  • TIM_CHANNEL_2: TIM Channel 2 selected
  • TIM_CHANNEL_3: TIM Channel 3 selected
  • TIM_CHANNEL_4: TIM Channel 4 selected
Return values
HALstatus

Definition at line 4120 of file stm32f4xx_hal_tim.c.

◆ HAL_TIM_OC_ConfigChannel()

HAL_StatusTypeDef HAL_TIM_OC_ConfigChannel ( TIM_HandleTypeDef htim,
const TIM_OC_InitTypeDef sConfig,
uint32_t  Channel 
)

Initializes the TIM Output Compare Channels according to the specified parameters in the TIM_OC_InitTypeDef.

Parameters
htimTIM Output Compare handle
sConfigTIM Output Compare configuration structure
ChannelTIM Channels to configure This parameter can be one of the following values:
  • TIM_CHANNEL_1: TIM Channel 1 selected
  • TIM_CHANNEL_2: TIM Channel 2 selected
  • TIM_CHANNEL_3: TIM Channel 3 selected
  • TIM_CHANNEL_4: TIM Channel 4 selected
Return values
HALstatus

Definition at line 4041 of file stm32f4xx_hal_tim.c.

◆ HAL_TIM_OnePulse_ConfigChannel()

HAL_StatusTypeDef HAL_TIM_OnePulse_ConfigChannel ( TIM_HandleTypeDef htim,
TIM_OnePulse_InitTypeDef sConfig,
uint32_t  OutputChannel,
uint32_t  InputChannel 
)

Initializes the TIM One Pulse Channels according to the specified parameters in the TIM_OnePulse_InitTypeDef.

Parameters
htimTIM One Pulse handle
sConfigTIM One Pulse configuration structure
OutputChannelTIM output channel to configure This parameter can be one of the following values:
  • TIM_CHANNEL_1: TIM Channel 1 selected
  • TIM_CHANNEL_2: TIM Channel 2 selected
InputChannelTIM input Channel to configure This parameter can be one of the following values:
  • TIM_CHANNEL_1: TIM Channel 1 selected
  • TIM_CHANNEL_2: TIM Channel 2 selected
Note
To output a waveform with a minimum delay user can enable the fast mode by calling the __HAL_TIM_ENABLE_OCxFAST macro. Then CCx output is forced in response to the edge detection on TIx input, without taking in account the comparison.
Return values
HALstatus

Definition at line 4333 of file stm32f4xx_hal_tim.c.

◆ HAL_TIM_PWM_ConfigChannel()

HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel ( TIM_HandleTypeDef htim,
const TIM_OC_InitTypeDef sConfig,
uint32_t  Channel 
)

Initializes the TIM PWM channels according to the specified parameters in the TIM_OC_InitTypeDef.

Parameters
htimTIM PWM handle
sConfigTIM PWM configuration structure
ChannelTIM Channels to be configured This parameter can be one of the following values:
  • TIM_CHANNEL_1: TIM Channel 1 selected
  • TIM_CHANNEL_2: TIM Channel 2 selected
  • TIM_CHANNEL_3: TIM Channel 3 selected
  • TIM_CHANNEL_4: TIM Channel 4 selected
Return values
HALstatus

Definition at line 4219 of file stm32f4xx_hal_tim.c.

◆ HAL_TIM_ReadCapturedValue()

uint32_t HAL_TIM_ReadCapturedValue ( const TIM_HandleTypeDef htim,
uint32_t  Channel 
)

Read the captured value from Capture Compare unit.

Parameters
htimTIM handle.
ChannelTIM Channels to be enabled This parameter can be one of the following values:
  • TIM_CHANNEL_1: TIM Channel 1 selected
  • TIM_CHANNEL_2: TIM Channel 2 selected
  • TIM_CHANNEL_3: TIM Channel 3 selected
  • TIM_CHANNEL_4: TIM Channel 4 selected
Return values
Capturedvalue

Definition at line 5573 of file stm32f4xx_hal_tim.c.

◆ HAL_TIM_SlaveConfigSynchro()

HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro ( TIM_HandleTypeDef htim,
const TIM_SlaveConfigTypeDef sSlaveConfig 
)

Configures the TIM in Slave mode.

Parameters
htimTIM handle.
sSlaveConfigpointer to a TIM_SlaveConfigTypeDef structure that contains the selected trigger (internal trigger input, filtered timer input or external trigger input) and the Slave mode (Disable, Reset, Gated, Trigger, External clock mode 1).
Return values
HALstatus

Definition at line 5490 of file stm32f4xx_hal_tim.c.

◆ HAL_TIM_SlaveConfigSynchro_IT()

HAL_StatusTypeDef HAL_TIM_SlaveConfigSynchro_IT ( TIM_HandleTypeDef htim,
const TIM_SlaveConfigTypeDef sSlaveConfig 
)

Configures the TIM in Slave mode in interrupt mode.

Parameters
htimTIM handle.
sSlaveConfigpointer to a TIM_SlaveConfigTypeDef structure that contains the selected trigger (internal trigger input, filtered timer input or external trigger input) and the Slave mode (Disable, Reset, Gated, Trigger, External clock mode 1).
Return values
HALstatus

Definition at line 5530 of file stm32f4xx_hal_tim.c.