STM32F 103 SysTick ve Uart Interrupts
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-11-29 12:38 AM
Posted on November 29, 2012 at 09:38
Hello everybody,
I have a problem. I'm using STM32f103rbt6. I'm using SysTick and USART interrupts. They are working independently. SysTick is used for Delay operation. But in a case, I must use this Delay function in USART interrupt service routine after I have received my all bytes. But in this case, Systick_Handler function doesn't work and don't change my timing variables. How can I overcome this problem and how can I use this function in each?Thank you very much...
This discussion is locked. Please start a new topic to ask your question.
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-11-29 12:54 AM
Posted on November 29, 2012 at 09:54
Unless you know exactly what are you doing, it is a BAD IDEA to use any delay in an ISR. (But if you know exactly what are you doing, you wouldn't be asking here...)
Instead, set a flag in the UART ISR indicating to the main loop that delay is needed, and then process it in the main loop. JWOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-11-29 4:00 AM
Posted on November 29, 2012 at 13:00I know it is not good idea and in first i did it. But i have 25 seconds delay and in this process my usart received data and I must process it. But in my main function code is already and i can't process it. and also every 1 second period usart receive data. How can I process it?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-11-29 4:47 AM
Posted on November 29, 2012 at 13:47
Sounds like you want to be buffering and queuing data so you can come back and process it later. ie you have a state machine that exits immediately if a delay is required, and is called later (1ms, 1s, whatever)
If you absolutely must have a small delay watch a free-running timer register (TIM or CYCCNT) tick, and wait for it to span a particular period. This probably won't help if you remain in the interrupt for a long time, as nothing else will happen in your system, so no real work will get done.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
