Go Down

Topic: Partial writes to registers (Read 468 times) previous topic - next topic

indeed

Most (if not all?) of the SAM3X8E's memory-mapped registers are 32-bit. However, memory accesses of size 8 and 16 bits are also supported by the CPU. I am wondering if there are any issues associated with accessing, particularly writing, registers with memory operations of a smaller size?

For example, the SPI_TDR register is 32-bit, and upon writing, triggers an SPI transfer. Would writing, say, only half the register at once with a 16-bit access exhibit well-defined behaviour? I have tried it and it does seem to work, but I'm thinking that maybe one is supposed to only write to the entire register at once, especially considering the "special" behaviour of triggering the SPI transfer.

Sorry if this is a silly/trivial question, but low-level stuff can be funky, and to me it doesn't seem impossible that there would be some such requirement on register access.

ard_newbie


Did you read the detail of SPI_TDR on page 697 of Sam3x datasheet ?

indeed

Yes. As far as I can see it says nothing about partial writes.

Go Up