cancel
Showing results for 
Search instead for 
Did you mean: 

Fastest way to set output pin?

deep_rune
Associate III

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?

1 ACCEPTED SOLUTION

Accepted Solutions

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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

4 REPLIES 4

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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
TDK
Guru

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
Principal III

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

interesting, how do i do that?