Delay, multi milliseconds, on the STM32F0, again..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-12 10:51 AM - last edited on ‎2024-11-12 2:04 PM by Tesla DeLorean
where I wrote it among the codes.. // Here I have to wait 500ms.
Can you help me to prevent the timers from being affected by this wait?
Can you give me the codes that I will add. Because I am very confused..
I tried many things but they all stopped the interrupts..
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
if(htim->Instance==TIM1)
{
if(input1==0)
{
HAL_GPIO_WritePin(GPIOA, GPIO_Pin_1, GPIO_PIN_SET);
// Here I have to wait 500ms.
HAL_GPIO_WritePin(GPIOA, GPIO_Pin_1, GPIO_PIN_RESET);
}
}
Solved! Go to Solution.
- Labels:
-
STM32F0 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-17 12:37 AM
You must not have read the last sentence in the Wiki? It says you need to add a call to TimerCallbacktick. You should have a file stm32fxxx_it.c in the src folder that has the SysTick_Handler
void SysTick_Handler(void)
{
/* USER CODE BEGIN SysTick_IRQn 0 */
/* USER CODE END SysTick_IRQn 0 */
HAL_IncTick();
/* USER CODE BEGIN SysTick_IRQn 1 */
TimerCallbackTick(&timerCallback);
/* USER CODE END SysTick_IRQn 1 */
}
Yes, the Timercallback.c/h can be used for any microcontroller. You're not limited to the Systick at 1ms.
You could also create a Timer interrupt for 100us and use both Timercallback instances, one for 1ms, and the other 100us.
TimerCallback tutorial! | UART and DMA Idle tutorial!
If you find my solution useful, please click the Accept as Solution so others see the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-17 2:00 AM - edited ‎2024-11-17 2:00 AM
I guess I'm really ***. No matter what I do, it doesn't work.
TimerCallbackTimerStart(&timerCallback, PA10_Off, 500, TIMER_NO_REPEAT);
doesn't work..
PA10_off function doesn't work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-17 7:20 AM
Does PA10 turn on?
Attach your project
TimerCallback tutorial! | UART and DMA Idle tutorial!
If you find my solution useful, please click the Accept as Solution so others see the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-17 7:34 AM - edited ‎2024-11-17 10:08 AM
I couldn't do it with TimerCallback either
It didn't work like this either..
If PA2 is 0, PB14 should be 1 and PB14 should be 0 again for 500ms.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-17 9:01 AM
You uploaded the wrong project. It doesn't have the TimerCallback files.
TimerCallback tutorial! | UART and DMA Idle tutorial!
If you find my solution useful, please click the Accept as Solution so others see the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-17 10:07 AM - edited ‎2024-11-17 10:43 PM
Eklediğimde hata verdi. Dosyaları kaldırdım. Onları ekleyebilir misiniz? Onları ekleyip size tekrar haber vermeli miyim?
Bu projeye eklediğimde çok fazla hata alıyorum.
Ekledim ama sorunları çözemedim.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-17 10:23 AM
If you removed the files then how am i supposed to see what errors occurred?
TimerCallback tutorial! | UART and DMA Idle tutorial!
If you find my solution useful, please click the Accept as Solution so others see the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-17 2:16 PM
I added it in the message above and uploaded it again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-17 4:10 PM
Your project still looks the same. Your while loop is empty so not much is going to work.
Your project tree should look like this
You don't have GPIO set up correctly for the ones that use EXTI. Only the pins that you are polling use Input mode.
I highlighted from my IOC what it should be like.
The TimerCallback.c/h and PollingRoutine.c/h just drop in your project. The only thing you need to do is change the GPIO names i've used to the name you used.
TimerCallback tutorial! | UART and DMA Idle tutorial!
If you find my solution useful, please click the Accept as Solution so others see the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-11-17 9:59 PM - edited ‎2024-11-17 11:10 PM
