Earlier quoted context omitted.
if you have an OS, yes
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.
How to flash an LED: writing ARM assembly for an STM32 microcontroller
21–30 of 68 posts
Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller
#22Earlier 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?
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...
Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller
#23Is there a better way to sleep/delay other than what basically seems like 100% CPU usage in a subtraction loop?
Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller
#24Earlier 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?
Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller
#25Is there a better way to sleep/delay other than what basically seems like 100% CPU usage in a subtraction loop?
Jokes aside one of the easiest ways (for developer) to do so is just run JS on it since it have sleepy event loop built in. Works wonderfully with Espruino. So sad that it is not as widespread as should be.
Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller
#26Earlier quoted context omitted.
I don't have experience with this, but from talking to people who do, there are indeed open source implementations. They say the documentation is a bit confusing, but it does describe everything. This Rust library is an abstract USB library that can implement CDC serial https://docs.rs/usb-device/0.2.5/usb_device/ , and this library connects it to the STM32 USB peripheral https://github.com/stm32-rs/stm32-usbd Exampl…
those open source libs use undocumented regs documented and thus are based on STM lib. License in question thus
Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller
#27Earlier quoted context omitted.
I don't have experience with this, but from talking to people who do, there are indeed open source implementations. They say the documentation is a bit confusing, but it does describe everything. This Rust library is an abstract USB library that can implement CDC serial https://docs.rs/usb-device/0.2.5/usb_device/ , and this library connects it to the STM32 USB peripheral https://github.com/stm32-rs/stm32-usbd Exampl…
those open source libs use undocumented regs documented and thus are based on STM lib. License in question thus
Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller
#28Is there a better way to sleep/delay other than what basically seems like 100% CPU usage in a subtraction loop?
Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller
#29Earlier quoted context omitted.
Isn't that what an OS would do, essentially?
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...
Re: How to flash an LED: writing ARM assembly for an STM32 microcontroller
#30Anybody 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…