Bit Band operations with ARM Cortex microcontrollers

I got few questions from our readers about bit-band feature in ARM Cortex microcontrollers. This seems to be so obvious but also may lead to come confusion while using bit-banding. So let’s look at this feature a little bit closer. Why use bit band Simply speaking Bit banding method allows to perform atomic bitwise operations to memory areas. Why use bit banding? The simplest answer is because ARM Cortex doesn’t have something like BIT CSET or BIT CLEAR commands like most of 8-microcontrollers do. So this is somewhat a work around solution. Another question may rise – Why not using read-modify-write method? Again this method is not reliable in some cases. For instance f there is an interrupt during this operation it can cause data corruption. Other situation may occur in embedded OS when different tasks may modify same memory location. So we want a method that allows to set…

Continue reading