cancel
Showing results for 
Search instead for 
Did you mean: 

If the specifications say register access have to be word size, does it mean byte size doesn't work?

WOGoos
Associate II

Hi

I program a STM32F103 chip and work on a GPIO driver. The specs tells you clearly: The peripheral registers have to be accessed by words (32-bit) 9.2 GPIO registers RM0008.

It doesn't use the word must be accessed. (Im planning to use the specification as must as I can by the way)

Does this means that byte access is still possible for certain chips or certain chip designs.

I did a test and saw that byte access on the GPIO->CRL and GPIO->CRH registers doesn't generate strange result.

Anyone who can say something about this have to access or must be access of registers

3 REPLIES 3

Why would you want a different access to GPIO registers than word-wise?

> I did a test and saw that byte access on the GPIO->CRL and GPIO->CRH registers doesn't generate strange result.

How exactly did you test that?

Do you have a genuine STM32F103, or a clone? Clones may behave differently.

JW

gbm
Lead III

Non-full register access may yield strange results. I would not be surprised if byte access actually accessed the whole register with random (or may not so random, like all 32-bits of a source CPU register) value being written to the "other" bits.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
Andreas Bolsch
Lead II

GPIOs are connected via APB2 bus, and regarding the AHB/APB bridges, the RM states:

"When a 16- or 8-bit access is performed on an APB register, the access is transformed into a 32-bit access: the bridge duplicates the 16- or 8-bit data to feed the 32-bit vector."

Furthermore the GPIO description 9.1, bottom on p. 159 in Rev. 19, *explicitly* says that half-word or byte accesses are not allowed. Probably there are no individual byte strobe signals.