Hacker Newsnew | past | comments | ask | show | jobs | submit | eldruin's commentslogin

A couple of years ago I wrote a MIDI player with a bluepill board (STM32F1 microcontroller) and a waveform generator (AD9833) in Rust. It was actually quite simple and a lot of fun to write (and hear!).

Video: [1]

Source code: [2]

[1]: https://blog.eldruin.com/ad983x-waveform-generator-dds-drive...

[2]: https://github.com/eldruin/driver-examples/blob/master/stm32...


Looks great! Once you publish the code, please submit it to the Rust Embedded Showcase :)

https://showcase.rust-embedded.org/


For those getting a 404, here the article in MarkDown: https://github.com/RustMagazine/rustmagazine/blob/main/conte...


In Rust there is https://embassy.dev which is an async Rust framework for embedded. It has been shipping in products for years. Can be made real-time (for some definitions of it).

There is also RTIC https://rtic.rs which is a concurrency framework for real-time systems using interrupts. IIRC the car industry is interested in it.


Very interesting projects.

Looking at the documentation and Github pages it's not very clear if ATmel, the microcontroller family for Arduino, is supported at all or not.

Do you have a link where this is validated?


There are several microcontroller architectures within the Arduino family officially as well as compatible ones that are also called Arduino-something.

The classic (and oldest) are the AVR microcontrollers (ATmega), which are not supported by embassy nor rtic at the moment AFAIK. They are supported by Rust, though. see: https://github.com/rahix/avr-hal.

However, there are several other Arduino microcontrollers that are supported. For example the Arduino Nano RP2040, Arduino Nano 33 BLE (nRF), the Arduino MKR ones as well as the STM32duino (STM32F103, the one in the hugely popular $2 blue-pill boards) are all based on the ARM cortex-m architecture, which is supported by both embassy as well as rtic.

For espressif chips (like the esp32), support is being worked on by the manufacturer itself: https://github.com/embassy-rs/embassy/issues/745

Here an overview of microcontrollers in the (official) Arduino family: https://www.makeuseof.com/exploring-different-types-of-ardui...


You can have a look at https://embassy.dev Rust+async on embedded


Here a whole bunch of example programs for hardware device drivers written in Rust for use in embedded.


https://blog.eldruin.com I blog mostly about embedded Rust device drivers. It is a static blog made with Hexo and deployed to GitHub pages.


Are you looking specifically at AVR? ARM works out-of-the-box with stable Rust.

I can really recommend getting a micro:bit board and following the discovery book [1].

There are a few other books in the embedded Rust bookshelf [2].

Otherwise, I wrote a bunch of sensor drivers and simple examples for several boards: [3]

[1]: https://docs.rust-embedded.org/discovery/index.html

[2]: https://docs.rust-embedded.org/

[3]: https://github.com/eldruin/driver-examples


I mainly have ATTinys and ESPs, both of which kinda-maybe work but are hard to get started with. I'll look at your examples, thank you!

I might also play with ARM a bit, I have a few black pills that hopefully will be easier to get started with, now that I think about it.


You may have started getting deprecation warnings because some methods in the `Error` trait have been deprecated [1] in favor of a different mechanism.

Then, you may have configured warnings to result in compilation errors in your build/project, however, I would argue this situation is not what most people would understand as "code not compiling due to a compiler update".

[1]: https://doc.rust-lang.org/std/error/trait.Error.html


In my case it failed to build, maybe it was a different problem, maybe the compiler had at some point emitted errors instead of warnings.

I don't remember and it doesn't really matter other than we had build issues and it was unexpected.


Deprecation should be the only change to Error in the last six years. It hasn’t moved. If you ever get a repro would love to hear about it! This kind of thing doesn’t happen at the scale we’re at anymore, if it did there would be an uproar.


That's a way to avoid complicated coordinated upgrades across the ecosystem if certain conditions are met. It's called the "semver-trick" [1].

[1]: https://github.com/dtolnay/semver-trick


Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: