Skip to main content
LaurentLef
Associate III
June 23, 2022
Question

I would like to drive STM32L011D3 GPIO in output to "1" or "0" with a minimum of instruction. I think we need:1 LDR + 1 ORR or AND + 1 STR = 3 instructions and 5 cycles Is there a more cycle-efficient way to do this?

  • June 23, 2022
  • 2 replies
  • 1463 views

Is it possible to set an output to "1" or "0" with an instruction of one cycle?

This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
June 23, 2022

Do a singular write to the BSRR register rather than RMW the ODR one.​

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
waclawek.jan
Super User
June 23, 2022

Use hardware (e.g. timers) wherever possible.

Relationship between instructions and machine cycles is far from being straighforward.

JW