cancel
Showing results for 
Search instead for 
Did you mean: 

Write to TIMx break and dead-time register

Locnvselex_vn
Associate II

Hello everyone!

During programming for the MCU STM32G431CbTx, I want to write a function to change the value of the "Break filter" bit for "Tim_BRK" as follows:

 

static inline void mcu_protection_ov_enable_filter(){
  uint32_t tmpbdtr = READ_REG(TIM1->BDTR);
  tmpbdtr = (tmpbdtr & 0xFFF0FFFFU) | LL_TIM_BREAK_FILTER_FDIV2_N8;
  WRITE_REG(TIM1->BDTR,tmpbdtr);
}

 

Locnvselex_vn_0-1738851471950.png

 

However, after checking, the value of the BKF bit remains unchanged, while the LOCK bit is set to 00: LOCK OFF - No bit is write-protected. Meanwhile, I can use a similar method to change the DTG (deadtime) bit.

Who can support me?

Thanks,

Locnv.


Edited to apply code formatting - please see How to insert source code for future reference.

1 REPLY 1
Sarra.S
ST Employee

Hello @Locnvselex_vn

As described by the RM, you need to configure all relevant bits during the first write access to the TIMx_BDTR register. Try setting the lock bits to 00 in a single write operation 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.