Live data from Hacker News

How to flash an LED: writing ARM assembly for an STM32 microcontroller

mcla.ug

41–50 of 68 posts

Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller

#41
post #18

Earlier quoted context omitted.

You don't need an OS to do more advanced or efficient sleeping. You could have one of the timer peripherals generate an interrupt on a regular basis, and then put the chip in a lower power sleep mode in between interrupts.

Isn't that what an OS would do, essentially?

There is a blurry line on the edges of "library" and "OS"; most people would put this particular example on the "library" side.

Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller

#42
post #20

Earlier quoted context omitted.

The other approach to delay's (keep in mind, that there is no other process to yield the CPU too) is to use a timer (a peripheral of the micro controller). This would take a fair bit more code to configure the timer, and setup an interrupt to handle the timer.

How do multiple processes usually 'share' a timer?

Microcontrollers (assuming no RTOS in use), typically don't have multiple processes, they have the main thread of execution (which in the article is the entire program) and have interrupt routines that a run in response to an external event (in this case, the timer has expired).

Using the interrupt driven approach, can led to better performance both in CPU time (async communication with slower periphials etc) and battery life (sleep states).

Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller

#43
post #40
post #39

Earlier quoted context omitted.

Avoid ST at all costs in my experience. Their documentation is terrible. They never acknowledge hardware errata even after clear evidence of it. They’re not a company with a solid engineering culture imo

Which MCU makers do you prefer?

Atmel (now under Microchip). They have great documentation and software libraries. And they actually acknowledge hardware errata in the documentation.

Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller

#45
post #39
post #3

Earlier quoted context omitted.

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…

Avoid ST at all costs in my experience. Their documentation is terrible. They never acknowledge hardware errata even after clear evidence of it. They’re not a company with a solid engineering culture imo

I'm really surprised to hear that. ST has always been one of my favorite manufacturers. I find their datasheets to be clear and well laid out, though I will note that I'm usually more interested in the hardware side than the software side. Their chips and boards are also high quality and convenient, e.g. GPIOs are often five-volt tolerant, Nucleo boards come with well-made breakout headers and several peripherals (at seemingly impossibly low cost), chips have wide supply voltages, etc. I can't say I know anything about their errata (I've never run into any), but even if the situation is as bad as you say, that's quite a harsh condemnation, especially considering how widely-used and successful they are in industry. Do you have other complaints?

Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller

#46
post #43
post #40

Earlier quoted context omitted.

Which MCU makers do you prefer?

Atmel (now under Microchip). They have great documentation and software libraries. And they actually acknowledge hardware errata in the documentation.

I used a SAMD21 for my latest project and I was definitely impressed with it versus STM32s.

I will say that STM has definitely released better tools that make it much easier to get designs up and running (STM32Cube specifically).

Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller

#47
post #43
post #40

Earlier quoted context omitted.

Which MCU makers do you prefer?

Atmel (now under Microchip). They have great documentation and software libraries. And they actually acknowledge hardware errata in the documentation.

And they actually acknowledge hardware errata in the documentation.

More so for Microchip than Atmel --- it's pretty common to find on some of their newer and more complex parts a ton of errata, among which there are some extremely "WTF!?" ones like "feature X does not work at all".

Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller

#48
post #39
post #3

Earlier quoted context omitted.

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…

Avoid ST at all costs in my experience. Their documentation is terrible. They never acknowledge hardware errata even after clear evidence of it. They’re not a company with a solid engineering culture imo

can confirm. found multiple issues around SDRAM interface in STM32f429, only some are in the errata doc

Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller

#49
post #35

This was a really interesting article, and I learned a lot. I'm very much lacking in chip/assembly level knowledge, and this helped me to understand a little bit more. Thank you, Lochsh, for writing it!

This is lovely to hear, I'm so glad it was helpful!

Not too familiar with the content of your post, but...I love your site design - great use of space, color & serif fonts!

Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller

#50
I did something similar with CMake and a lot of the details are incredibly challenging to piece together. Everyone just blindly copies existing linker/startup scripts. Very low level articles like this are rare and invaluable

I spent a month and got things working with a modern toolchain C/CMake/GCC/OpenOCD but gave up on further work bc I couldn't nail down a lot of details. micro programming outside arduino is painful and backward. it's stuck in the 90s

https://geokon-gh.github.io/bluepill/

Post reply on HN