Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

Ringbuffer - how do I identify "crititcal" sections

$
0
0

Hello,

 

the last two days I've implemented a portable ringbuffer for use with UART, SPI or even different microcontrollers (minor changes required). 

I grabbed some ideas from here and there and mixed it all together in my own solution. 

I tested the functionality with some code that writes in unregular time distances into the buffer while the SPI TX interrupt is reading from it.

It _seems_ to work well, but a friend of mine told me I definately have to deactivate the interrupt in "critical sections" of my code.

Now I'm a little bit stuck. How do I identify what a critical section is? I don't want you guys to review my code. I just wanted to ask if there's a general approach on identifying such possible problems. My friend also said I should draw a timing diagram on what's going on, but again, I have no idea how you do that.

Any advice?

 

Best regards,

Leo


Viewing all articles
Browse latest Browse all 2077

Trending Articles