Support for using the ATmega1284P as standalone board. More...
Support for using the ATmega1284P as standalone board.
As the ATmega1284P can run from the internal oscillator, placing it on a breadboard, connecting an USB-UART adapter and power is enough to run RIOT on it. (An ISP programmer will be needed to program it; or to program a bootloader to subsequently allow programming via UART.)
|Vendor||Microchip (previously Atmel)|
|Frequency||8MHz (up to 20MHz with external clock)|
|Timers||3 (2x 8bit, 1x 16bit)|
|ADCs||6 analog input pins|
|I2Cs||1 (called TWI)|
|Vcc||2.7V - 5.5V (when clocked at 8MHz)|
The pinout image was posted in the Arduino Forum. All credit goes to its poster, hansibull.
The ATmega1284P has two internal oscillators clocked at 8MHz and at 128kHz that allow it to be operated without any external clock source or crystal. By default the fuses are configured to use the internal 8MHz oscillator, but the
CKDIV8 fuse is set, so that the clock is divided down to 1MHz. By disabling the
CKDIV8 fuse the clock will operate at 8MHz. This is highly encouraged, and can be done with:
dragon_isp with the programmer you are using. The -B 32 might be needed for some programmers to successfully communicate with ATmegas clocked at less than 2MHz. It will no longer be needed after disabling
By setting the environment variable
ATMEGA1284P_CLOCK to a custom frequency in Hz (e.g.
1000000 for 1MHz), this core clock can be changed easily. Refer to the datasheet on how to configure the ATmega1284p to use an external crystal, an external clock source or the clock divider.
A higher supply voltage results in a higher current drawn. Thus, lower power consumption can be achieved by using a lower supply voltage. However, higher clock frequencies require higher supply voltages for reliable operation.
The lowest possible supply voltage at 8 MHz is 2.7V (with some safety margin).
In order to flash the ATmega1284P without a bootloader, an ISP programmer is needed. Connect the programmer as follows:
avrdude needs to be installed. When using the AVR Dragon for programming, running
make BOARD=atmega1284p flash
will take care of everything. To use the programmer
<FOOBAR> instead, run
make BOARD=atmega1284p PROGRAMMER=<FOOBAR> flash
Connect a TTL adapter with pins 14/RXD0 and 15/TXD0 an run
make BOARD=atmega1284p term
Please note that the supply voltage should be compatible with the logic level of the TTL adapter. Usually everything between 3.3 V and 5 V should work.
|Board specific definitions for the standalone ATmega1284P "board". |
|Peripheral MCU configuration for the ATmega1284p standalone "board". |