2016-06-15 11:28 PM
Hi.
I would like to ask if speed setting of a pin in GPIO->OSPEEDR register is relevant also if a pin is configured in input/alternate mode? Or is this setting relevant only for output mode? I am asking specifically for SPI clock pin, which has an alternate function mode. Should I set it to high speed or leave it on default low speed? Thanks2016-06-16 12:04 AM
OSPEEDR is relevant to the output driver, regardless of whether it's set as explicit general-purpose output, or if it is and AF-driven output. It does not influence inputs, neither general-purpose nor AF.
Speed is a misleading term here. I'd prefer ''drive'' or ''slew rate'', but I am not ST. SCK is a particular case. Note that the DS for some (if not all) STM32 models gives characteristics for SPI signals only for a particular OSPEEDR setting. Also from posts on this forum it appears, that setting SPI signals (particularly SCK) to low OSPEEDR setting may result in incorrectly clocked SPI (''MSB/LSB swap''). Otoh, highest OSPEEDR settings may result in multiple edges being detected due to reflections/ringing on unmatched longer lines, dependent on your particular setup/layout. JW