cancel
Showing results for 
Search instead for 
Did you mean: 

GPIO speed settings

matic
Associate III
Posted on June 16, 2016 at 08:28

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?

Thanks
1 REPLY 1
Posted on June 16, 2016 at 09:04

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