2024-11-17 06:02 AM - edited 2024-11-19 02:37 AM
I haven't been able to wait 500ms without affecting the timers for 7 days.
In this block, doesn't PB14 become "0" after 500ms?
Even if I use comment lines, it doesn't work.
Note: volatile uint32_t Counter = 0;
The "Counter" variable is incremented every 1ms with Timer16.
** STM32F030C6T6 I'm using.
** Own PCB board..
*** Note: Card of a working system.. There is no card design error.
if(htim->Instance==TIM16)
{
Counter++;
if(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_13)==0)
{
if(HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_2)==0)
{
if(PA10_On==0)
{
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12,GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14,GPIO_PIN_SET);
Counter=0;
PA10_On=1;
// Tick_PA10_On= HAL_GetTick();
// PA10_On=1;
}
else
{
if(Counter>500) // if((HAL_GetTick()-Tick_PA10_On)>=500)
{
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14,GPIO_PIN_RESET);
Counter=501;
}
}
}
else
{
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12,GPIO_PIN_SET);
}
}
else
{
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12,GPIO_PIN_RESET);
}
}
Solved! Go to Solution.
2024-11-18 03:10 AM
I will try but the problem must be somewhere else.
because
even the code above does not work. b14 is not active or passive.
2024-11-18 03:14 AM
2024-11-18 03:17 AM
attach main.c
2024-11-18 04:37 AM
2024-11-18 04:53 AM
if (HAL_GetTick() - tick_start >= 500) {
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_12); //
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_13);
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_14);
tick_start = HAL_GetTick(); //
}
even this code is not working.
I think there is a problem with HAL_GetTick();..
HAL_GetTick(); may not be working.
2024-11-18 06:54 AM - edited 2024-11-18 07:06 AM
Seems you project isnt configured... HAL_IncTick is in Systick IT handler , but systick isnt configured...
How you manage project ? CubeMX ?
Or timers is misconfigured and ISR took long, then main code never run. Know you how debug code?
Try comment all timers out.
2024-11-18 07:46 AM
I am using stm32cubeide. If I send you my project file, can you review it? Just find my mistake about the hal_gettick(); function. I control my project with timers. I don't understand which one is longer.
2024-11-18 08:04 AM
I use test5.rar and main.c , and try send you back working code.
2024-11-18 08:43 AM
I don't know which file is in test 5, but the solution you make there will still be useful to me.
2024-11-18 09:05 AM