Skip to main content
deep_rune
Associate III
August 18, 2020
Solved

Fastest way to set output pin?

  • August 18, 2020
  • 3 replies
  • 1199 views

I have an interrupt which I'm trying to streamline (for an STM32F031K6). I am using some commands like

GPIOA->BSRR |= (1<<4);

and i was surprised to see how much there is in this command in the disassembly. Is there any faster way of implementing this?

This topic has been closed for replies.
Best answer by Tesla DeLorean

GPIOA->BSRR = (1<<4); // Singular write, as designed, not RMW

3 replies

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
August 18, 2020

GPIOA->BSRR = (1<<4); // Singular write, as designed, not RMW

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
TDK
Super User
August 18, 2020

There is never a need to read the BSRR register. It always reads as zero.

The current output state is given in the ODR register.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Uwe Bonnes
Chief
August 19, 2020

If you want to go fats, make sure GPIOA->BSRR is read from RAM, not Flash. Wait state to read that data may apply.

deep_rune
deep_runeAuthor
Associate III
August 19, 2020

interesting, how do i do that?