2025-02-06 06:23 AM - last edited on 2025-02-06 06:27 AM by Andrew Neil
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);
}
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.
2025-02-06 07:14 AM - edited 2025-02-06 07:15 AM
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.