Leanpub Header

Skip to main content

Bare-Metal Rust on the nRF52840

A 10-Day Hands-On Guide to Embedded Systems Without an OS

This book is 100% completeLast updated on 2026-06-27

No RTOS. No dynamic allocator. No hand-waving. Just bare-metal Rust on the nRF52840 — from first flash to interrupt-driven concurrency in 10 days, with buildable code for every chapter.

Minimum price

$19.00

$29.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
WEB
APP
About

About

About the Book

**Bare-Metal Rust on the nRF52840** is a 10-day hands-on guide for embedded

engineers who want to understand what their microcontroller is actually doing —

without an RTOS in the way.

Each day introduces one concept, one working example, and four practice tasks.

You start by flashing a minimal program that does nothing (proving the toolchain

works), and finish by writing a multi-task concurrent application using Rust's

RTIC framework — with compile-time proof that there are no data races.

**What you will build:**

- A PAC-level LED blinker using direct register writes

- Type-safe GPIO with the nrf52840-hal's type-state pattern

- Accurate millisecond delays with the SysTick timer and HFXO crystal

- RTT logging with defmt — zero-allocation, zero-UART, streams through the

debug probe

- Hardware interrupts via the GPIOTE peripheral, using Rust's ownership model

to share state safely between main and the ISR

- A UART echo server over the DK's J-Link OB virtual COM port

- Independent hardware timers driving multiple LEDs at different frequencies

- A full RTIC application with hardware tasks, local resources, and shared

state protected by the priority-ceiling protocol

**Who this is for:**

- Embedded C engineers who want to evaluate Rust for their next project

- Rust developers who have never written firmware before

- Anyone who has used Zephyr or FreeRTOS and wants to understand what is

underneath the scheduler

**What you need:**

- A Nordic nRF52840 DK (~$40 USD) and a USB cable

- A Linux, macOS, or Windows PC

- Basic Rust familiarity (ownership, borrowing, structs) — no embedded

experience required

**Hardware:** Nordic nRF52840 DK (`nrf52840dk/nrf52840`)

**Toolchain:** Rust stable, probe-rs, nrf52840-hal 0.16, RTIC 1.1

Share this book

Author

About the Author

Jovin Basil

Electronics Design Enginnering Specialist with 10+ years of experience in electronics circuit design

Contents

Table of Contents

Bare-Metal Rust on the nRF52840

  1. A 10-Day Hands-On Guide to Embedded Systems Without an OS
  2. Copyright
  3. Preface
  4. How to Use This Book
  5. Part 0 — Rust Language Foundations
  6. Foundation 1 — Variables, Mutability & Basic Types
  7. Foundation 2 — Functions, Return Values & Expressions
  8. Foundation 3 — Control Flow
  9. Foundation 4 — Ownership: The Core Mental Model
  10. Foundation 5 — References & Borrowing
  11. Foundation 6 — The Slice Type
  12. Foundation 7 — Structs
  13. Foundation 8 — Methods on Structs
  14. Foundation 9 — Enums & Pattern Matching
  15. Foundation 10 — Option
  16. Part I — Foundation
  17. Day 1 — Toolchain Setup and First Flash
  18. Day 2 — Blinky with the PAC
  19. Day 3 — Blinky with the HAL
  20. Day 4 — SysTick and Real Delays
  21. Day 5 — Logging with defmt and RTT
  22. Part II — Hardware Interaction
  23. Day 6 — GPIO Input and Buttons
  24. Day 7 — GPIOTE Interrupts
  25. Day 8 — UART Serial Communication
  26. Day 9 — Hardware Timers
  27. Part III — Concurrency
  28. Day 10 — RTIC: Safe Concurrency
  29. Appendix A — Quick Reference
  30. Appendix B — Glossary
  31. What’s Next
  32. About the Author

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub