Go Down

Topic: Mighty-1284P core updated for Arduino 1.0.6 (Read 15375 times) previous topic - next topic

oric_dan

#15
Nov 05, 2014, 06:39 pm Last Edit: Nov 05, 2014, 07:44 pm by oric_dan
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

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

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.

cyclegadget

#16
Nov 05, 2014, 07:18 pm Last Edit: Nov 05, 2014, 07:23 pm by cyclegadget
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");
Good links: Eagle tutorial= http://www.youtube.com/playlist?list=PLDE1858BD83D19C70
General Arduion tutorials = http://tronixstuff.wordpress.com
http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=123

oric_dan

#17
Nov 05, 2014, 07:25 pm Last Edit: Nov 05, 2014, 07:42 pm by oric_dan
@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

cyclegadget

#18
Nov 05, 2014, 08:53 pm Last Edit: Nov 05, 2014, 08:58 pm by cyclegadget
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.
Good links: Eagle tutorial= http://www.youtube.com/playlist?list=PLDE1858BD83D19C70
General Arduion tutorials = http://tronixstuff.wordpress.com
http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=123

oric_dan

#19
Nov 05, 2014, 09:55 pm Last Edit: Nov 05, 2014, 10:02 pm by oric_dan
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

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].

cyclegadget

 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
Good links: Eagle tutorial= http://www.youtube.com/playlist?list=PLDE1858BD83D19C70
General Arduion tutorials = http://tronixstuff.wordpress.com
http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=123

oric_dan

#21
Nov 05, 2014, 10:58 pm Last Edit: Nov 05, 2014, 11:01 pm by oric_dan
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

mrburnette

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

oric_dan

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.

mrburnette

#24
Nov 08, 2014, 04:17 am Last Edit: Nov 08, 2014, 07:05 am by mrburnette
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

oric_dan

#25
Nov 08, 2014, 06:55 am Last Edit: Nov 08, 2014, 08:21 am by oric_dan
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

1. SD: 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 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 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 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.

mrburnette

#26
Nov 08, 2014, 07:21 am Last Edit: Nov 08, 2014, 07:49 am by mrburnette
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

oric_dan

#27
Nov 08, 2014, 07:27 am Last Edit: Nov 08, 2014, 07:32 am by oric_dan
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.

larryd

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.

No technical PMs.
The last thing you did is where you should start looking.

mrburnette


Go Up