ATMEL Mega1284P evaluation board avalible

Coding: Yes.

added here

const uint8_t PROGMEM digital_pin_to_port_PGM[] =
{
#error
	PD, /* 0  PD0 */
	PD, /* 1  PD1 */
	PD, /* 2  PD2  */
	PD, /* 3  PD3  */
	PB, /* 4  PB0  */
	PB, /* 5  PB1  */
	PB, /* 6  PB2  */
	PB, /* 7  PB3  */

Got this when compiled:

In file included from C:\Program Files\Arduino-0022\hardware\arduino-extras\cores\arduino\pins_arduino.c:114:
C:\Program Files\Arduino-0022\hardware\arduino-extras\cores\arduino/pins_duino1284.cxx:105:2: error: #error

Lefty, am collecting lots of bits & pieces for it, thats for sure!
Auto installing, I don't know, maybe just a ReadMeFirst.txt file 8)

CrossRoads:
Lefty, am collecting lots of bits & pieces for it, thats for sure!
Auto installing, I don't know, maybe just a ReadMeFirst.txt file 8)

So did the Bobuino have a change in crystal freq?

extras added for arduino boards

##############################################################
atmega1284p.name=Arduino-Bobuino 1284p

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=atmega
atmega1284p.bootloader.file=ATmegaBOOT_168_atmega1284p.hex
atmega1284p.bootloader.unlock_bits=0x3F
atmega1284p.bootloader.lock_bits=0x0F

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

Got boards.txt corrected to call out the correct frequency. Didn't help with pin mapping.

Putting an error in pins_duino1284.cxx did indeed cause an error, so the file would seem to be seen.

You know, Think I just noticed something that might help.
In pins_duino1284.cxx, there are 6 arrays.
I didn't change the first 3, just the second 3.
I just noticed that the pin assignments seem to follow the first 3 arrays, and not the last 3.

Am gonna play with those next:

#define PA 1
#define PB 2
#define PC 3
#define PD 4

// 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,

now to mess with the order of these, since the Digital Pin assignment are going:
PortA: 0-7
PortB: 8-15
PortC: 16-23
PortD: 24-31

                     &DDRA,
	&DDRB,
	&DDRC,
	&DDRD
};

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

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

const uint8_t PROGMEM digital_pin_to_port_PGM[] =
{
	PD, /* 0  PD0 */
	PD, /* 1  PD1 */
	PD, /* 2  PD2  */
	PD, /* 3  PD3  */
	PB, /* 4  PB0  */
	PB, /* 5  PB1  */
	PB, /* 6  PB2  */
	PB, /* 7  PB3  */

	PD, /* 8  PD5  */
	PD, /* 9  PD6  */
	PB, /* 10 PB4  */
	PB, /* 11 PB5  */
	PB, /* 12 PB6  */
	PB, /* 13 PB7  */
	PA, /* 14 PA0  */
	PA, /* 15 PA1  */

	PA, /* 16 PA2  */
	PA, /* 17 PA3  */
	PA, /* 18 PA4  */
	PA, /* 19 PA5  */
	PA, /* 20 PA6  */
	PA, /* 21 PA7  */
   	PC, /* 22 PC0  */
	PC, /* 23 PC1  */

	PC, /* 24 PC2  */
	PC, /* 25 PC3  */
	PC, /* 26 PC4  */
	PC, /* 27 PC5  */
	PC, /* 28 PC6  */
	PC, /* 29 PC7  */
	PD, /* 30 PD4  */
	PD  /* 31 PD7  */
};

const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] =
{
	_BV(0), /*D0: 0, port D */
	_BV(1), /*D1: 1, port D */
	_BV(2), /*D2: 2, port D */
	_BV(3), /*D3: 3, port D */
	_BV(0), /*D4: 0, port B */
	_BV(1), /*D5: 1, port B */
	_BV(2), /*D6: 2, port B */
	_BV(3), /*D7: 3, port B */

	_BV(5), /*D8: 5, port D */
	_BV(6), /*D9: 6, port D */
	_BV(4), /*D10: 4, port B */
	_BV(5), /*D11: 5, port B */
	_BV(6), /*D12: 6, port B */
	_BV(7), /*D13: 7, port B */
	_BV(0), /*D14: 0, port A */
	_BV(1), /*D15: 1, port A */

	_BV(2), /*D16, 2, port A */
	_BV(3), /*D17: 3, port A */
	_BV(4), /*D18: 4, port A */
	_BV(5), /*D19: 5, port A */
	_BV(6), /*D20: 6, port A */
	_BV(7), /*D21: 7, port A */
	_BV(0), /*D22: 0, port C */
	_BV(1), /*D23: 1, port C */

	_BV(2), /*D24, 2, port C */
	_BV(3), /*D25: 3, port C */
	_BV(4), /*D26: 4, port C */
	_BV(5), /*D27: 5, port C */
	_BV(6), /*D28: 6, port C */
	_BV(7), /*D29: 7, port C */
	_BV(4), /*D30: 4, port D */
	_BV(7)  /*D31: 7, port D */
};

const uint8_t PROGMEM digital_pin_to_timer_PGM[] =
{
	NOT_ON_TIMER,	/* 0  - PD0 */
	NOT_ON_TIMER, 	/* 1  - PD1 */
	NOT_ON_TIMER, 	/* 2  - PD2 */
	NOT_ON_TIMER,    	/* 3  - PD3 */  
	NOT_ON_TIMER,	/* 4  - PB0 */ 
	NOT_ON_TIMER, 	/* 5  - PB1 */
	NOT_ON_TIMER, 	/* 6  - PB2 */
	TIMER0A,		/* 7  - PB3 */ // PWM

	TIMER1A,	 	/* 8  - PD5 */ // PWM
	TIMER2B, 		/* 9  - PD6 */ // PWM
	TIMER0B,	 	/* 10 - PB4 */ // PWM
	NOT_ON_TIMER, 	/* 11 - PB5 */
	NOT_ON_TIMER,     /* 12 - PB6 */ 
	NOT_ON_TIMER,     /* 13 - PB7 */ 
	NOT_ON_TIMER,     /* 14 - PA0 */ 
	NOT_ON_TIMER,     /* 15 - PA1 */ 

	NOT_ON_TIMER, 	/* 16 - PA2 */
	NOT_ON_TIMER,	/* 17 - PA3 */
	NOT_ON_TIMER,	/* 18 - PA4 */
	NOT_ON_TIMER,	/* 19 - PA5 */
	NOT_ON_TIMER,	/* 20 - PA6 */
	NOT_ON_TIMER,	/* 21 - PA7 */
	NOT_ON_TIMER,	/* 22 - PC0 */
	NOT_ON_TIMER,	/* 23 - PC1 */

	NOT_ON_TIMER,	/* 24 - PC2 */
	NOT_ON_TIMER,	/* 25 - PC3 */
	NOT_ON_TIMER,	/* 26 - PC4 */
	NOT_ON_TIMER,	/* 27 - PC5 */
	NOT_ON_TIMER,	/* 28 - PC6 */
	NOT_ON_TIMER,	/* 29 - PC7 */
	TIMER1B,		/* 30 - PD4 */ // PWM
	TIMER2A		/* 31 - PD7 */ // PWM
};

Success!!
To make it work, I stripped out the pins_arduino.c file in the arduino-0022 folders area and changed it to the listing below.

I renamed the pins_arduino.c in the arduino-extras folders area to a name that didn't start with pins.

If there is a way to make the #ifdef's work for other processors, I'd like some direction on making that work.
For now, I am only compiling correctly for "my" 1284 and have to revert to naming files to use '328 Duemilanoves.
8) 8) 8)!

On to more testing!

/*
 heavily modified to only support an atmega1284 as used in the"Bobuino"

 pins_arduino.c - 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$
*/

#ifndef _AVR_IO_H_
	#include <avr/io.h>
#endif
//#include "wiring_private.h"
#ifndef Wiring_h
	#include "wiring.h"
#endif
#ifndef Pins_Arduino_h
	#include "pins_arduino.h"
#endif

// On the Bobuino board, digital pins are also used
// for the analog output (software PWM).  Analog input
// pins are a separate set.

// 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 / D21)
//   SCK (D 13) PB7  8|        |33  PA7 (AI 7 / D22)
//              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
//                   +--------+
//

#define PA 1
#define PB 2
#define PC 3
#define PD 4


// 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,
    	&DDRA,
	&DDRB,
	&DDRC,
	&DDRD
};

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

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

const uint8_t PROGMEM digital_pin_to_port_PGM[] =
{
	PD, /* 0  PD0 */
	PD, /* 1  PD1 */
	PD, /* 2  PD2  */
	PD, /* 3  PD3  */
	PB, /* 4  PB0  */
	PB, /* 5  PB1  */
	PB, /* 6  PB2  */
	PB, /* 7  PB3  */

	PD, /* 8  PD5  */
	PD, /* 9  PD6  */
	PB, /* 10 PB4  */
	PB, /* 11 PB5  */
	PB, /* 12 PB6  */
	PB, /* 13 PB7  */
	PA, /* 14 PA0  */
	PA, /* 15 PA1  */

	PA, /* 16 PA2  */
	PA, /* 17 PA3  */
	PA, /* 18 PA4  */
	PA, /* 19 PA5  */
	PA, /* 20 PA6  */
	PA, /* 21 PA7  */
   	PC, /* 22 PC0  */
	PC, /* 23 PC1  */

	PC, /* 24 PC2  */
	PC, /* 25 PC3  */
	PC, /* 26 PC4  */
	PC, /* 27 PC5  */
	PC, /* 28 PC6  */
	PC, /* 29 PC7  */
	PD, /* 30 PD4  */
	PD  /* 31 PD7  */
};

const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] =
{
	_BV(0), /*D0: 0, port D */
	_BV(1), /*D1: 1, port D */
	_BV(2), /*D2: 2, port D */
	_BV(3), /*D3: 3, port D */
	_BV(0), /*D4: 0, port B */
	_BV(1), /*D5: 1, port B */
	_BV(2), /*D6: 2, port B */
	_BV(3), /*D7: 3, port B */

	_BV(5), /*D8: 5, port D */
	_BV(6), /*D9: 6, port D */
	_BV(4), /*D10: 4, port B */
	_BV(5), /*D11: 5, port B */
	_BV(6), /*D12: 6, port B */
	_BV(7), /*D13: 7, port B */
	_BV(0), /*D14: 0, port A */
	_BV(1), /*D15: 1, port A */

	_BV(2), /*D16, 2, port A */
	_BV(3), /*D17: 3, port A */
	_BV(4), /*D18: 4, port A */
	_BV(5), /*D19: 5, port A */
	_BV(6), /*D20: 6, port A */
	_BV(7), /*D21: 7, port A */
	_BV(0), /*D22: 0, port C */
	_BV(1), /*D23: 1, port C */

	_BV(2), /*D24, 2, port C */
	_BV(3), /*D25: 3, port C */
	_BV(4), /*D26: 4, port C */
	_BV(5), /*D27: 5, port C */
	_BV(6), /*D28: 6, port C */
	_BV(7), /*D29: 7, port C */
	_BV(4), /*D30: 4, port D */
	_BV(7)  /*D31: 7, port D */
};

const uint8_t PROGMEM digital_pin_to_timer_PGM[] =
{
	NOT_ON_TIMER,	/* 0  - PD0 */
	NOT_ON_TIMER, 	/* 1  - PD1 */
	NOT_ON_TIMER, 	/* 2  - PD2 */
	NOT_ON_TIMER,    	/* 3  - PD3 */  
	NOT_ON_TIMER,	/* 4  - PB0 */ 
	NOT_ON_TIMER, 	/* 5  - PB1 */
	NOT_ON_TIMER, 	/* 6  - PB2 */
	TIMER0A,		/* 7  - PB3 */ // PWM

	TIMER1A,	 	/* 8  - PD5 */ // PWM
	TIMER2B, 		/* 9  - PD6 */ // PWM
	TIMER0B,	 	/* 10 - PB4 */ // PWM
	NOT_ON_TIMER, 	/* 11 - PB5 */
	NOT_ON_TIMER,     /* 12 - PB6 */ 
	NOT_ON_TIMER,     /* 13 - PB7 */ 
	NOT_ON_TIMER,     /* 14 - PA0 */ 
	NOT_ON_TIMER,     /* 15 - PA1 */ 

	NOT_ON_TIMER, 	/* 16 - PA2 */
	NOT_ON_TIMER,	/* 17 - PA3 */
	NOT_ON_TIMER,	/* 18 - PA4 */
	NOT_ON_TIMER,	/* 19 - PA5 */
	NOT_ON_TIMER,	/* 20 - PA6 */
	NOT_ON_TIMER,	/* 21 - PA7 */
	NOT_ON_TIMER,	/* 22 - PC0 */
	NOT_ON_TIMER,	/* 23 - PC1 */

	NOT_ON_TIMER,	/* 24 - PC2 */
	NOT_ON_TIMER,	/* 25 - PC3 */
	NOT_ON_TIMER,	/* 26 - PC4 */
	NOT_ON_TIMER,	/* 27 - PC5 */
	NOT_ON_TIMER,	/* 28 - PC6 */
	NOT_ON_TIMER,	/* 29 - PC7 */
	TIMER1B,		/* 30 - PD4 */ // PWM
	TIMER2A		/* 31 - PD7 */ // PWM
};

Great job, congrats!

Thanks! Just made up DB9 to 3-pin female header cable, writing a sketch now to check out the serial port.

Serial port testing works!

Don't you just love breathing life into a new board? When it works of course :slight_smile:

It's looking real good Bob.


Rob

Yeah, when it works! I am 100% confident in the hardware, getting the software to play nice is the tricky part.
Since I unique-a-fied my pins_arduino.c file for just this board, I have some fooling around to do now to use my '328 boards.

Anyway, back to an RTC sketch.
Tomorrow, I guess, contacts are getting pretty dry ...

Graynomad:
Don't you just love breathing life into a new board? When it works of course :slight_smile:

Well, if it does not work, well then you have not breathed life into it :wink:

So everyone, Bob has worked his butt off on this board. The least we can all do is buy one from him!

:smiley: Thanks for the plug! XD

Here is the pins_arduino.c that I have been using that works with many processors.

pins_arduino.c (13.8 KB)

Thanks mnmis.
This section (actually the 2 above it, but the end results are obvious in this one) show the resulting pin mapping from PA-1 ... PD-7 to the D0-D31 that show up on the actual IO. My board uses them somewhat differently.
I will modify this to reflect mine & check it out. I had the hardest time getting this info pulled in by the IDE, finally resorting to removing everything but my 1284 needs.

If I had understood how this worked when I was assigning pin usage on the board, I may have assigned pin usage differently.
As it was, I tried to match pin usages to reflect the Duemilanove pin usage on shield headers for maximum compatibility.

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 */
	NOT_ON_TIMER, 	/* 6  - PB6 */
	NOT_ON_TIMER,	/* 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 */

CrossRoads,

Keeping pin compatibly across the different processors isn't too high on my priority.

I just keep track of the pin differences and update the code when necessary.

Mnmis

mnnis,
That seemed to work.
I copied in my pin order, spot checked a couple.
If pito hadn't mentioned the arrays in the file & what they represented, I woudn't have figured this out.
I am not sure why having the 1284 info separate from this file, in the arduino-extras folder, didn't work either.

So, I am moving on. RTC I2C testing next, then finding something I can talk to via SPI, and finally checking out the SD cards.

8)..the best way to test the spi is to read/write the sdcards.. quite curious how to work with two sdcards in parallel.. ]:slight_smile:

Btw, for testing purposes the "Bitlash" is a really useful tool. It takes ~29kB (together with sdfat) and then you must not upload a sketch everytime, when debugging hw (it is a cli_like interpreter/scripting language)..

http://bitlash.net/wiki/start

there is a sdcard support built in..p.

skyjumper:
...The least we can all do is buy one from him!

Sign me up!

@pito,
The cards each have their own SS line and are individually accessed.

I am getting a weird error from the compiler for this code to read the 8 registers on the DS1307:

  // Reset the register pointer  
  Wire.beginTransmission(RTC_address);  
  Wire.send(0x00);  
  Wire.endTransmission();   
  
  Wire.requestFrom(RTC_address, 8 );  
  seconds = Wire.receive();  
  minutes = Wire.receive();  
  hours = Wire.receive();  
  day_week = Wire.receive();  
  date_month = Wire.receive();  
  month = Wire.receive();  
  year = Wire.receive();  
  sqwe = Wire.receive();

The same variables all compile okay for writing to the registers earlier in the sketch.

This line is highlighted:
Wire.requestFrom(RTC_address, 8 );

RTC_I2C_test.cpp: In function 'void loop()':
RTC_I2C_test:166: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
C:\Program Files\Arduino-0022\libraries\Wire/Wire.h:53: note: candidate 1: uint8_t TwoWire::requestFrom(int, int)
C:\Program Files\Arduino-0022\libraries\Wire/Wire.h:52: note: candidate 2: uint8_t TwoWire::requestFrom(uint8_t, uint8_t)
RTC_I2C_test.cpp: At global scope:
RTC_I2C_test:215: error: expected declaration before '}' token