ATMEL Mega1284P evaluation board avalible

Please post how that works out, I am up for improvement if possible.

I made small modifications on version arduino-1.0-beta4 and it works well on my Atmega1284.

Board definition is;

atmega1284.name=Bobuino W/ ATmega1284P

atmega1284.upload.protocol=arduino
atmega1284.upload.maximum_size=131072
atmega1284.upload.speed=57600

atmega1284.bootloader.low_fuses=0xFF
atmega1284.bootloader.high_fuses=0xDC
atmega1284.bootloader.extended_fuses=0xFD
atmega1284.bootloader.path=sanguino
atmega1284.bootloader.file=ATmegaBOOT_168_atmega1284p.hex
atmega1284.bootloader.unlock_bits=0x3F
atmega1284.bootloader.lock_bits=0x0F

atmega1284.build.mcu=atmega1284p
atmega1284.build.f_cpu=16000000L
atmega1284.build.core=arduino
atmega1284.build.variant=Bobuino

pins_arduino.h file in folder "C:\arduino-1.0-beta4\hardware\arduino\variants\Bobuino"

/*
  pins_arduino.h - pin definitions for the Arduino board
  Part of Arduino / Wiring Lite

  Copyright (c) 2005 David A. Mellis

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General
  Public License along with this library; if not, write to the
  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  Boston, MA  02111-1307  USA

  $Id: pins_arduino.c 254 2007-04-20 23:17:38Z mellis $
*/

#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#include <avr/pgmspace.h>

#define NUM_DIGITAL_PINS            32
#define NUM_ANALOG_INPUTS           8
#define analogInputToDigitalPin(p)  ((p <   8) ? (p) + 24 : -1)
#define analogInputPinToBit(p)      ((P >= 24) ? (p) - 24 : -1)
#define digitalPinHasPWM(p)         ((p) == 3 || (p) == 4 || (p) == 12 || (p) == 13 || (p) == 14 || (p) == 15)

const static uint8_t SS   = 4;
const static uint8_t MOSI = 5;
const static uint8_t MISO = 6;
const static uint8_t SCK  = 7;

const static uint8_t SDA  = 17;
const static uint8_t SCL  = 16;
const static uint8_t LED  = 13;

const static uint8_t A0   = 24;
const static uint8_t A1   = 25;
const static uint8_t A2   = 26;
const static uint8_t A3   = 27;
const static uint8_t A4   = 28;
const static uint8_t A5   = 29;
const static uint8_t A6   = 30;
const static uint8_t A7   = 31;

//  Bit        7        6        5        4       3         2       1        0
// PCMSK3 = PCINT31, PCINT30, PCINT29, PCINT28, PCINT27, PCINT26, PCINT25, PCINT24
// Dg.Pin     15        14       13      12        11       10      9        8			PCICRBit = 1
// PCMSK2 = PCINT23, PCINT22, PCINT21, PCINT20, PCINT19, PCINT18, PCINT17, PCINT16
// Dg.Pin     23        22       21      20        19       18      17       16			PCICRBit = 2
// PCMSK1 = PCINT15, PCINT14, PCINT13, PCINT12, PCINT11, PCINT10, PCINT9,  PCINT8
// Dg.Pin     7         6         5       4        3         2      1         0			PCICRBit = 0
// PCMSK0 = PCINT7,  PCINT6,  PCINT5,  PCINT4,  PCINT3,  PCINT2,  PCINT1,  PCINT0
// Dg.Pin     31       30        29      28       27       26       25       24			PCICRBit = 3
#define digitalPinToPCICR(p)    (((p) >= 0 && (p) <= 31) ? (&PCICR) : ((uint8_t *)0))
#define digitalPinToPCICRbit(p) (((p) <= 7) ? 0 : (((p) <= 15) ? 1 : (((p) <= 23) ? 2 : 3)))
#define digitalPinToPCMSK(p)    (((p) <= 7) ? (&PCMSK1):(((p) <= 15) ? (&PCMSK3):(((p) <= 23) ? (&PCMSK2):(((p) <= 31) ? (&PCMSK0):((uint8_t *)0)))))
#define digitalPinToPCMSKbit(p) (((p) <= 7) ? (p) : (((p) <= 15) ? ((p) - 8) : (((p) <= 23) ? ((p) - 16) : ((p) - 24))))

#ifdef ARDUINO_MAIN

// ATMEL ATMEGA1284
//
//                      +---\/---+
//          (D 0) PB0  1|        |40  PA0 (AI 0 / D24)
//          (D 1) PB1  2|        |39  PA1 (AI 1 / D25)
//INT2      (D 2) PB2  3|        |38  PA2 (AI 2 / D26)
//      PWM (D 3) PB3  4|        |37  PA3 (AI 3 / D27)
//      PWM (D 4) PB4  5|        |36  PA4 (AI 4 / D28)
//     MOSI (D 5) PB5  6|        |35  PA5 (AI 5 / D29)
//PWM  MISO (D 6) PB6  7|        |34  PA6 (AI 6 / D30)
//PWM   SCK (D 7) PB7  8|        |33  PA7 (AI 7 / D31)
//                RST  9|        |32  AREF
//                VCC 10|        |31  GND 
//                GND 11|        |30  AVCC
//              XTAL2 12|        |29  PC7 (D 23)
//              XTAL1 13|        |28  PC6 (D 22)
//     RX0 (D 8)  PD0 14|        |27  PC5 (D 21) TDI
//     TX0 (D 9)  PD1 15|        |26  PC4 (D 20) TDO
//INT0 RX1 (D 10) PD2 16|        |25  PC3 (D 19) TMS
//INT1 TX1 (D 11) PD3 17|        |24  PC2 (D 18) TCK
//     PWM (D 12) PD4 18|        |23  PC1 (D 17) SDA
//     PWM (D 13) PD5 19|        |22  PC0 (D 16) SCL
//     PWM (D 14) PD6 20|        |21  PD7 (D 15) PWM
//                      +--------+
//

// these arrays map port names (e.g. port B) to the
// appropriate addresses for various functions (e.g. reading
// and writing)
const uint16_t PROGMEM port_to_mode_PGM[] = {
	NOT_A_PORT,
	(uint16_t) &DDRA,
	(uint16_t) &DDRB,
	(uint16_t) &DDRC,
	(uint16_t) &DDRD,
};

const uint16_t PROGMEM port_to_output_PGM[] = {
	NOT_A_PORT,
	(uint16_t) &PORTA,
	(uint16_t) &PORTB,
	(uint16_t) &PORTC,
	(uint16_t) &PORTD,
};

const uint16_t PROGMEM port_to_input_PGM[] = {
	NOT_A_PORT,
	(uint16_t) &PINA,
	(uint16_t) &PINB,
	(uint16_t) &PINC,
	(uint16_t) &PIND,
};

const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
	// PORTLIST
	// -------------------------------------------
	PB, // PB 0 **  0 ** D  0
	PB, // PB 1 **  1 ** D  1
	PB, // PB 2 **  2 ** D  2
	PB, // PB 3 **  3 ** D  3 PWM
	PB, // PB 4 **  4 ** D  4 PWM SS
	PB, // PB 5 **  5 ** D  5 MOSI
	PB, // PB 6 **  6 ** D  6 MISO
	PB, // PB 7 **  7 ** D  7 SCK
	PD, // PD 0 **  8 ** D  8 RX0
	PD, // PD 1 **  9 ** D  9 TX0
	PD, // PD 2 ** 10 ** D 10 RX1
	PD, // PD 3 ** 11 ** D 11 TX1
	PD, // PD 4 ** 12 ** D 12 PWM
	PD, // PD 5 ** 13 ** D 13 PWM
	PD, // PD 6 ** 14 ** D 14 PWM
	PD, // PD 7 ** 15 ** D 15 PWM
	PC, // PC 0 ** 16 ** D 16 SCL
	PC, // PC 1 ** 17 ** D 17 SDA
	PC, // PC 2 ** 18 ** D 18 TCK
	PC, // PC 3 ** 19 ** D 19 TMS
	PC, // PC 4 ** 20 ** D 20 TDO 
	PC, // PC 5 ** 21 ** D 21 TDI
	PC, // PC 6 ** 22 ** D 22
	PC, // PC 7 ** 23 ** D 23
	PA, // PA 0 ** 24 ** D 24 AI 0
	PA, // PA 1 ** 25 ** D 25 AI 1
	PA, // PA 2 ** 26 ** D 26 AI 2
	PA, // PA 3 ** 27 ** D 27 AI 3
	PA, // PA 4 ** 28 ** D 28 AI 4
	PA, // PA 5 ** 29 ** D 29 AI 5
	PA, // PA 6 ** 30 ** D 30 AI 6
	PA  // PA 7 ** 31 ** D 31 AI 7
};

const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] =
{
	_BV(0), /*  0, PB0 */
	_BV(1), /*  1, PB1 */
	_BV(2), /*  2, PB2 */
	_BV(3), /*  3, PB3 */
	_BV(4), /*  4, PB4 */
	_BV(5), /*  5, PB5 */
	_BV(6), /*  6, PB6 */
	_BV(7), /*  7, PB7 */
	_BV(0), /*  8, PD0 */
	_BV(1), /*  9, PD1 */
	_BV(2), /* 10, PD2 */
	_BV(3), /* 11, PD3 */
	_BV(4), /* 12, PD4 */
	_BV(5), /* 13, PD5 */
	_BV(6), /* 14, PD6 */
	_BV(7), /* 15, PD7 */
	_BV(0), /* 16, PC0 */
	_BV(1), /* 17, PC1 */
	_BV(2), /* 18, PC2 */
	_BV(3), /* 19, PC3 */
	_BV(4), /* 20, PC4 */
	_BV(5), /* 21, PC5 */
	_BV(6), /* 22, PC6 */
	_BV(7), /* 23, PC7 */
	_BV(0), /* 24, PA0 */
	_BV(1), /* 25, PA1 */
	_BV(2), /* 26, PA2 */
	_BV(3), /* 27, PA3 */
	_BV(4), /* 28, PA4 */
	_BV(5), /* 29, PA5 */
	_BV(6), /* 30, PA6 */
	_BV(7)  /* 31, PA7 */
};

const uint8_t PROGMEM digital_pin_to_timer_PGM[] =
{
	NOT_ON_TIMER,	/* 0  - PB0 */
	NOT_ON_TIMER,	/* 1  - PB1 */
	NOT_ON_TIMER,	/* 2  - PB2 */
	TIMER0A,		/* 3  - PB3 */
	TIMER0B,		/* 4  - PB4 */
	NOT_ON_TIMER,	/* 5  - PB5 */
	TIMER3A,		/* 6  - PB6 */
	TIMER3B,		/* 7  - PB7 */
	NOT_ON_TIMER,	/* 8  - PD0 */
	NOT_ON_TIMER,	/* 9  - PD1 */
	NOT_ON_TIMER,	/* 10 - PD2 */
	NOT_ON_TIMER,	/* 11 - PD3 */
	TIMER1B,		/* 12 - PD4 */
	TIMER1A,		/* 13 - PD5 */
	TIMER2B,		/* 14 - PD6 */
	TIMER2A,		/* 15 - PD7 */
	NOT_ON_TIMER,	/* 16 - PC0 */
	NOT_ON_TIMER,	/* 17 - PC1 */
	NOT_ON_TIMER,	/* 18 - PC2 */
	NOT_ON_TIMER,	/* 19 - PC3 */
	NOT_ON_TIMER,	/* 20 - PC4 */
	NOT_ON_TIMER,	/* 21 - PC5 */
	NOT_ON_TIMER,	/* 22 - PC6 */
	NOT_ON_TIMER,	/* 23 - PC7 */
	NOT_ON_TIMER,	/* 24 - PA0 */
	NOT_ON_TIMER,	/* 25 - PA1 */
	NOT_ON_TIMER,	/* 26 - PA2 */
	NOT_ON_TIMER,	/* 27 - PA3 */
	NOT_ON_TIMER,	/* 28 - PA4 */
	NOT_ON_TIMER,	/* 29 - PA5 */
	NOT_ON_TIMER,	/* 30 - PA6 */
	NOT_ON_TIMER	/* 31 - PA7 */
};

#endif

#endif

And I added the two lines for Atmega1284 to wiring_analog.c

#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
	if (pin >= 54) pin -= 54; // allow for channel or pin numbers
#elif defined(__AVR_ATmega1284P__)
	if (pin >= 24) pin -= 24; // allow for channel or pin numbers
#else
	if (pin >= 14) pin -= 14; // allow for channel or pin numbers
#endif

And two lines to wiring_private.h

#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define EXTERNAL_NUM_INTERRUPTS 8
#elif defined(__AVR_ATmega1284P__)
#define EXTERNAL_NUM_INTERRUPTS 3
#else
#define EXTERNAL_NUM_INTERRUPTS 2
#endif

Ok, I could see using that - I'd have to make adjustments to make it match my usage:

// ATMEL ATMEGA1284P / BOBUINO
//
//                    +---\/---+
//  INT0 (D 4)  PB0  1|        |40  PA0 (AI 0 / D14)
//  INT1 (D 5)  PB1  2|        |39  PA1 (AI 1 / D15)
//  INT2 (D 6)  PB2  3|        |38  PA2 (AI 2 / D16)
//   PWM (D 7)  PB3  4|        |37  PA3 (AI 3 / D17)
//   PWM (D 10) PB4  5|        |36  PA4 (AI 4 / D18)
//  MOSI (D 11) PB5  6|        |35  PA5 (AI 5 / D19)
//  MISO (D 12) PB6  7|        |34  PA6 (AI 6 / D20)
//   SCK (D 13) PB7  8|        |33  PA7 (AI 7 / D21)
//              RST  9|        |32  AREF
//              VCC 10|        |31  GND 
//              GND 11|        |30  AVCC
//            XTAL2 12|        |29  PC7 (D 29)
//            XTAL1 13|        |28  PC6 (D 28)
//  RX0 (D 0)   PD0 14|        |27  PC5 (D 27) TDI
//  TX0 (D 1)   PD1 15|        |26  PC4 (D 26) TDO
//  RX1 (D 2)   PD2 16|        |25  PC3 (D 25) TMS
//  TX1 (D 3)   PD3 17|        |24  PC2 (D 24) TCK
//  PWM (D 30)  PD4 18|        |23  PC1 (D 23) SDA
//  PWM (D 8 )  PD5 19|        |22  PC0 (D 22) SCL
//  PWM (D 9)   PD6 20|        |21  PD7 (D 31) PWM
//                   +--------+
//

@Nadir

Thank you very much, you even included Timer 3

Edit: Could you upload ATmegaBOOT_168_atmega1284p.hex somewhere? thanks

The link is Google Code Archive - Long-term storage for Google Code Project Hosting. which I have downloaded.

Sure,
http://www.crossroadsfencing.com/BobuinoRev17/ATmegaBOOT_1284P_16MHz.hex

Right-click, save target as, renameto .hex

Hi, any experience with the newest sdfat (multiple cards support) and two sdcards connected?
Thx.

No, I don't have a board with 2 sockets. Yet.
The first build only supports 1, the 2nd had incorrect uSD socket pinouts.
Have Rev 2 designed, but no cards purchased. Will handlle one of SD or uSD on either side of the board.

Suppose I could try an Adafruit shield for a 2nd one as a test.

Meh bootloader does not work: avrdude: stk500_getsync(): not in sync: resp=0x00

Actually my device is 8MHz so I installed WinAVR and compiled bootloader code (from brewtroller) but no avail...

Programmer is FTDI breakout.

EDIT: Turns out common ground is needed for board and ftdi breakout. Also I attached 8Mhz bootloader which works at baudrate 38400.

ATmegaBOOT_168_atmega1284p_8MHz.hex (4.53 KB)

Call me blind, but i cannot find the PCB layout for this exact board:

It's wonderfull, and i would like to toy a little with the layout :wink:

// Per.

Ok, you are blind!
Layout is not posted, that was a paid job I did, I had permission to post the picture.
You can send a PM to skyjumper to ask him for the layout.

Hello all,

After reading through the 29 pages of this thread, and about another 50+ pages of other threads, I am still at a loss to understand how to bootload my '1284 based dev board.

I would really appreciate it if someone could please share a working bootloaders for the '1284 that works at 16MHz and 20MHz (I understand different bootloaders are needed)?

Thanks in advance,

Regards,
Madhu.

I don't know about 20 MHz, but arduino bootloaders will work at 16 MHz.

Check out the core files here for 1284's.

www.avr-developers.com

skyjumper made this bootloader for me.
(right-click, save-target-as, rename to .hex if need to).

Then get yourself an AVR ISP such as this to load the bootloader into it.

http://www.mdfly.com/index.php?main_page=product_info&cPath=5&products_id=415

add these 2 lines to programmers.txt to use it in the IDE. Tools:Burn Bootloader: w/ MDFLY

usbasp.name=MDFLY
usbasp.protocol=usbasp

and add a section like this in boards.txt

##############################################################
atmega1284p.name=Arduino-Bobuino 1284p      <<< this will show up in the IDE boards list

atmega1284p.upload.protocol=stk500
atmega1284p.upload.maximum_size=129024
atmega1284p.upload.speed=38400

atmega1284p.bootloader.low_fuses=0xFF
atmega1284p.bootloader.high_fuses=0xDC
atmega1284p.bootloader.extended_fuses=0xFD
atmega1284p.bootloader.path=Bobuino              <<< change to your path
atmega1284p.bootloader.file=ATmegaBOOT_1284P_16MHz.hex
atmega1284p.bootloader.unlock_bits=0x3F
atmega1284p.bootloader.lock_bits=0x0F

atmega1284p.build.mcu=atmega1284p
atmega1284p.build.f_cpu=16000000L
atmega1284p.build.core=arduino

Can you follow all that?

ATmegaBOOT_1284P_16MHz.hex (5.5 KB)

Hi Crossroads,

Thanks a million for all this. I was able to make changes to reflect my programmer in the IDE (AVR910).

I also replaced the pins_arduino.C with the one you have created and that it works fine.

Thank you so much yet again,
Madhu.

CrossRoads:
Sure,
http://www.crossroadsfencing.com/BobuinoRev17/ATmegaBOOT_1284P_16MHz.hex

Right-click, save target as, renameto .hex

Hey, is the source for this bootloader available?

Need to ask Skyjumper for that, he has the source and the makefiles and what not.

CrossRoads:
Check out the core files here for 1284's.

www.avr-developers.com

Is there a list of files needed strictly for the 1284p, rather then the complete package for all the processors?

Not that I know of.

Are there any plain basic 1284 boards with UNO foot print? The Bobuino is cool but way more features then I need. Essentially need UNO foot print, more RAM then 328 offers and shield compatibility. Be connecting Ethernet shield and a GSM shield. Much prefer on board USB over external FTDI.

I have an UNO32 which is PIC32 based. Great little board and compatible with shields. But libraries have quite a few gaps. What I am doing should be fairly simple to due with Arduino environment. Right now seems much less of a path of resistance then delving into MPLAB and Microchip Ethernet stack.

But with the RAM requirement exceeding what the 328 has to offer the 1284 is an appealing choice. I've looked at adding SPI RAM or FRAM, but I'd rather have less parts count.

You want a bare Bobuino board & just populate the parts you need?
Leave off the SD parts, RTC, extra IO pins, etc.
I could order a batch of PCBs, you build up what you need.

adilinden:
Are there any plain basic 1284 boards with UNO foot print? The Bobuino is cool but way more features then I need. Essentially need UNO foot print, more RAM then 328 offers and shield compatibility. Be connecting Ethernet shield and a GSM shield. Much prefer on board USB over external FTDI.

The only board I know of with the Uno footprint is this one, http://www.thaieasyelec.net/index.php/Arduino/ATmega32-Dev-Board-Arduino-Diecimila-Compatible-DIP-28-DIP-40-/p_133.html, but it's out of stock and the corresponding Thai page seems to indicate it has been "retired", http://www.thaieasyelec.com/Development-Board/Arduino/Dev-Board/Arduino-Diecimila-Compatible-DIP-28-DIP-40-ATmega32.html.

If you want something that's fully shield compatible (including the location of the ISP header - essential for using the Ethernet shield) then I think my Calunium board is the only other option. The footprint is similar to the Mega2560 footprint (same length, a bit wider). All the files and software are available on Github under a CC license. I had 10 PCBs made by Iteadsutdio for $25, and delivery was just $5. You only need to populate a few and the cost each is about the same as the Uno. You will need an FTDI cable.