You are on page 1of 1

ATmega4809 Xplained Pro demo program

(C) 2018 Copyright Pavel Haiduc, HP InfoTech Srl, www.hpinfotech.com

The program demonstrates:


- Clock divisor initialization
- I/O port initialization
- Timer TCA0 initialization and operation
- USART1 initialization and communication
- TWI0 initialization as master
- DS3231 RTC library functions
- SPI0 initialization and communication
- EEPROM access.

It requires an Atmel ATmega4809 Xplained Pro development board


and a DS3231 Arduino shield.
The ATmega4809 fuse bytes are programmed so that it runs
at 16MHz from the internal RC oscillator.

Connections:
Xplained Pro DS3231 shield
EXT1 pin11 (PC2) - SDA
EXT1 pin12 (PC3) - SCL
EXT1 pin19 (GND) - GND
EXT1 pin20 (VCC) - VCC

The program outputs USART1's data using the CDC serial port
emulated by the EDBG interface present on the Xplained Pro board.
This data will be displayed in the Tools|Terminal program
present in the CodeVisionAVR IDE.

The Terminal must be configured using the Settings|Terminal menu:


- Port: COM port emulated by the Xplained Pro
- Baud rate: 9600
- Data bits: 8
- Stop bits: 1
- Parity: None
- Emulation: TTY
- Handshaking: RTS/CTS

The data transmitted by the SPI0, every 100ms, can be watched


with a scope on Xplained Pro's pin PA4 (MOSI signal).
The SPI0 SCK signal is present during transmission on the
PA6 pin.

Notes:
- Please make sure that the Atmel EDBG programmer is selected
in the Settings|Programmer menu of the CodeVisionAVR IDE
- Usage of the EDBG programmer requires that Atmel Studio 7
is installed.

You might also like