rogerclarkmelbourne / Arduino_STM32

Arduino STM32. Hardware files to support STM32 boards, on Arduino IDE 1.8.x including LeafLabs Maple and other generic STM32F103 boards
Other
2.52k stars 1.26k forks source link

Setting GPIO speed / Drive Strength / Slew Rate for F1 #803

Closed orkunkilinc closed 3 years ago

orkunkilinc commented 4 years ago

Hi all,

To avoid EMC/EMI problems and glitches on the SPI slave I want to reduce drive current of the GPIO on the STM32F103ZCT6.

I can confirm that reducing slew rate definitely fixes the problem but the functions to change it are not implemented on this core.

I basically want to change the correct register to reduce GPIO speed to 2MHZ with something like this. This is how it's done in STM32 Standart Peripheral Library.

GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;

Thank You.

stevstrong commented 4 years ago

It is not clear how you set the output drive current on a SPI slave interface, because the slave only receives signals, and does not generate any.

For master SPI you can use the following function:

gpio_set_mode(GPIOx, bit_nr, (GPIO_CR_CNF_OUTPUT_PP | GPIO_CR_MODE_OUTPUT_2MHZ));

wherein

stevstrong commented 3 years ago

Closed due to lack of activity from OP.