2023-04-11 06:50 AM
2023-04-11 08:12 AM
Do this in your SysTick_Handler
/* Change this with the debugger: */
volatile uint32_t g_value = ..... ;
void SysTick_Handler(void)
{
HAL_IncTick();
/* USER CODE BEGIN SysTick_IRQn 1 */
TIM1->CCR = g_value;
/* USER CODE END SysTick_IRQn 1 */
}
2023-04-11 07:35 AM
TIM1->CCR2 = value;
JW
2023-04-11 08:01 AM
@waclawek.jan
Thanks for your answer but with TIM1->CCR2 = value; I can't vary the duty cycle directly on the debbogger. I always have to stop the program and change the value in the pluse and recompile again.
2023-04-11 08:12 AM
Do this in your SysTick_Handler
/* Change this with the debugger: */
volatile uint32_t g_value = ..... ;
void SysTick_Handler(void)
{
HAL_IncTick();
/* USER CODE BEGIN SysTick_IRQn 1 */
TIM1->CCR = g_value;
/* USER CODE END SysTick_IRQn 1 */
}
2023-04-11 08:51 AM
@Pavel A. I copied and pasted it on my program but it generated errors
../Core/Src/main.c:109:6 : warning : 'SysTick_Handler' défini mais non utilisé [-Wunused-function]
109 | void SysTick_Handler(void)
2023-04-11 09:29 AM
Well, in debugger, you don't need any code. Just write directly to TIM1->CCR2 in the peripheral registers view.
JW
2023-04-11 09:43 AM
I have to write it on my main code the wile loop
while (1)
{
/* USER CODE END WHILE */
TIM1->CCR2=250;
/* USER CODE BEGIN 3 */
}
2023-04-11 11:13 AM - edited 2023-11-20 08:31 AM
@pavel A. look
2023-04-11 11:18 AM
It complains about nonexistent TIM1->CCR - missing 2 in TIM1->CCR2.
JW
2023-04-11 11:29 AM
thank you there are more errors but I don't see where I have to vary the duty cycle