The Uno R4 uses a different processor from the Uno R3, so libraries that touch AVR registers directly may not compile.
What the message means
Libraries written for the ATmega328P may use timers and registers that do not exist on the R4.
Fix it in this order
- Read the compile error. Messages that name registers or avr/ headers point to an AVR-only library.
- Check the Library Manager for a newer version, and the library page for supported boards.
- Look for an alternative library that lists the Uno R4.
- Select the correct board in the Boards Manager and install its core.
- As a last choice use an Uno R3 board for that project.
Why it happens
The Uno R3 uses an ATmega328P, an 8-bit AVR chip. The Uno R4 uses a different 32-bit Renesas processor. Libraries that reach into AVR registers or include avr/ headers depend on hardware the R4 does not have, so the compiler fails before the sketch can run. Most well-written libraries hide that hardware behind the Arduino API, which is why many still work across boards.
The compiler error is the best clue. Register names, timer macros or avr/ paths point to a hardware dependency, while a missing function or constant usually points to an older library version. Board support packages also differ in pin names and features, so a library may compile but behave differently. Checking the boards a library lists before installing it saves time.
If you see this, do this
| You see | Do this |
|---|---|
| Error mentions avr/ headers | AVR-only library. |
| Works on R3, fails on R4 | Processor difference. |
Confirm the fix
- Compile a blank sketch for the Uno R4 with the board selected. If it compiles, the toolchain is fine and the problem is the library.
- Open the library’s example sketch and compile it for the R4. If the example fails in the same way, that library is the cause.
- Search the library’s source for avr/ or register names with a text search. Any match confirms it depends on AVR hardware and needs replacing.
Common mistake: Many readers assume that a library that installs without errors will run on every Arduino board, when a library can install cleanly and still fail to compile for a different processor.
Related
library not found, board missing.
Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.
Why this happens
The Uno R3 uses an 8-bit AVR chip, the ATmega328P. The Uno R4 uses a 32-bit Arm Cortex-M4 chip from Renesas. They have different registers, timers and memory layouts. A library that writes to PORTB, DDRB or TCCR1A, or includes avr/io.h, talks directly to AVR hardware that is simply not on the R4, so the compiler stops.
Libraries that use only the Arduino functions, such as digitalWrite(), Wire and SPI, are portable because each board package provides them. That is why some libraries just work and others fail with errors about missing files or undeclared names. Some libraries also guard their AVR sections with checks on the architecture and work on other boards when updated.
How to confirm the cause
- Read the first error message, not the last. The first one names the file or symbol that broke the build.
- Search the library folder for avr/ and for register names such as PORTB, DDRB or TCCR. Matches mean the code is AVR-specific.
- Look at library.properties. The architectures line lists the supported cores. If renesas_uno is missing, the author has not declared support.
- Compile the library’s own example for the R4 with nothing else in the sketch. A failure there confirms the library is the cause.
- Check the library’s repository for a newer release or an issue about the R4.
Worked example
The first snippet is AVR-only. The second does the same thing for any board. The third shows how libraries separate the two cases.
// AVR-only: fails on the Uno R4
DDRB |= (1 << DDB5);
PORTB |= (1 << PORTB5);
// portable version
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
#if defined(ARDUINO_ARCH_AVR)
// register code here
#else
// portable code here
#endifIf you must keep an AVR-only library, build that project for an Uno R3 and keep the R4 for projects that use portable libraries.
Common mistakes
- Deleting include lines to silence the error without replacing what they provided.
- Assuming a newer library version always supports the R4.
- Choosing the wrong R4 board entry, such as Minima instead of WiFi, and chasing errors that come from the choice.
- Copying an old tutorial’s timer code, since the R4’s timers are different.
If this did not fix it
- Library depends on another library: install the missing dependency listed in its documentation.
- Old board package: update the Uno R4 core in the Boards Manager.
- Compiles but misbehaves: pin numbers or timing assumptions in the library may differ on the R4.