Skip to content

feat: add initial ATmega328P HAL support - #6703

Open
nursude355 wants to merge 4 commits into
embassy-rs:mainfrom
nursude355:feat/atmega328p-hal-upstream
Open

feat: add initial ATmega328P HAL support#6703
nursude355 wants to merge 4 commits into
embassy-rs:mainfrom
nursude355:feat/atmega328p-hal-upstream

Conversation

@nursude355

Copy link
Copy Markdown

Summary

Adds initial Embassy-compatible HAL support for the ATmega328P.

The implementation currently includes:

  • GPIO for ports B, C and D
  • Timer1-based Embassy time driver
  • blocking ADC, I2C, SPI and USART drivers
  • Timer0 and Timer2 PWM
  • bit-banged 1-Wire support
  • ATmega328P examples, including async blinky
  • 8 MHz and 16 MHz clock configurations

Current validation

  • Host cargo check passes
  • Clippy with warnings denied passes
  • All AVR examples pass cargo check for avr-none
  • 8 MHz and 16 MHz configurations compile

Remaining validation

  • Final linking with avr-gcc
  • Flashing and testing on real ATmega328P hardware
  • Peripheral hardware validation

This draft PR is also intended to request feedback on whether the HAL
should remain ATmega328P-specific or evolve into a broader embassy-avr
crate.

@embassy-bot

embassy-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

👋 Welcome, @nursude355, and thanks for opening your first pull request here!

If you haven't already, please give the contributor guide a read.

This pull request is a draft, so it isn't in the review queue yet. Mark it as ready for review when you'd like someone to look at it.

@nursude355
nursude355 marked this pull request as ready for review August 4, 2026 10:04
@leftger

leftger commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

I don't want to be a downer but the 328P is a significant departure from what Embassy currently supports. Cortex-M/Cortex-R/RISC-V are the common architectures. The 328P with 32KB of flash is absolutely tiny compared to what current microcontrollers offer. It's a 17-year-old device with decreasing use in industry. From a maintenance standpoint the ROI of bringing this into Embassy just isn't there. First and foremost probe-rs support for the ATMega328 is nonexistent. I'd consider debugger/flasher support before bringing this into Embassy.

@leftger leftger added kind-feature New feature or request kind-decision Topics that require a larger decision, or are a complex problem to solve labels Aug 4, 2026
@joelsa

joelsa commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

I'd also like to point to the following issues:

the existing naming schemes could give a hint towards answering this question:

This draft PR is also intended to request feedback on whether the HAL
should remain ATmega328P-specific or evolve into a broader embassy-avr
crate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind-decision Topics that require a larger decision, or are a complex problem to solve kind-feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants