How to flash an LED: writing ARM assembly for an STM32 microcontroller
51–60 of 68 posts
Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller
#52Earlier quoted context omitted.
Oh actually I was being sleepy and hadn't understood what you'd said! I hadn't realised you could do that actually, neat, thanks! So you could do `mov r1, #0x01000000` right? nice.
yup, some other constants are also loadable in one instr, of the form 0xXX00XX00, 0x00XX00XX, 0xXXXXXXXX where XX is any byte
Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller
#53A 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. '
Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller
#54Anybody got USB communication (CDC class) working on this platform without the proprietary libs?
no, i spent months on this, and the answer is no They use IP from synopsis, but synopsis refuses to allow their docs to be published so every manufacturer has to read them and regurgitate them into their own docs in their own words . In any case official STM docs are incomplete. See their driver source - it accesses undocumented registers and sets undocumented bits in documented regs. Without them the usb core will n…
Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller
#55Earlier quoted context omitted.
Yes, probably! But you can do it yourself without one. Here is an example in C using libopencm3, that uses timers to trigger an interrupt used to flash LEDs https://github.com/libopencm3/libopencm3-examples/tree/maste...
that is basically a mini-os :)
Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller
#56Fantastic 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 th…
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!
Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller
#57Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller
#58It was a very frustrating experience, but articles like this make me want to dive in and try again!
Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller
#59I have years of experience in asm programming with PIC processors, and my job is embedded software development. I got an STM32 development board a couple years ago to get my feet wet in ARM embedded development. I got completely bogged-down in setting up the development environment. It took me forever to get a blinking LED, and I spent an ungodly amount of time unsuccessfully trying to figure out how to change the ra…
It will even spit out multiple project types - everything from ARM Keil/MDK/uVision to just a simple makefile.
Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller
#60Fantastic 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 th…
Thank you for the compliment ^_^ I'm glad you found the post helpful. 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…
Do you happen to know of any great learning resources, basically more posts like you've written that go into lots of details and explain why things are done?
Thanks again!