2015-07-03 05:14 AM
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!! mnemxys2015-07-03 06:58 AM
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.2015-07-10 07:20 AM
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