Skip to main content
Remi Demers
Associate II
April 9, 2025
Solved

Cannot write TIM registers

  • April 9, 2025
  • 2 replies
  • 370 views

Hi,

Using Wise studio Version: 1.3.1_R Build id: 2023_05 on Linux with the STEVAL-IDB012V1 (BlueRNG-LPS dev. kit). I discovered that my instructions to write values in the timer registers have no effect. I found it by tracing the program while watching the register values in the register window of the debugger perspective. For example, TIM2->ARR = 3200; produce no change in the register. Same result with TIM16 and TIM17. I should miss something very basic here. It is made from the "Profiles_Peripheral_with_Library" example. All my edits are visible in the snippet below:

int main(void)
{ 
 /* System Init */
 SystemInit(SYSCLK_64M, BLE_SYSCLK_32M);
 
 /* Configure IOs for power save modes */
 BSP_IO_Init();
 
 /* Configure I/O communication channel */
 BSP_COM_Init(BSP_COM_RxDataUserCb);
 
 /* Init Clock */
 Clock_Init();
 
 /* Initialize the button */
 BSP_PB_Init(USER_BUTTON, BUTTON_MODE_EXTI);
 
 // Overwrite initializations
 //My_GPIO_Settings();
 //Define_Waveform_data_buffer();
 //DMA_Based_Waveform_Settings();
 GPIOA->MODER =0x000000A0;
 LL_GPIO_SetPinMode(GPIOB, LL_GPIO_PIN_0, LL_GPIO_MODE_ALTERNATE);
 LL_GPIO_SetAFPin_0_7(GPIOB, LL_GPIO_PIN_0, LL_GPIO_AF_2);
 LL_GPIO_SetPinMode(GPIOB, LL_GPIO_PIN_1, LL_GPIO_MODE_OUTPUT);
 LL_GPIO_SetPinMode(GPIOB, LL_GPIO_PIN_2, LL_GPIO_MODE_OUTPUT);

 TIM2->ARR = 3200;
 TIM2->CCR1 = 1600;
 TIM2->CR1 = 0b0000000000000001;


 while(1)
 {
	 if(TIM2->CNT > 1000)
	 LL_GPIO_SetOutputPin(GPIOB, 0x2);
	 else
	 {
	 LL_GPIO_ResetOutputPin(GPIOB, 0x2);
	 }
 }
 // Host_Profile_Test_Application();
}

 

Best answer by mƎALLEm

Hello,

Does:

Clock_Init();

enable the timer clock in the RCC_APB0ENR register?

mALLEm_0-1744214323529.png

Check if these bits are set..

 

2 replies

mƎALLEm
mƎALLEmBest answer
Technical Moderator
April 9, 2025

Hello,

Does:

Clock_Init();

enable the timer clock in the RCC_APB0ENR register?

mALLEm_0-1744214323529.png

Check if these bits are set..

 

"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."
Remi Demers
Associate II
April 9, 2025

This was it. Thanks a lot!