/PM-Board

Embedded development board with ATmega324P

GNU General Public License v3.0GPL-3.0

PM-Board

Embedded development board with ATmega324P

This is a development board supporting the ATmega324P microcontroller. It is fully Arduino-compatible and it comes with the following features:

  • LSM9DS0 9-axis inertial sensor (accelerometer, gyroscope and magnetometer)
  • MPL3115 baro-altimeter sensor
  • Ambient temperature and light sensors
  • 128x160 ST7735 color LCD display with SD card reader
  • RGB LED
  • 16x02 character LCD display
  • GPIO LEDs and pushbuttons
  • JTAG and ISP connectors
  • USB programming and data interface

Repository Contents

  • /Hardware - Eagle design files (.brd, .sch)
  • /Images - Board images
  • /bin - Binaries (board bootloader)

Programming

avr-gcc & Makefile

Bootloader

The board comes pre-loaded with a bootloader. If you need to re-write it, connect an AVR-ISP or JTAG to the corresponding port and burn the bootloader .hex file with atmega324p as a target and the following fuse settings:

Fuse Value
HIGH 0xDA
LOW 0xD7
EXT 0XFD

Writing a simple Hello World

Install avr-gcc on your machine. There are various tutorials on how to do this. Here are some examples, depending on your OS type:

Copy this code into your favourite code editor and save the file as "hello.c":

#include <avr/io.h>
#include <util/delay.h>
 
int main() {
	/* Setting PC0 as output */
	DDRC |= (1 << PC0);
 
	while(1) {
                /* Toggle pin state */
		PORTC ^= (1 << PC0);
 
                _delay_ms(500);
	}
 
	return 0;
}

To build and upload, you can use the following Makefile. Edit the port to correspond with your OS and serial port name:

# Linux
PORT ?= /dev/ttyUSB0
# Windows
# PORT ?= COM1
 
all: hello.hex
 
hello.hex: hello.elf
	avr-objcopy  -j .text -j .data -O ihex $^ $@
	avr-size hello.elf
 
hello.elf: hello.c
	avr-g++ -mmcu=atmega324p -DF_CPU=12000000 -Os -Wall -o $@ $^
 
upload: hello.hex
	avrdude -c urclock -P $(PORT) -b 57600 -p atmega324p -D -xnometadata -U flash:w:$<:a
 
clean:
	rm -rf hello.elf hello.hex

From your command line call > make all (generates hello.hex) and then > make upload.

Arduino

The board can be programmed using Mighty-Core.

Follow the "How to install" guide on their github page and use the following settings when burning the bootloader and uploading a sketch:

Board Pinout

LCD Displays

Character LCD GPIO Pin Arduino Pin Graphical LCD GPIO Pin Arduino Pin
RS PC0 16 CS PB0 0
RW PC1 17 RST PB1 1
EN PC2 18 A0 PB4 4
D4 PC3 19 SDA PB5 5
D5 PC4 20 SCK PB7 7
D6 PC5 21 Backlight PA7 31
D7 PC6 22
Backlight PC7 23

I2C Sensors & Bus Addresses

 I2C  GPIO Pin   Arduino Pin     Chip   Address 
 I2C Enable   PA6  30    LSM9DS0   0x1D (XM) 0x6B (G)
 SCL   PC0   16    MPL3115A2   0x60 
 SDA   PC1   17       

SD Card

     GPIO Pin   Arduino Pin 
 CS  PA2  26
 MOSI   PB5   5 
 MISO   PB6   6 
 SCK   PB7   7 

RGB LED

GPIO Pin Arduino Pin
Red PD5 13
Green PD7 15
Blue PB3 3

Miscellaneous

GPIO Pin Arduino Pin
Temperature Sensor PA0 A0
Ambient Light Sensor PA1 A1
Buttons (BTN1 - 6) PA5 A5
BTN 1 PB2 2
BTN 2 PD6 14
Speaker PD4 12

License Information

This product is open source!

Please review the LICENSE file for license information.

Distributed as-is; no warranty is given.