Wait but MCU is unblocked
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-17 6:02 AM - edited ‎2024-11-19 2: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.
- Labels:
-
STM32F0 Series
-
SysTick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-19 3: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.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-19 3: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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-19 3:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-19 3:54 AM
can you set it up and send it to me.
I'm so confused..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-19 4: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?
- Pin is set high and LED turns on? If not then it doesn't reach the first statement and the issue is not HAL_Delay()
- Pin set high but never turned low? Then HAL_Delay takes infinite amount of time or very long. Try using a smaller delay in case it is very slow. If it still doesn't turn off, then HAL_Delay is indeed an issue.
- LED blinks so fast it appears dimmed, Then HAL_Delay takes too short an amount of time.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-19 4:08 AM - edited ‎2024-11-19 4:15 AM
PA10 BECOMES 1 BUT DOES NOT BECOME 0 AFTER 1 SECOND.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-19 5: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.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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?
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-20 1:03 AM - last edited on ‎2024-11-20 5: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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-20 1: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?
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.
