cancel
Showing results for 
Search instead for 
Did you mean: 

Timer initialisation to *not* set the ARPE bit ?

pr
Associate III

I would like to know what is the correct way to disable a timer’s ARR preload function using the HAL library ? And once that’s done, does the ARPE bit stay low for the whole runtime, or does it have to be cleared again regularly or after specific events? (If yes, which?)

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Set htimx.Init.AutoReloadPreload to TIM_AUTORELOAD_PRELOAD_DISABLE before you call HAL_TIM_***_Init().

It'll stay the way you initialize it unless you re-initialize it with TIM_AUTORELOAD_PRELOAD_ENABLE.

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

View solution in original post

4 REPLIES 4
TDK
Guru

Set htimx.Init.AutoReloadPreload to TIM_AUTORELOAD_PRELOAD_DISABLE before you call HAL_TIM_***_Init().

It'll stay the way you initialize it unless you re-initialize it with TIM_AUTORELOAD_PRELOAD_ENABLE.

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

The timer handle's Init member is of type TIM_Base_InitTypeDef:

typedef struct
{
  TIM_TypeDef 
  TIM_Base_InitTypeDef        Init;
  HAL_TIM_ActiveChannel       Channel;
  DMA_HandleTypeDef           *hdma[7];
  HAL_LockTypeDef             Lock;
  __IO HAL_TIM_StateTypeDef   State;
}TIM_HandleTypeDef;
 
typedef struct
{
  uint32_t Prescaler;  
  uint32_t CounterMode;
  uint32_t Period; 
  uint32_t ClockDivision; 
  uint32_t RepetitionCounter; 
} TIM_Base_InitTypeDef;

There is no htimx.Init.AutoReloadPreload -- am I using an outdated version of the HAL library ? (It came bundled as part of the GNU MCU Eclipse STM32F4 project template.)

Yes, seems like an old version. Id consider downloading STMCubeMX and using that to generate the initialization code.
You could also manipulate ARPE manually if comfortable.
If you feel a post has answered your question, please click "Accept as Solution".
pr
Associate III

I updated my drivers and that worked