Board: Arduino Uno

Jose Alamos edited this page Aug 9, 2018 · 13 revisions

WARNING: This entry will be deprecated. All content has been moved to doc.riot-os.org

Overview

Arduino UNO

The Arduino Uno is one of the cheapest board to start and discover with electronics and embedded coding. It is based on Atmel's AVR architecture and sports an ATmega328p MCU. It is like many Arduinos extensible by using shields.

MCU

MCU ATmega328p
Family AVR/ATmega
Vendor Atmel
RAM 2Kb
Flash 32Kb
Frequency 16MHz
Timers 3 (2x 8bit, 1x 16bit)
ADCs 6 analog input pins
UARTs 1
SPIs 1
I2Cs 1 (called TWI)
Vcc 5.0V
Datasheet / Reference Manual Datasheet and Reference Manual
Board Manual Board Manual

Flashing the device

Flashing RIOT on the Arduino Uno is quite straight forward, just connect your Arduino Uno using the programming port to your host computer and type:

make BOARD=arduino-uno flash

This should take care of everything!

We use the open avrdude tool to write the new code into the ATmega328p's flash

Caution

Don't expect having a working network stack due to very limited resources.

Debugging

The ATmega328P uses debugWIRE instead of JTag. This could be used by a simple standalone software or using AVaRICE and GDB. The latter approach has more features, thus, this document focuses on this. The cheapest (sadly still about 60€) hardware adapter supported by AVaRICE is the AVR Dragon, hence, this document focuses on this.

Hardware Preparation

To automatically reset the Arduino UNO while programming using the USB connection (no external programmer), an capacitor is added to the REST pin. As debugWIRE uses the reset pin, this capacitor has to be disconnected. This can be done using the circuit board track on new Arduino Unos (or good clones), or requires desoldering or cutting of the capacitor on older boards (or less good clones).

Fuses

Fuse Default Value Debugging Value
Extended 0xFD 0xFD
High 0xDE 0x9E
Low 0xFF 0xFF

To enable debugging run:

avrdude -c dragon_isp -p m328p -U lfuse:w:0xff:m -U hfuse:w:0x9e:m -U efuse:w:0xfd:m

To restore the default fuse configuration (e.g. using an AVR Dragon) run:

avrdude -c dragon_isp -p m328p -U lfuse:w:0xff:m -U hfuse:w:0xde:m -U efuse:w:0xfd:m

Note that restoring the fuses takes a bit longer, as ISP functionality is not working when debugWIRE is enabled, as the RESET pin is not working as RESET pin. avrdude detects this and tries to temporarily disable debugWIRE by issuing a debugWIRE command. Afterwards ISP is working properly and debugWIRE is disabled. Don't forget to re-solder the capacitor to restore normal operation, otherwise you have to press the reset button manually while flashing.

Start On-Chip Debugging

Once the hardware is prepared, the fuses are configured to enable the debugWIRE interface, and AVaRICE is installed, simply type

make debug

in your application folder.

(NOTE: This is not yet working. I'll create a pull request adding this within the next few days)

Home

Supported platforms

Further Information

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.