Arduino Forum

Using Arduino => Microcontrollers => Topic started by: JChristensen on Oct 30, 2014, 04:24 am

Title: Mighty-1284P core updated for Arduino 1.0.6
Post by: JChristensen on Oct 30, 2014, 04:24 am
With the release of Arduino 1.0.6, changes to the core files are no longer needed to support the ATmega1284P. This allows the cores directory to be deleted, which simplifies the mighty-1284p core considerably. I've changed all the entries in boards.txt to point to the regular Arduino core.

These changes are in a new branch named v1.0.6 (https://github.com/JChristensen/mighty-1284p/tree/v1.0.6). The v1.0.5 branch will remain the default (https://github.com/JChristensen/mighty-1284p) for the time being, until the v1.0.6 branch can be tested further. Please report test results here; also please raise an issue on GitHub if issues are found with v1.0.6.

I've tested basic analog and digital pin mapping for the standard variant with no issues.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: avr_fred on Oct 30, 2014, 05:13 am
Prefect timing, thank you. I should be receiving my Mouser order tomorrow with the pats for 3 mighty 1284p's, purple boards were received last week. Looking forward to building them this weekend as I need one for a current project.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: JChristensen on Oct 30, 2014, 05:18 am
Prefect timing, thank you. I should be receiving my Mouser order tomorrow with the pats for 3 mighty 1284p's, purple boards were received last week. Looking forward to building them this weekend as I need one for a current project.
You're welcome. I'll be interested to hear how it all works!
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Oct 30, 2014, 06:51 am
Thanks for the update, Jack. Now, I'm confused though. People have been talking v1.5.x for months, and now suddenly v1.0.6. Is the IDE splitting in 2 different directions? Do the v1.5.x versions have 1284 support?
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: JChristensen on Oct 30, 2014, 02:13 pm
Thanks for the update, Jack. Now, I'm confused though. People have been talking v1.5.x for months, and now suddenly v1.0.6. Is the IDE splitting in 2 different directions? Do the v1.5.x versions have 1284 support?
I haven't actually been using 1.5.x so I may not have the best answer. But I think 1.5.6-r2 (if not earlier 1.5.x as well) already had the needed support. Note that only a single change (to wiring_analog.c) was needed to make the 1.0.5 core files 1284p-compatible. I was aware that there was a patch made after 1.0.5 was released to implement a similar change. When I checked 1.0.6, I found that indeed it was there, which is what I expected.

Not sure on the grand strategy with 1.0.x vs. 1.5.x but I think they may be trying to move them back together. In the 1.0.6 release notes I see several changes back-ported from 1.5.x.

Hope I've got all that right; if not, someone please correct me.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Nov 05, 2014, 05:44 am
I figured to tack this on here, rather than go way back to the old thread.

Jack, I looked at your github page on the 1284, and the SD library in particular. I notice you use some complex syntax [that I don't understand at all] for the MIGHTY_1284P_VARIANT pin selections in the Sd2PinMap.h file, but my question is that I do not see a section for the Bobuino board under here:

https://github.com/JChristensen/mighty-1284p/blob/v1.0.5/patched-libs/official/SD/utility/Sd2PinMap.h (https://github.com/JChristensen/mighty-1284p/blob/v1.0.5/patched-libs/official/SD/utility/Sd2PinMap.h)
Code: [Select]

#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \
  || defined(__AVR_ATmega644__)  || defined(__AVR_ATmega644A__) \
  || defined(__AVR_ATmega644P__)  || defined(__AVR_ATmega644PA__)

I can probably figure out how to patch the Sanquino section, but ?? ??

EDIT:
Similarly, I looked in your patched library file, and don't see the Bobuino listed.
https://github.com/JChristensen/mighty-1284p/tree/v1.0.6/patched-libs/official/SD/utility (https://github.com/JChristensen/mighty-1284p/tree/v1.0.6/patched-libs/official/SD/utility)

Also, I just downloaded IDE v1.0.6, and the only section I see in the SD library Sd2PinMap.h file is for the Sanguino, not anything for 1284. So, I'm pretty darn confused here.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: CrossRoads on Nov 05, 2014, 06:35 am
Bobuino is only used for pins_arduino.h to define the mapping from physical pins to the software names.
Think of it as the end of the chain - the last step that makes the connection from PortB bit 7 (SCK) to D13 for example.
The processor type is still Atmega1284P.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Nov 05, 2014, 06:44 am
Yes, I understand that's the way it's supposed to work in the best of possible worlds, but the 1284 has always out in left-field somewheres. Most of the "libraries" have special definitions for the different processors, and only had the Sanguino defined, not the 1284. Up until recently the .... defined(__AVR_ATmega1284P__) .... bit wasn't even found in most libraries, and they defaulted to the UNO port/pin scheme.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: CrossRoads on Nov 05, 2014, 08:09 am
I can't speak to "most libraries" as I don't use them. I haven't had issue with the basic ones - SPI, I2C, Serial. Don't think I use much else than that, just write the code I need.
Here's how the 2010 version of Sd2pinmap.h was modified for use with the original Bobuino.
I think the only change since was to swap the analog pins end for end.
Code: [Select]

//------------------------------------------------------------------------------
#elif defined(__AVR_ATmega1284P__)
// add this if use these other chips
// ||defined(__AVR_ATmega644P__) || defined(__AVR_ATmega324P__)

// ATMEL ATMEGA1284P / BOBUINO
//
// Make it agree with the as-built hardware & pins_arduino.c
//
//                    +---\/---+
//  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
//                    +--------+
//
// 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 */


// Two Wire (aka I2C) ports
uint8_t const SDA_PIN = 23;  // C1 23
uint8_t const SCL_PIN = 22;  // C0 22

// SPI port
   uint8_t const SS_PIN =   10;  // physical 5, D 10  SS
   uint8_t const MOSI_PIN = 11;  // physical 6, D 11  MOSI
   uint8_t const MISO_PIN = 12;  // physical 7, D 12  MISO
   uint8_t const SCK_PIN =  13;  // physical 8, D 13  SCK

static const pin_map_t digitalPinMap[] = {
  {&DDRD, &PIND, &PORTD, 0},  // D0  0
  {&DDRD, &PIND, &PORTD, 1},  // D1  1
  {&DDRD, &PIND, &PORTD, 2},  // D2  2
  {&DDRD, &PIND, &PORTD, 3},  // D3  3
  {&DDRB, &PINB, &PORTB, 0},  // B0  4
  {&DDRB, &PINB, &PORTB, 1},  // B1  5
  {&DDRB, &PINB, &PORTB, 2},  // B2  6
  {&DDRB, &PINB, &PORTB, 3},  // B3  7
  {&DDRD, &PIND, &PORTD, 5},  // D5  8
  {&DDRD, &PIND, &PORTD, 6},  // D6  9
  {&DDRB, &PINB, &PORTB, 4},  // B4 10
  {&DDRB, &PINB, &PORTB, 5},  // B5 11
  {&DDRB, &PINB, &PORTB, 6},  // B6 12
  {&DDRB, &PINB, &PORTB, 7},  // B7 13
  {&DDRA, &PINA, &PORTA, 0},  // A0 14
  {&DDRA, &PINA, &PORTA, 1},  // A1 15
  {&DDRA, &PINA, &PORTA, 2},  // A2 16
  {&DDRA, &PINA, &PORTA, 3},  // A3 17
  {&DDRA, &PINA, &PORTA, 4},  // A4 18
  {&DDRA, &PINA, &PORTA, 5},  // A5 19
  {&DDRA, &PINA, &PORTA, 6},  // A6 20
  {&DDRA, &PINA, &PORTA, 7},  // A7 21
  {&DDRC, &PINC, &PORTC, 0},  // C0 22
  {&DDRC, &PINC, &PORTC, 1},  // C1 23
  {&DDRC, &PINC, &PORTC, 2},  // C2 24
  {&DDRC, &PINC, &PORTC, 3},  // C3 25
  {&DDRC, &PINC, &PORTC, 4},  // C4 26
  {&DDRC, &PINC, &PORTC, 5},  // C5 27
  {&DDRC, &PINC, &PORTC, 6},  // C6 28
  {&DDRC, &PINC, &PORTC, 7},  // C7 29
  {&DDRD, &PIND, &PORTD, 4},  // D4 30
  {&DDRD, &PIND, &PORTD, 7}   // D7 31

};
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Nov 05, 2014, 08:24 am
Thanks, we seem to be cross-posting on this thing. I'll try it all again tomorrow. I was hoping Jack had this all fixed for the different variants.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: JChristensen on Nov 05, 2014, 01:44 pm
Thanks, we seem to be cross-posting on this thing. I'll try it all again tomorrow. I was hoping Jack had this all fixed for the different variants.
Sorry about that. I've only had time to work on the core, not the libraries. I didn't do the original work on the libraries; to get up to speed and dive into that would probably be more time than I'm going to have here for a while. If someone wanted to take that on (or partly, even a single library), that'd be great :smiley-grin:
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: cyclegadget on Nov 05, 2014, 03:22 pm
@oric_dan

 I have been using the original bobuino that CrossRoads sold preassembled. On it, chip select for the SD card is pin 30. The pin only goes to the (SD card buffer) and NOT the header AFAIK.

Other than that, I use the SdFat library that user Fat16lib has made. Everything from his library that I have tested has worked great.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: mcnobby on Nov 05, 2014, 05:00 pm
I have a few 1284 project updates coming soon, so I will gladly test, athough I was hoping to do a full upgrade to 1.5.x for all my projects..

Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Nov 05, 2014, 06:14 pm
@oric_dan

 I have been using the original bobuino that CrossRoads sold preassembled. On it, chip select for the SD card is pin 30. The pin only goes to the (SD card buffer) and NOT the header AFAIK.

Other than that, I use the SdFat library that user Fat16lib has made. Everything from his library that I have tested has worked great.
This is one of the problems with those darn libraries. It's not "just" pin 30. First, the SD card CS appears all over the place on different boards [D4, D8, D10, and apparently D30 on Bob's boards], and sometimes the various libraries reference by Arduino Dx pin, and sometimes they reference via mega chip port-pin .... and they're always poorly labelled to boot. It always takes a while to figure out what they actually meant.

I'm also not sure why yours even works, as there are no _BOBUINO_ variant sections in the SD libraries that I can see, so ?? ??
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Nov 05, 2014, 06:17 pm
Sorry about that. I've only had time to work on the core, not the libraries. I didn't do the original work on the libraries; to get up to speed and dive into that would probably be more time than I'm going to have here for a while. If someone wanted to take that on (or partly, even a single library), that'd be great :smiley-grin:
Ah so, since you had included the libraries in your distribution, I had figured you and the other 1284-Revisioniste Group guys had fixed them. If you will recall back then, I had previously checked and "fixed" about 18 libraries for 1284 use, but not gotten to SD.

Maybe things will go better today.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Nov 05, 2014, 06:39 pm
I can't speak to "most libraries" as I don't use them. I haven't had issue with the basic ones - SPI, I2C, Serial. Don't think I use much else than that, just write the code I need.
Here's how the 2010 version of Sd2pinmap.h was modified for use with the original Bobuino.
I think the only change since was to swap the analog pins end for end.
............
Thanks for the data, Bob, I can already see one thing I had confused. Also, SPI, I2C, and Serial are 3 of the libraries that rely on pins_arduino.h for the variant, so they have no problem working, whereas SD and many others need patching for the 1284, and some also for different variants.

EDIT:
Well, I just solved part of the SD library ala 1284 mess. You mentioned the **2010** version of Sd2pinmap.h as having the Bobuino variant. Well, as it turns out, not only is the IDE SD library deficient in this regard [as expected], but so is Bill Greiman's **LATEST** version of the SDFat library, which is what I was using. So, he must have removed the Bobuino variant since 2010, Du-uh!

https://github.com/greiman/SdFat/blob/master/SdFat/utility/DigitalPin.h (https://github.com/greiman/SdFat/blob/master/SdFat/utility/DigitalPin.h)

However, he magically included it again in the new Beta version, which I wasn't using, Double Du-uh!

https://github.com/greiman/SdFat-beta/blob/master/SdFat/utility/DigitalPin.h (https://github.com/greiman/SdFat-beta/blob/master/SdFat/utility/DigitalPin.h)

From what I can tell, a lot of library writers decided the Arduino pin control functions weren't fast enough, so they optimized to direct use of port/pin instead. Therein lies the problem with the 1284 variants.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: cyclegadget on Nov 05, 2014, 07:18 pm
Using the library called SdFat.h, I made all my changes in the sketch. I think if you look it over you will understand. Feel free to ask question.

By the way, I have very little knowledge on how to change libraries for boards.

Code: [Select]
#include <SdFat.h>
// file system
// file system object
SdFat sd;


// buffer to format data - makes it eaiser to echo to Serial
char SDbuf[512];

// text file for logging
ofstream logfile;
// store error strings in flash to save RAM
#define error(s) sd.errorHalt_P(PSTR(s))#include <SdFat.h>
// file system
// file system object
SdFat sd;

// text file for logging
ofstream logfile;
// store error strings in flash to save RAM
#define error(s) sd.errorHalt_P(PSTR(s))

 pinMode(CHIP_SELECT,OUTPUT);  //SD CARD CHIPSELECT 30 on bobuino

  //SETUP SD CARD AND SET FILE NAME//
  if (!sd.begin(CHIP_SELECT, SPI_FULL_SPEED)) sd.initErrorHalt();

  // create a new file in root, the current working directory
  char name[] = "LOGGER00.CSV";

  for (uint8_t i = 0; i < 100; i++) {
    name[6] = i/10 + '0';
    name[7] = i%10 + '0';
    if (sd.exists(name)) continue;
    logfile.open(name);
    break;
  }
  if (!logfile.is_open())error("file.open");
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Nov 05, 2014, 07:25 pm
@cyclegadget, so the question now comes ... Which version of the SDFat library are you using?

There seem to be at least 3 different ones in play, in regards the Bobuino variant. At least, I'm beginning the see what's been happening around here. Jeez Louise!

Oops, 4 versions including Jack's, and they're all different and handle the 1284 variants differently.
https://github.com/JChristensen/mighty-1284p/blob/v1.0.5/patched-libs/unofficial/SdFat/utility/DigitalPin.h (https://github.com/JChristensen/mighty-1284p/blob/v1.0.5/patched-libs/unofficial/SdFat/utility/DigitalPin.h)
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: cyclegadget on Nov 05, 2014, 08:53 pm
https://github.com/greiman/SdFat (https://github.com/greiman/SdFat) It has been a while since I downloaded my version of Sdfat but, I think it is on this page.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Nov 05, 2014, 09:55 pm
If you go down into that repository, you'll see it's one of the 4 or 5 SD library versions I mentioned that does NOT have the Bobuino variant in it,
https://github.com/greiman/SdFat/blob/master/SdFat/utility/DigitalPin.h (https://github.com/greiman/SdFat/blob/master/SdFat/utility/DigitalPin.h)

Well, at least as a result of Bob's post in reply #8, I've got things figured out enough now that I do actually have the SD card working with my 1284 board. At last.
[of course, it's incompatible with the RFM12 library that also uses SPI, but that's another story not yet finished].
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: cyclegadget on Nov 05, 2014, 10:21 pm
 I guess this part was close enough for me to make it work with my sketch adjustments.

Code: [Select]
#elif defined(__AVR_ATmega1284P__)\
|| defined(__AVR_ATmega1284__)\
|| defined(__AVR_ATmega644P__)\
|| defined(__AVR_ATmega644__)\
|| defined(__AVR_ATmega64__)\
|| defined(__AVR_ATmega32__)\
|| defined(__AVR_ATmega324__)\
|| defined(__AVR_ATmega16__)
// Mighty Layout
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Nov 05, 2014, 10:58 pm
Yeah, the mind boggles.

The following is the SPI pin mapping on the Mighty-1284 layout [ie, the "last" digits 4...7 here, which are also the position in the table of those entries], whereas PortB 4...7 go to 10...13 on Bobuino, as you can see in Bob's table in reply #8. And other pins possibly used for CS are similarly scrambled.
Code: [Select]
  {&DDRB, &PINB, &PORTB, 4},  // B4  4
  {&DDRB, &PINB, &PORTB, 5},  // B5  5
  {&DDRB, &PINB, &PORTB, 6},  // B6  6
  {&DDRB, &PINB, &PORTB, 7},  // B7  7
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: mrburnette on Nov 06, 2014, 01:13 am
Quote
Ah so, since you had included the libraries in your distribution,
Somewhere in that novel of a thread, the "scope of work" Jack undertook was specified as "core".  Libraries are such a moving target... Several senior members chimed-in that they generally replaced many of the libs with their own code or disassembled libraries into their own sketch folders where they are " tabbed".

Ray
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Nov 08, 2014, 02:23 am
Actually, regarding that novel of a thread, I was the first person, to my knowledge, to check through and "fix" about 18 of the libraries for use with the mega1284, save only the SD and maybe one other library. Then, the 1284-Revisioniste Group took off like gang-busters - what, like 500 posts - and decided to include the libraries in the new distribution, so I thought they'd have fixed the rest of them. Oh well.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: mrburnette on Nov 08, 2014, 04:17 am
oric_dan,

Oh, well indeed.  My personally stated opinion was to move directly to 1.5.x, and I think much of the who-do would have been eliminated... But that is only an opinion... Sometimes, whoo-do just happens.

I, for one,certainly acknowage your efforts.  Mucking in other's libraries is dirty work.  It is the same with every uC that I have worked on... We in the STM32 Maple/Maple-mini thread are having similar issues; however we did decide to overlook 1.0.6/1.0.7 and went straight to 1.5.7/8. 

Ray
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Nov 08, 2014, 06:55 am
Quote
My personally stated opinion was to move directly to 1.5.x, and I think much of the who-do would have been eliminated..
What I mentioned, I had already done way back about May of 2013, a year and a half ago.

Also, back at the beginning of this thread I asked Jack about v.1.5.x, but he was touting v1.0.6, and I don't actually know what is provided in either. I tried to install v.1.0.6 a few days, but it crashed for some reason, so I didn't worry about it.

Do you know the extent of 1284 support in v.1.5.x, Ray? My guess is, listening to Bill Greiman, the author of the SD/SdFat libraries, is that not much has been added in v.1.5.x, at least with regards SD, but maybe you know. Yes, no, maybe?

EDIT:
Alright, here you go. I just discovered the source for v.1.5.x is on github, so I don't have to install it to see what's in it.
https://github.com/arduino/Arduino/tree/ide-1.5.x (https://github.com/arduino/Arduino/tree/ide-1.5.x)

1. SD: https://github.com/arduino/Arduino/blob/ide-1.5.x/libraries/SD/src/utility/Sd2PinMap.h (https://github.com/arduino/Arduino/blob/ide-1.5.x/libraries/SD/src/utility/Sd2PinMap.h) has no mention of mega1284 chips at all.

2. Ethernet: https://github.com/arduino/Arduino/blob/ide-1.5.x/libraries/Ethernet/src/utility/w5100.h (https://github.com/arduino/Arduino/blob/ide-1.5.x/libraries/Ethernet/src/utility/w5100.h) has no mention of mega1284 at all.

3. Servo: https://github.com/arduino/Arduino/blob/ide-1.5.x/libraries/Servo/src/avr/ServoTimers.h (https://github.com/arduino/Arduino/blob/ide-1.5.x/libraries/Servo/src/avr/ServoTimers.h) has no mention of mega1284 at all.

4. core: https://github.com/arduino/Arduino/blob/ide-1.5.x/hardware/arduino/avr/cores/arduino/Arduino.h (https://github.com/arduino/Arduino/blob/ide-1.5.x/hardware/arduino/avr/cores/arduino/Arduino.h) references the 1284P, exactly the same as in v.1.0.5.

That's 1 for 4. The other libraries in the IDE don't matter, as far as I know, since they all make use of the usual pins_aruino.h file for the different board variants, and only the ones above specifically reference the chips themselves. So, same exact place as v.1.0.5 was back in May 2013 when I looked at 1284 support the first time.

Here's my advice ---->  don't even bother with v.1.5.x, if you're using the 1284, no new fixes at all. You gotta do it all yerself. That's the bottom line.

SECOND EDIT:
BTW, you may also be interested to know, according to what Bill Greiman said on the Storage section yesterday, the SD library in the IDE hasn't been updated since 2011 [and you can look at the copyright date on the files], while Bill is making continuous revisions.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: mrburnette on Nov 08, 2014, 07:21 am
Quote
Do you know the extent of 1284 support in v1.5.x, Ray? My guess is, listening to Bill Greiman, the author of the SD/SdFat libraries, is that not much has been added in v1.5.x, at least with regards SD, but maybe you know.

Yes, no, maybe?
I know only what I have read on the forum... I've been away from AVR for 6 months playing with the ARM PSoC and SMT32 stuff.  I need to get back in the grove now that Winter is coming in the U.S.  But to be honest and answer your question, I have no personal knowledge of the 1284 support in 1.5.x ... I have heard that the 1.5.6 core supported 1284 but that was read in this thread... how does one gauge support... is it a number from 0 to 9, or a percentage from 0 to 100% or is it like the weather report: raining somewhere, sunny somewhere, your mileage may vary?

Quote
From what I can tell, a lot of library writers decided the Arduino pin control functions weren't fast enough, so they optimized to direct use of port/pin instead. Therein lies the problem with the 1284 variants.
True.  This is pointed out by everyone that uses other micro-controller boards and development systems.  However, it is what makes an Arduino an Arduino.  Alas, the need for speed when all the 8-bit stuff is running at only 16MHz is a legitimate concern.  If the AVR was running at 48MHz, the pin mapping arrays would be less of a drag.  I do not wish to offend, but I view the Arduino more of a toy platform - albeit a rather capable toy.

Ray
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Nov 08, 2014, 07:27 am
Aha, I just edited my previous msg while you were posting. Answered my own questions.

Quote
I have heard that the 1.5.6 core supported 1284 but that was read in this thread...
Well FWIW, at this point in time, I figure I'm the reigning world's expert on using the 1284 with the IDE,  despite what anyone else might care to think, and have used it for maybe 20 projects now and with most of the libraries, and you saw my answers in my previous post.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: larryd on Nov 08, 2014, 07:40 am
Quote
Here's my advice ---->  don't even bother with v.1.5.x, if you're using the 1284, no new fixes at all. You gotta do it all yerself. That's the bottom line.
Quote
I figure I'm the reigning world's expert on using the 1284 with the IDE
Your expertise and work is appreciated.

Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: mrburnette on Nov 08, 2014, 07:49 am
Your expertise and work is appreciated.
Yea, me too!

Ray
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: mcnobby on Nov 08, 2014, 08:55 am
I do not wish to offend, but I view the Arduino more of a toy platform - albeit a rather capable toy.
It may be just that Ray, but I think that is what appeals to many, its simplicity and noobie friendliness, and the fact that it is not strictly C, and for me some of the waffle has been removed

In the past I have used some very unfriendly IDE's and even nastier ICE's and debuggers

I love Arduino, literally !

I am not a hardened software engineer and learnt by watching others, experimenting and reading, not by schooling, so for me, the more products that can be squeezed out of a single 'platform' the better

The range of devices I use go from ATTiny13 to (now) STM32 (using 1284 and 2560 in between)

So your comment about BEING A RATHER CAPABLE TOY is absolutely SPOT ON !!!

Bob
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: ChilliTronix on Nov 08, 2014, 11:31 am
I do not wish to offend, but I view the Arduino more of a toy platform - albeit a rather capable toy.

It is. Which means more people play with it, more people means more ideas, a bigger marketplace and lower prices. It then means that more people can develop ideas that would never have been thought of.

All I can see is win win.

The real bonus would be getting the STM chips working well as a toy!
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: mcnobby on Nov 08, 2014, 01:11 pm
All I can see is win win.

The real bonus would be getting the STM chips working well as a toy!
:) I am sure that day will come soon sir ;)
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: GoForSmoke on Nov 24, 2014, 04:38 am
I do not wish to offend, but I view the Arduino more of a toy platform - albeit a rather capable toy.

Ray

I spent years writing and fixing software that small businesses ran on less capable toys with.

But when what you know are desktop supercomputers, it's like comparing the latest Airbus to a sedan.
I don't need an Airbus to go get groceries.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: ChilliTronix on Nov 24, 2014, 09:12 pm
I spent years writing and fixing software that small businesses ran on less capable toys with.

But when what you know are desktop supercomputers, it's like comparing the latest Airbus to a sedan.
I don't need an Airbus to go get groceries.
We have smart phones with more power than a 1970s super computer.... and what do we do with them?

Arduinos are both toys and capable. The two are not mutually exclusive.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: larryd on Nov 24, 2014, 11:26 pm
The Large Hadron Collider is the worlds biggest toy.  ;)
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: ChilliTronix on Nov 24, 2014, 11:34 pm
The Large Hadron Collider is the worlds biggest toy.  ;)
Quite, I was happy with getting two trains crashing into each other... Apparently that is nothing like big enough or fast enough :)
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: GoForSmoke on Nov 25, 2014, 03:32 am
The Large Hadron Collider is the worlds biggest toy.  ;)
I think that the world economy has got that beat. Know any Johnny Paycheck songs?
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Nov 26, 2014, 06:54 pm
Well, this thread sure went off the tracks (Ray strikes again).
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: GoForSmoke on Nov 26, 2014, 10:15 pm
Should I be able to copy and modify the 16MHz Optiboot 1284P core file to run 8MHz as another core?
I get the feeling that this was pointed out to me in the last few days and I missed the clue.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: pico on Jan 12, 2015, 07:28 am
I didn't do the original work on the libraries; to get up to speed and dive into that would probably be more time than I'm going to have here for a while. If someone wanted to take that on (or partly, even a single library), that'd be great :smiley-grin:
I did all the changes to the patched libraries (official and unofficial) for the 1.0.5 release.

So if anyone has any questions on these, just ask.

I was actually looking in to see what the situation now that IDE 1.0.6 is released. Depending on what has changed in the libraries for 1.0.6, I, may need to make an updated copy of the patched libs for 1.0.6.

I notice that on the github installation instructions, there isn't a mention of the "patched-libs" folder, and where to place the contents. This should probably be updated.

When I did the patches for the SdLib library, I was in contact with Bill Greiman, who said he would include the needed changes to support the 1284p in subsequent releases of his SdLib. I'm not sure where that's up to -- I'll have to check with him.

 
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Jan 12, 2015, 08:43 am
Hi pico, a while back, I started another thread to try and sort this all out in my poor asphyxiated mind. I don't know what may have transpired since then. I think I gave you a couple of +1s, but you probably need some more.
http://forum.arduino.cc/index.php?topic=277769.0 (http://forum.arduino.cc/index.php?topic=277769.0)
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: liuzengqiang on Feb 12, 2015, 08:49 am
Jack,

The Arduino 1.6.0 IDE is out. Out of my character, I'm trying it out. Any interest in updating the 1284P core? I made a custom core based on bobuino and it's working.

Note: it seems that 1.0.5 uses its arduino core files even when I have the custom core folder inside mighty-1284P. Evidence is my analog pins are backwards A0 is actually A7. But if I compile with 1.0.6 it works.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: bperrybap on Feb 13, 2015, 01:34 am
Jack,

The Arduino 1.6.0 IDE is out. Out of my character, I'm trying it out. Any interest in updating the 1284P core? I made a custom core based on bobuino and it's working.

Note: it seems that 1.0.5 uses its arduino core files even when I have the custom core folder inside mighty-1284P. Evidence is my analog pins are backwards A0 is actually A7. But if I compile with 1.0.6 it works.
Not sure how you did your integration, but I didn't have to do much other than massage the directory
tree and create boards.txt and platform.txt file.
1.5/6 uses a different hardware core library structure.
When I got the 1284 stuff up and working on 1.5x quite some time ago, I thought that it was much
easier in 1.5x vs the 1.x IDE because you can bundle everything down under the core like the modified
libraries.
This makes it a simple 1 time tar/zip extract to install the 1284 support and you are done vs having
to piece meal various core components and libraries.
It also means that you don't have any colllisions with the IDE supplied core since the IDE supplied core
will not be used (assuming you properly create the boards.txt and platform.txt files) and the core along
with its core supplied libraries will override the IDE suplied libraries.

Longer term I think the ability to override IDE supplied libraries with a core supplied library
is great for maintenance since don't have to create (or test)
a library that works on all cores, you only have to worry about the specific core.
i.e. any libraries that ship with the 1284 core only have to work with the 1284 core since
they are only used when that core is used.

--- bill
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: liuzengqiang on Feb 13, 2015, 06:28 am
Bill,

I found out what went wrong just yesterday. I downloaded 1.0.5 1284p mod with all the core files etc. but then the boards.txt and a few other files came from 1.0.6 1284p mod. I didn't know what I was doing when I did it and only realized now. With 1.0.5 IDE and 1.0.6 boards.txt that uses standard core file, I was using 1.0.5 IDE's core that doesn't have the analog channel to pin macro to do the correct mapping, although the 1.0.6 1284p mod defines it in variants pins_arduino.h. When I was using 1.0.6 IDE, it's already using this macro, so it worked. If I downloaded 1.0.5 1284p mod with the corresponding boards.txt, it would use 1284 core instead and everything would be fine. Just another learning opportunity for me.

With 1.6.0, you only need vendor_name/avr/boards.txt etc. without core files, just like 1.0.6 1284p mod. It's more clear what the changes are. With the old /core folder, I can't tell which core file needed the change.

Here is an issue I don't yet understand:
With 1.0.5 1284p mod, the boards.txt refers to a mighty core (https://github.com/JChristensen/mighty-1284p/blob/v1.0.5/boards.txt). Does this mean that I need to name my folder as mighty instead of mighty-1284p? I'll need to read arduino's 1.5 hardware specification to get some ideas of what it means to define a new core, correct?
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: JChristensen on Feb 14, 2015, 06:29 pm
Jack,

The Arduino 1.6.0 IDE is out. Out of my character, I'm trying it out. Any interest in updating the 1284P core? I made a custom core based on bobuino and it's working.
I've downloaded 1.6.0 but haven't tried it much yet.  I think that the 1.6.0 core code should support the 1284P directly, just as 1.0.6 does.  There may be some installation differences however.  Not sure when I'll get time to look into it.  Is there some burning need to use 1.6.0, something that can't be accomplished with 1.0.6?

Quote
Note: it seems that 1.0.5 uses its arduino core files even when I have the custom core folder inside mighty-1284P. Evidence is my analog pins are backwards A0 is actually A7. But if I compile with 1.0.6 it works.
Need more specifics.  What is selected in Tools > Boards?  Which version IDE?

I just made a couple updates, I was about to write an item about it when I saw your post.  One update corrected analog pin mapping for the avr-developers variant.

Last night I exhaustively tested digital and analog pin mapping for the mighty* boards and the avr-developers board and I'm pretty sure they're correct.  I'm not aware of any issues with the Bobuino variant, so no changes there.

Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: liuzengqiang on Feb 14, 2015, 07:50 pm
Jack,

The only change that concerns the mod is now it should be in arduino sketchbook/hardware/avr/might-1284p. So the added layer of things to separate different MCU architectures, which will be useful to make libraries still compatible to the developers but could be written entirely differently for different architectures.

I made a mistake installing the mod when I didn't know how to install mods. I used 1.0.6 boards.txt so everything points to arduino core. THis only works if I also use 1.0.6 IDE.

Question for you: if you define a core called mighty, should you also define the same folder name such as mighty instead of mighty-1284p? Your installation instruction says to create mighty-1284p folder.

Tests: I tested 1.6.0 IDE with your 1.0.6 mod with the correct subfolder. RTClib (adafruit), sdfat (I believe it has your mod on DigitalPin.h on 10/29/2014), phi_prompt, phi_interfaces, I2CDev (Jeff Roweberg) and liquidcrystal. They all work.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: sakugava on Feb 24, 2015, 04:56 am
read this: (http://www.leonardomiliani.com/en/2014/aggiornato-il-core-atmega644p1284p-per-lide-1-5-8-di-arduino/)
is a MOD by Leonardo Miliani, from Italy, adapted for  Arduino IDE 1.5.8, but works in 1.6.0 version
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: ish2k9c on Feb 24, 2015, 09:34 pm
hello, im planning on using the atmega1284p with arduino 1.0.6 IDE. I have no clue how to get the bootloader to work with this version of IDE. is it possible to do it? if so is there files i can download to do it ?
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: liuzengqiang on Feb 24, 2015, 11:36 pm
https://github.com/JChristensen/mighty-1284p

Instructions are on the page. Once you install, restart arduino and use arduino as isp sketch to burn bootloader to your chips. Have you burned bootloaders before?
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: legonick22 on Feb 25, 2015, 03:05 pm
I have tried to use the Mighty-1284p core with Arduino 1.6, but for me, even with the filing system right:
/arduino-1.6.0/hardware/atmegaxxx4p/AVR/...
It always says:
Arduino: 1.6.0 (Windows 7), Board: "ATmega324P"

Selected board depends on 'arduino' core (not installed).

I'm obviously using a modified version of the bootloader, since I'm using the 324p, but it always says this, even when I copy the core files from the 'arduino' folder into the atmega folder.
What should I do?

EDIT: I notice at github your files do not include the cores folder! Should my boards.txt be changed, or is this an error?
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: liuzengqiang on Feb 26, 2015, 07:26 am
You need to follow this:

https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification

Not only do you need more folders, you also need more entries in boards.txt

I didn't follow the entire spec and didn't do programmers.txt or platform.txt

It still works since avrdude is used and it already understands how to do atmega1284p

Example:

Code: [Select]

##############################################################

mighty_opt.name=Mighty 1284p 16MHz using Optiboot
mighty_opt.upload.tool=arduino:avrdude
mighty_opt.upload.protocol=arduino
mighty_opt.upload.maximum_size=130048
mighty_opt.upload.maximum_data_size=16384
mighty_opt.upload.speed=115200
mighty_opt.bootloader.tool=arduino:avrdude
mighty_opt.bootloader.low_fuses=0xff
mighty_opt.bootloader.high_fuses=0xde
mighty_opt.bootloader.extended_fuses=0xfd
mighty_opt.bootloader.file=optiboot/optiboot_atmega1284p.hex
mighty_opt.bootloader.unlock_bits=0x3F
mighty_opt.bootloader.lock_bits=0x0F
mighty_opt.build.mcu=atmega1284p
mighty_opt.build.f_cpu=16000000L
mighty_opt.build.core=arduino:arduino
mighty_opt.build.variant=standard
mighty_opt.build.board=mighty_opt


Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: JChristensen on Feb 26, 2015, 01:43 pm
I notice at github your files do not include the cores folder! Should my boards.txt be changed, or is this an error?
As of 1.0.6, all changes to support the 1284P were incorporated into the Arduino core as distributed, so there is no longer a need for the cores folder.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: AlxDroidDev on Feb 26, 2015, 04:59 pm
Can I work with the 1284 just like the 1284P (given that I change/add the proper chip signatures in avrdude.conf) ?
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: JChristensen on Feb 26, 2015, 06:14 pm
Can I work with the 1284 just like the 1284P (given that I change/add the proper chip signatures in avrdude.conf) ?
As far as I know. I believe that the only other differences between the two are the electrical specifications (and they're not that much different IIRC).
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: CrossRoads on Feb 26, 2015, 06:42 pm
There are differences. Search the datasheet for "Atmega1284P" and  you will some entries that are noted as "Applies only to Atmel ATmega1284P." The biggest is the extra timer in the 1284P

Table 12-1. Reset and Interrupt Vectors. Has Extra interrupts:
32 $003E TIMER3_CAPT(3) Timer/Counter3 Capture Event
33 $0040 TIMER3_COMPA(3) Timer/Counter3 Compare Match A
34 $0042 TIMER3_COMPB(3) Timer/Counter3 Compare Match B
35 $0044 TIMER3_OVF(3) Timer/Counter3 Overflow

Note (3) Applies only to Atmel ATmega1284P.

28.1.7 Atmel ATmega1284 DC characteristics
vs
28.1.8 Atmel ATmega1284P DC characteristics  - Picopower, so current draw is a little less in some areas
and
29.7 ATmega1284 typical characteristics
vs
29.8 ATmega1284P typical characteristics

and ordering codes
32.7 Atmel ATmega1284
32.8 Atmel ATmega1284P


Signature bytes, so a new entry in avddude.conf  will need to be added.
ATmega1284 0x1E 0x97 0x06
ATmega1284P 0x1E 0x97 0x05

Copy this whole section (excerpted here) and modify for '1284:
Code: [Select]

#------------------------------------------------------------
# ATmega1284P
#------------------------------------------------------------

# similar to ATmega164p

part
    id               = "m1284p";
    desc             = "ATMEGA1284P";
    has_jtag         = yes;
    stk500_devcode   = 0x82; # no STK500v1 support, use the ATmega16 one
    avr910_devcode   = 0x74;
    signature        = 0x1e 0x97 0x05;
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: legonick22 on Feb 26, 2015, 07:54 pm
@liudr It still tells me:
Selected board depends on 'arduino' core (not installed).
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Feb 26, 2015, 09:00 pm
Quote
Signature bytes, so a new entry in avddude.conf  will need to be added.
ATmega1284 0x1E 0x97 0x06
ATmega1284P 0x1E 0x97 0x05

Copy this whole section (excerpted here) and modify for '1284:

#------------------------------------------------------------
# ATmega1284P
#------------------------------------------------------------

# similar to ATmega164p

part
    id               = "m1284p";
    desc             = "ATMEGA1284P";
    has_jtag         = yes;
    stk500_devcode   = 0x82; # no STK500v1 support, use the ATmega16 one
    avr910_devcode   = 0x74;
    signature        = 0x1e 0x97 0x05;
-------------------
Bob, I think if you do as you indicate, then you have to make an entirely new variant in boards.txt and pins_arduino.h, and cannot use say the regular Bobuino variant with the 1284 chip.

What I did with the 1284 chips I had was to: (a) "temporarily" change the 1284P section of avrdude.conf to the 1284 signature just long enough to burn the bootloaders, and then changed it back to the original. Then I could afterwards plug either the 1284 or 1284P bootloader chip into my boards, and: (b) always use the Bobuino variant to compile and upload.

Don't ask me why (b) works with the 1284 bootloader chip when the avrdude.conf has the 1284P signature, but it does. ?? ??
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: liuzengqiang on Feb 26, 2015, 10:11 pm
@liudr It still tells me:
Selected board depends on 'arduino' core (not installed).
Is your folder hardware/mighty-1284p/avr/ or do you still have the /arduino-1.6.0/hardware/atmegaxxx4p/AVR/... as your earlier post?
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: CrossRoads on Feb 26, 2015, 10:13 pm
Quote
you have to make an entirely new variant in boards.txt and pins_arduino.h,
That'd be okay.
The boards.txt entry would then call out "atmega1284" or "mega1284" vs the P variant.
pins_arduino.h would also need the "if defined Atmega1284" type additions with the 1284P statements.

Folks do the same signature byte temp change for 328s also. It seems the serial downloader doesn't look at the signature, only the bootload installer does.
I guess the temp change is easier overall as the files that check for 328P don't need to also check for 328. Guess same would also be true for 1284P and 1284.

I only use 328P and 1284P, so I haven't had to deal with this.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Feb 26, 2015, 11:53 pm
I find it easier to just use the chips interchangeably after the bootloaders have been burned, but I guess you concur that a 'new' variant would need be defined when doing it as you described.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: legonick22 on Feb 27, 2015, 02:44 pm
Is your folder hardware/mighty-1284p/avr/ or do you still have the /arduino-1.6.0/hardware/atmegaxxx4p/AVR/... as your earlier post?
It was the latter, but I changed it to the former. Still gives the same error.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Feb 27, 2015, 05:40 pm
I may be wrong, but I don't think there is any support at all for the 324 chip in the IDEs. You can't use 1284 core or variants.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: legonick22 on Feb 27, 2015, 07:39 pm
@oric_dan I have been able to burn bootloaders to the 324p in 1.0.6 just fine - it's 1.6 that's my issue.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Feb 27, 2015, 08:39 pm
Quote
I have tried to use the Mighty-1284p core with Arduino 1.6, but for me, even with the filing system right:
/arduino-1.6.0/hardware/atmegaxxx4p/AVR/...
It always says:
Arduino: 1.6.0 (Windows 7), Board: "ATmega324P"

Selected board depends on 'arduino' core (not installed).
Well, it sounds to me like you're mixing things that aren't the same thing, so not too surprising it doesn't work. I've never tried the 324, and not tried using the 1284 support for anything other than 1284 chips. If you look around in the core and the libraries, you'll find statements like this literally everywhere, and if 324 is not listed, then I don't see it is supported.
Code: [Select]
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) ||
defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) ||
defined(__AVR_ATmega644__) || defined(__AVR_ATmega644A__) ||
defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__)
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: legonick22 on Feb 27, 2015, 09:09 pm
So... why does it work for 1.0.6 but not 1.6?
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Feb 27, 2015, 09:23 pm
I knew that was going to be your next question, :-), and all I can say is, I have no idea why it would work when there is absolutely no support for it in the IDE. ??

When I started using the 1284 back in early 2013, I went into essentially every source file in the IDE core and libraries, and "fixed" them to add 1284 support where it did not exist. And that's what all these dozens of 1284 threads have been about too.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: legonick22 on Mar 03, 2015, 06:22 pm
AHA!!! I found the error: the file hardware/mighty_1284p/AVR/... should be /avr !
It compiles now! (Sadly, still with the sync errors I describe in my other thread)

Note to everybody else: directory names are CASE SENSITIVE!
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: liuzengqiang on Mar 03, 2015, 07:50 pm
AHA!!! I found the error: the file hardware/mighty_1284p/AVR/... should be /avr !
It compiles now! (Sadly, still with the sync errors I describe in my other thread)

Note to everybody else: directory names are CASE SENSITIVE!
Good tip! I just typed in lower case without thinking it has to be. Guess [Aa][Vv][Rr] was not used for searching the folder ;)
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: pico on Mar 03, 2015, 11:59 pm
So... why does it work for 1.0.6 but not 1.6?
I've actually recently discussed this offline with Bill (bperrybap). The reason it works in 1.0.x but not in 1.6.x is because the arduino core in 1.0.x is located in

   hardware/arduino/cores/arduino

but in 1.0.6 this has changed to

   hardware/arduino/avr/cores/arduino

why did they do this? Because now they also have a sam core files under hardware/arduino

So, they differentiated the two architectures by changing the path name, to include the architecture.

So far so good. But this is where it gets ugly.

The syntax for locating a core in boards.txt is like this:

   bobuino.build.core=arduino:arduino

where the path to the core is [vendor-id]:[core-id]

This is the same as in 1.0.x. You would think that would change in 1.6.x to something like

   bobuino.build.core=arduino:avr:arduino

i.e.

   [vendor-id]:[architecture]:[core-id]

so that the architecture is in the path is specified, and the two paths

   hardware/arduino/avr/cores/arduino

and

   hardware/arduino/sam/cores/arduino

are disambiguated, for example.

Otherwise, just using arduino:arduino how do the IDE know which core to use?

But no. Explicitly specifying [vendor-id]:[architecture]:[core-id] would be too, er, straightforward.

Instead, what they appear to have done is to infer the architecture implicitly from the path name of the boards.txt file that refers to the core file.

So, basically, it gets the avr part of the path name for

   hardware/arduino/avr

from the fact the boards.txt file it is reading is located at

   hardware/mighty_1284p/avr

Which is why you have to specify the architecture of the mighty_1284p as avr in 1.6.x but you don't need to do this in 1.0.x.

Even though, of course, there is never going to be a mighty_1284p/sam (or any other architecture besides avr) among the mighty_1284p variants.

I told you it got ugly.

What were they thinking? (Which, upon reflection, seems to be the eternal question when looking at the design decisions behind any version of the Arduino IDE...)

But that's what they've done.

Anyway, because we've got to take all this stuff into consideration when packaging up the mighty_1284p download for 1.6.x, I've started a new thread just on this topic.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: liuzengqiang on Mar 05, 2015, 12:55 am
Pico,

Thanks for the explanation.

I have a question: in arduino's own boards.txt core=arduino is sufficient to specify arduino's arduino core (default vendor being Arduino?!) but in a custom vendor hardware folder, you need core=arduino:arduino to specify the same arduino core within arduino IDE folder?
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: pico on Mar 05, 2015, 02:46 am
Pico,

Thanks for the explanation.

I have a question: in arduino's own boards.txt core=arduino is sufficient to specify arduino's arduino core (default vendor being Arduino?!) but in a custom vendor hardware folder, you need core=arduino:arduino to specify the same arduino core within arduino IDE folder?
If you don't specify the vendor-id, it appears the vendor-id is inferred from the location of the boards.txt file.

So if the boards.txt is in hardware/arduino/avr, and the vendor-id is not specified, the vendor-id is assumed to be arduino.

Similarly, if the boards.txt is in hardware/mighty_1284p/avr, and the vendor-id is not specified, the vendor-id would be assumed to be mighty_1284p.

So "arduino" is not actually the default vendor-id per se, but rather is assumed form the boards.txt location in that case.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: bperrybap on Mar 05, 2015, 06:24 am
Some of what creates confusion is that Team Arduino used the term "arduino" to refer to literally everything
- the name of the board
- the name of the IDE
- the name of the "language"
- the name of the libraries
- the vendor name
- the name of the core
- a philosophy
- a way of life
(the last two were mentioned by a couple of the Team Arduino members)

Because of this when you see a string like "arduino" in something like a boards.txt file
you can't be quite sure what it is referencing.


When there as a thread about the confusion over the term "arduino" 5-6 years ago,
I kind bashed the arduino team for not coming up with better terms for things
and then I wrote a paragraph that used all of them correctly; however,
it was literally impossible to tell what it meant.
It was actually comical to see all the various references together and made the point as to how
how it was impossible to know what somebody means when they say "arduino".

A few of them were not amused.

--- bill
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: liuzengqiang on Mar 15, 2015, 03:52 am
So "everything is included" can be translated into (-arduino,+arduino) or Arduino considering the arduino symbol already includes - + and infty.
 ;)
Title: using atmega1284(P) on IDE 1.6.1
Post by: GertSanders on Mar 15, 2015, 12:20 pm
After reading quite a few posts I managed to compile my code for a atmega1284 (the non pico-power version) in the new version of the IDE 1.6.1 based on the following:

I loaded the Mighty-1284P core definition by Jack Christensen (many thanks for making this available on GitHub) in the 'hardware' subdirectory of my sketches directory.

In IDE 1.6.1 you no longer need the "core" subdirectory because the atmega1284 (and atmega1284P) is now known in the defaults Arduino cores.

But I did need to adapt the "boards.txt" file to get the compilations error free. I'm also using the "standard" pinout definitions in the Mighty-1284P files (standard under variants).

Since I loaded my atmega1284 with the Optiboot bootloader using the sketches by Nick Gamon (another great thanks to him !!!), I needed to change the signature for my chip version.

Also the self detect sketch needs to be updated with the signature of the atmega1284, since it only contains the signature of the atmega1284p.

I temporarily changed the signature of the atmega1284p in his boot loader sketch to match the signature of the atmega1284 (last byte is 06 instead of 05) and then programmed the atmega1284p version of optiboot into the atmega1284. Doing this allows me to use both types when programming sketches via the FTDI cable.

So first the changes in the boards.txt file. To keep from mixing with the existing files I made my own boards.txt file with the content below. This can also be changed in the original boards.txt file. The prefix "gsan_opt_" is not relevant.


##############################################################
gsan_opt.name=atmega1284 16MHz using Optiboot
gsan_opt.upload.tool=arduino:avrdude
gsan_opt.upload.protocol=arduino
gsan_opt.upload.maximum_size=130048
gsan_opt.upload.maximum_data_size=16384
gsan_opt.upload.speed=115200

gsan_opt.bootloader.tool=arduino:avrdude
gsan_opt.bootloader.low_fuses=0xf7
gsan_opt.bootloader.high_fuses=0xde
gsan_opt.bootloader.extended_fuses=0xfd
gsan_opt.bootloader.file=optiboot/optiboot_atmega1284p.hex
gsan_opt.bootloader.unlock_bits=0x3F

gsan_opt.bootloader.lock_bits=0x0F
gsan_opt.build.mcu=atmega1284
gsan_opt.build.f_cpu=16000000L

gsan_opt.build.board=AVR_ATMEGA1284
gsan_opt.build.core=arduino:arduino
gsan_opt.build.variant=standard


The change in Nick Gamon's sketch to load Optiboot was as follows:


In Atmega_Board_Programmer (v1.31):

around line 322:

 // ATmega1284P family
 { { 0x1E, 0x97, 0x05 }, "ATmega1284P", 128 * kb,   1 * kb,
 #if USE_ATMEGA1284
       optiboot_atmega1284p_hex,

Needs to be changed into

 // ATmega1284P family
 { { 0x1E, 0x97, 0x06 }, "ATmega1284P", 128 * kb,   1 * kb,
 #if USE_ATMEGA1284
       optiboot_atmega1284p_hex,

I would prefer if the sketch incorporated a second signature for the non-pico power version, the Optiboot version can be the same in both cases.

Another sketch where the signature would need to be added is the one where another Arduino is used as ISP for the target atmega1284. Since I use an FTDI cable directly to my breadboarded atmega1284, I did not change this. This is future work.

But with the above changes I was able to compile my sketch under IDE 1.6.1

Uploading with an FTDI friend from Adafruit worked without a problem, under the condition that I changed the crystal oscillator setting to full swing.

I use my atmega1284 in a minimal breadboard setup.

For those with problems loading large sketches on the atmega1284: make sure you fuses are set for Full Swing oscilation (f7 instead of ff on the low fuses setting of the boot loader).

I tested loading several sketches up to 130029 bytes in length and it works consistently. They also run until the end as expected.

Knowing that Optiboot does not use the full 1024 bytes now reserved for the boot section, one could imagine making another 512 byte available for programs, but I'm not greedy at the moment. 130048 bytes is plenty for what I need now. Me izz happy bunny :-)
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: Constantin on Jun 06, 2015, 02:39 pm
You guys are amazing. I started using the 1284p a few years back before switching most of my work to Teensy. However, some things are better done on an AVR, and the 1284p is perfect for my latest project, monitoring a multitude of 1-wire devices.  Thank you for updating the core/board/etc files to make it possible!!!

Quick question: why is the AVR-developer version not more popular a configuration? Having the hardware interrupt pins on otherwise unassigned pins seems like a much better solution than having them do double duty with RX1 and TX1.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: oric_dan on Jun 06, 2015, 08:10 pm
I don't know what the developer variant says, but INT0,INT1 are fixed in chip hardware on the mega1284 on the same pins as RX1,TX1. Atmel did that, we have to live with it. If you want to use UART1, then you have only INT2 left, besides the pin-change interrupts.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: Constantin on Jun 06, 2015, 11:58 pm
Oric-Dan, thank you so much! Now I'll get to immerse myself in pcint libraries vs. suffering for ages trying to figure out why the AVR developer version of the chip isn't working. 

Too bad the hardware interrupts can't be handled by those pins. Would make life a lot easier for me. Anyhow, thank you, thank you, thank you. You probably just saved a tuft full of hair from early extinction.
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: GreyGnome on Jun 15, 2015, 01:50 pm
@Constantin- you mention pcint libraries. Thought I'd mention that 644/1284(p) support has been added to the EnableInterrupt library. See http://forum.arduino.cc/index.php?topic=313323
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: pico on Jun 15, 2015, 06:28 pm
You guys are amazing. I started using the 1284p a few years back before switching most of my work to Teensy. However, some things are better done on an AVR, and the 1284p is perfect for my latest project, monitoring a multitude of 1-wire devices.  Thank you for updating the core/board/etc files to make it possible!!!
Just to note that development is still continuing with support recently added for the 1.6.x IDEs. I've created a new thread just for the 1.6.x updates:

Mighty-1284p repo updated for IDE 1.6.x (http://forum.arduino.cc/index.php?topic=321805.0)

Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: mcnobby on Jun 27, 2015, 10:09 am
I am still having trouble with my ATMEGA1284 with cores on 1.6.3

here is the trouble, if I try and output to a port (in C) it ALWAYS directs it to PortD

Code: [Select]
#define PIN 7
// PA7 drives PD7
// PD7 drives PD7 !
// PC7 drives PD7
// PB7 drives PD7
// Pin 7 drives PD7

void setup() {
  pinMode(PIN, OUTPUT);
}

void loop() {
  digitalWrite(PIN, HIGH);   
  delay(10);             
  digitalWrite(PIN, LOW);   
  delay(10);             


if I do this is ASM using
Code: [Select]
[port] "i" (_SFR_IO_ADDR(PORT_X))
then it works fine

This has driven me round the bend !
can anyone help please ?

Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: mcnobby on Jun 27, 2015, 10:47 am
but yet it knows about port B because this works...

Code: [Select]
void setup() {
  DDRB = 11111111; //  pinMode(PIN, OUTPUT);
}

void loop() {
  PORTB = 11111111; // digitalWrite(PIN, HIGH);   
  delay(10);             
  PORTB = 00000000; //digitalWrite(PIN, LOW);   
  delay(10); 
}
Title: Re: Mighty-1284P core updated for Arduino 1.0.6
Post by: pico on Jun 27, 2015, 12:35 pm
If you are using the v1.6.3 branch of the repo, I suggest moving the question to that thread:

http://forum.arduino.cc/index.php?topic=321805.30 (http://forum.arduino.cc/index.php?topic=321805.30)

Don't forget to mention what variant you are using.