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-19 03:45 AM
@XooM wrote:so why isn't Hal_delay working?
My problem is exactly that the hal_delay function isn't working.
Because you are not calling Hal_delay() anywhere in your code.
2024-11-19 03:48 AM
@XooM wrote:timer16 and SerialWire what do you want me to do
Ahh boy select as on my image Chekbox on serial wire when you used debuger this is good point and select TIM16 as your application timebase , MX then for you after generate code changes delay control from systick to TIM16 and setup 1ms. No more is required. Test toggle with this
2024-11-19 03:49 AM
2024-11-19 03:54 AM
can you set it up and send it to me.
I'm so confused..
2024-11-19 04:00 AM
HAL_GPIO_WritePin(PA10_GPIO_Port,PA10_Pin,GPIO_PIN_SET);
HAL_Delay(1000);
HAL_GPIO_WritePin(PA10_GPIO_Port,PA10_Pin,GPIO_PIN_RESET);
HAL_Delay(1000);
Amusing active high LED. What do you observe?
2024-11-19 04:08 AM - edited 2024-11-19 04:15 AM
PA10 BECOMES 1 BUT DOES NOT BECOME 0 AFTER 1 SECOND.
2024-11-19 05:02 AM
what is the value of the return code of HAL_InitTick()?
Have you tried the other startup file (.bak)? The modification may be incorrect. If interrupt vector table not correct interrupts can fire and call the wrong code.
Do you use some kind of bootloader? Did the original application use a different linker file? It seems you are using the default linker file.
2024-11-20 12:33 AM
I see you accepted a solution out of nowhere, but you didn't write a final post. I'd like to know what happened. Were you able to get systick working? Or did you get timer16 working?
If so why didn't systick work?
2024-11-20 01:03 AM - last edited on 2024-11-20 05:57 AM by MM..1
I apologize for not explaining. I'll explain it right away.
MCU was constantly resetting because WDT was unchecked = hw enabled in the options byte settings. It was due to my rookie mistake.
2024-11-20 01:08 AM
@XooM wrote:MCU was constantly resetting because WDT was disabled in the options byte settings. It was due to my rookie mistake.
Don't you mean enabled?