I see some code which are going to read/write some peripheral registers. I see the write operations are all followed with some delays. It seems to me that SW needs to wait for the value takes effect on HW. Some web page say register will get update every clock cycle. I guess that's the reason for waiting. Well, my questions are:
- Does read operation needs such delay as well? If yes, when SW wants to read/write one register, what's the correct sequence to do so? Like
[DELAY]
tmp=some_register //read
some_register=tmp+1 //write
[DELAY]
or
tmp=some_register //read
[DELAY]
some_register=tmp+1 //write
[DELAY]
What if SW don't have such delay after writing operation? I actually see some write operation without that delay can works properly on some slower CPU. But when the code is running at some faster CPU, it fails. I think the delay is reasonable. I just need a explaination why it works for slower CPU.
I'm not very familiar with functionality of register. Any helpful materials or links?