This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

UCD3138064: read after write issue

Part Number: UCD3138064

Hello,

If one global variable, for example MiscAnalogRegs.GLBIOVAL.bit.FAULT2_IO_VALUE, would be read in while loop and write in IRQ interrupt.

Then, it may occur read after write problem that the value of MiscAnalogRegs.GLBIOVAL.bit.FAULT2_IO_VALUE is not expected. 

Is there a good solution to avoid it?

  • There's no problem with one reading and the other writing. The only issue is if both levels are writing. The most efficient way to avoid this is to have only one level writing ever. If that's not possible, you can disable interrupts before the write in the background, and reenable them afterwards. Also note that bit operations are not atomic on the ARM 7, so if you write to any of the bits in the GLBIOVAL register, you run the risk of having a write in the interrupt overridden by a write in background. To avoid this issue, you can use other ways to control the bit. For example, the fault2 bit can also be controlled with the GIOREGS.