Stop code execution during 8 timer interrupts
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-07-03 5:14 AM
Posted on July 03, 2015 at 14:14
Hi everyone,
I'm working with the stm32f405 microcontroller and I am trying to send some characters using a simple GPIO pin. My problem is that I have to send each bit of one character every 20ms. For that I use a timer interruption. In this case, every 8 executions of the interrupt I will have sent a complete character and I can start sending the next one. The problem is that I have to wait until 8 interruptions have execute or the code continues executing between interruptions and the character value will change. Therefore, I would need to stop the code durint 8 interruptions. To do that, I use a counter into the interruption and a while(counter < 8); in my main code but nothing happens. The code executes entirelly before the interrupts and only can send the last character. What could I do to stop the code during 8 interruptions? I hope you can help me. Thank you very much in advance. Regards!! mnemxys
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-07-03 6:58 AM
Posted on July 03, 2015 at 15:58
Couldn't you just buffer the data properly so this doesn't happen?
Have the interrupt pull it's OWN copy of the data every 8 cycles, and have a FIFO (Ring) Buffer hold the subsequent character(s). Have the filling side check if it's FULL, and spin in a loop until the interrupt frees up space.
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..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-07-10 7:20 AM
Posted on July 10, 2015 at 16:20
Oh, Clive1, I forgot to answer you. I finally did as you adviced me and now I have my code working smoothly although I'm having other problems, but that's another story.
Thank you very much for your help. mnem