AVR (ATmega328P): UART/SPI HAL, drivers.zig, and nRF24L01+ driver (Emakefun RF-Nano V3.0)
Maintainers usually reply within 1 day
@matpala is already working on this.
Since Oct 8, 2026.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- zig
- Domain
- embedded-iot
Research direction
Start with the referenced ATtiny port (#947), the related issues #637 and #701, and the existing work listed in the body, especially draft #1070. The plan spans an ATmega328P HAL, adapters, timing, an nRF24L01+ driver with unit tests, and examples; first get maintainer feedback on the open API and hardware questions. Done means the proposed steps are accepted and implemented, including tested send/receive examples.
Written by the indexing model from the issue text.
Description
I'd like to add support for the Emakefun RF-Nano V3.0 (repo): an Arduino Nano clone (ATmega328P @ 16 MHz) with an onboard nRF24L01+ on the hardware SPI bus. I have the boards and test everything on hardware.
Already up: #1063 (blinky delay), #1064 (board), #1068 (.rodata in RAM, fixes #679), #1071 (GPIO read() fix) and #1070 (UART HAL, draft).
Plan, one PR per step, with HAL files under hals/atmega328p/ like the ATtiny port (#947):
- UART (#1070).
- SPI host HAL.
drivers.zigadapting the HAL toDatagramDevice,Digital_IOandClockDevice, like ch32v, plus a small Timer0-basedtime.zig.- An MCU-agnostic nRF24L01+ driver in
drivers/src/wireless, followingssd1306.zig, with unit tests. It polls STATUS, since IRQ isn't wired on this board. - Send/receive examples between two boards.
Note: on AVR, Zig 0.17.0 fails to compile some error unions with a payload (ziglang/zig#37099, fix pending). So for now there's no std.Io for the UART, and drivers can't use DatagramDevice.read.
Questions:
DatagramDevicehas no full-duplex transfer, so the STATUS byte the nRF24 sends back with every command is lost, and the driver needs an extra transaction to read it. Is that fine, or would you rather add atransceiveoperation (related to #637/#701)?ClockDeviceneeds a monotonicu64microsecond clock. I'd use the Timer0 overflow (4 µs ticks), with the HAL exporting theTIMER0_OVFhandler for the app to register. That takes over PWM on D5/D6. OK, or is there a preferred approach?- AVR GPIO uses
sbi/cbi, which need comptime operands, so theDigital_IOadapter would be one type per comptime pin (e.g.GPIO_Device(.d, 7)). OK?
Is the nRF24 driver welcome in drivers/? Any feedback is appreciated!
- Dominant language
- Zig
- Stars
- 2.3k
- Forks
- 198
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 23
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ZigEmbeddedGroup/microzig
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
ZigEmbeddedGroup/microzig#1086 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 69/100
ZigEmbeddedGroup/microzig#1085 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
ZigEmbeddedGroup/microzig#1061 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
ZigEmbeddedGroup/microzig#1059 · 1 comment ·
Maintainers usually reply within 1 day
-
regz: AVR peripherals generated at address 0 when the register-group name matches the module (ATDF)Possibly taken @matpala claimed this 3 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 48/100
ZigEmbeddedGroup/microzig#1072 ·
Maintainers usually reply within 1 day
All issues in ZigEmbeddedGroup/microzig
Similar issues
-
Examples say cnxOpendocumentation embedded
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
rusefi/rusefi#10401 · 3 comments ·
Maintainers usually reply within 1 day
-
[BUG] SOLE B94 (current model): Set Target Resistance Level rejected with 80 04 03 – bike expects 0.1 unitsPossibly taken @cagnulein claimed this 1 day ago. Open
Difficulty 2/5 Half a day Newbie friendliness 78/100
cagnulein/qdomyos-zwift#5380 · 1 comment ·
Maintainers usually reply within 1 day
-
Fw::Time::add(F64) asserts when the fraction rounds up to a full second and the time already holds 999999 microsecondsPossibly taken @auraseb claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100