|
|
|
|
|
by digitaltom
2264 days ago
|
|
Fantastic article, thanks for taking the time to write it up! I'm trying to learn about embedded systems at the moment and it feela like a super steep learning curve, really appreciate your post breaking everything down. A little typo I think I spotted:
' So, to turn on our LED we want to set the BR8 field, and to turn it off, we want to set the BS8 field.' Should this be: ' So, to turn on our LED we want to clear the BR8 field, and to turn it off, we want to set the BS8 field. ' |
|
This isn't a typo, actually. If you look at the documentation of the BSRR register (which is screenshotted in the blog post), it says of BRy:
> These bits are write-only [...] [Setting to 1] Resets the corresponding ODRx bit
So setting BR8 in the BSRR clears the ORD8 bit in the output data register. Because our LED is active low, this turns the LED on.
The indirection can make this a little confusing, I hope this cleans it up!