Nick,
Are you around?
I made these additions to a Bobuino2 (1284P), double checked wiring with a meter, wrote some test codes & tested that D4,5,6,7,A0,A1, A2 all toggled a test LED and the correct signal LED when a button on D2 was pressed.
Confirmed programming header is wired up:
MISO D6 +5
SCK D4 MOSI D7
Reset D5 Gnd
Downloaded the 1.25a code from here
I don't have a memory card inserted yet, because I can't find the folder
C:\Users\CROSSR~1.CRO\AppData\Local\Temp\build3718148874247167592.tmp\filename.cpp.hex
to grab the blink file saved as filename.ino & compiled for a test which is pretty aggravating by itself.
When I power up, the L led turns off, and I get 5 Red flashes. I'm connected to a working Uno card.
Any ideas what to pursue here?
Do I need a 1284p section here?
I did tell you I only planned to use this from a '328P, but this is the only way I have to access an SD card at the moment so I figured I'd give it a shot before I ordered custom '328P cards which I just finished cleaning up yesterday.
// bit banged SPI pins
#ifdef __AVR_ATmega2560__
// Atmega2560
const byte MSPIM_SCK = 4; // port G bit 5
const byte MSPIM_SS = 5; // port E bit 3
const byte BB_MISO = 6; // port H bit 3
const byte BB_MOSI = 7; // port H bit 4
#else
// Atmega328
const byte MSPIM_SCK = 4; // port D bit 4
const byte MSPIM_SS = 5; // port D bit 5
const byte BB_MISO = 6; // port D bit 6
const byte BB_MOSI = 7; // port D bit 7
#endif
// bit banged SPI pins
#ifdef __AVR_ATmega2560__
// Atmega2560
const byte MSPIM_SCK = 4; // port G bit 5
const byte MSPIM_SS = 5; // port E bit 3
const byte BB_MISO = 6; // port H bit 3
const byte BB_MOSI = 7; // port H bit 4
#endif
#ifdef __AVR_ATmega1284P__
// Atmega1284P
const byte MSPIM_SCK = 4; // port B bit 0
const byte MSPIM_SS = 5; // port B bit 1
const byte BB_MISO = 6; // port B bit 2
const byte BB_MOSI = 7; // port B bit 3
#else
// Atmega328
const byte MSPIM_SCK = 4; // port D bit 4
const byte MSPIM_SS = 5; // port D bit 5
const byte BB_MISO = 6; // port D bit 6
const byte BB_MOSI = 7; // port D bit 7
#endif
Also, for debugging, run the hex uploader sketch (the one that writes to the serial port). The messages there might make it easier to see what is going on.
Yes, 5 flashes about 1 second apart. L light flicks on really fast between the 5 flashes.
Does the same with blank SD card.
How do I get a .hex file to put on the SD card?
I searched all over my PC trying to find a sketch using the path in the IDE, it's like it goes into a hidden directory, or is being deleted. Searching from c:/ on down yields nothing.
Can you attach a simple hex file I can put on the SD card for a test?
The card has been formatted using the windows formatter from sdcard.com and is blank.
I just noticed your sketch says SDfat.h is needed - I just looked and I seem to be missing that!
I need to download that from Bill G's site.
I didn't notice an error about it when the sketch compiled. Odd.
I see a lot of Red stuff when I compile. I know some are warnings and can be ignored, but I don't which those are for certain.
C:\Program Files (x86)\Arduino\libraries\SdFat\istream.cpp: In member function 'void istream::getBool(bool*)':
C:\Program Files (x86)\Arduino\libraries\SdFat\istream.cpp:93: warning: only initialized variables can be placed into program memory area
C:\Program Files (x86)\Arduino\libraries\SdFat\istream.cpp:94: warning: only initialized variables can be placed into program memory area
:
:
C:\Program Files (x86)\Arduino\libraries\SdFat\ostream.cpp: In member function 'void ostream::putBool(bool)':
C:\Program Files (x86)\Arduino\libraries\SdFat\ostream.cpp:50: warning: only initialized variables can be placed into program memory area
C:\Program Files (x86)\Arduino\libraries\SdFat\ostream.cpp:52: warning: only initialized variables can be placed into program memory area
C:\Program Files (x86)\Arduino\libraries\SdFat\ostream.cpp: In member function 'void ostream::putDouble(double)':
C:\Program Files (x86)\Arduino\libraries\SdFat\ostream.cpp:84: warning: only initialized variables can be placed into program memory area
:
:
C:\Program Files (x86)\Arduino\libraries\SdFat\SdBaseFile.cpp: In static member function 'static bool SdBaseFile::make83Name(const char*, uint8_t*, const char**)':
C:\Program Files (x86)\Arduino\libraries\SdFat\SdBaseFile.cpp:358: warning: only initialized variables can be placed into program memory area
:
:
C:\Program Files (x86)\Arduino\libraries\SdFat\SdFatErrorPrint.cpp: In member function 'void SdFat::errorPrint()':
C:\Program Files (x86)\Arduino\libraries\SdFat\SdFatErrorPrint.cpp:62: warning: only initialized variables can be placed into program memory area
C:\Program Files (x86)\Arduino\libraries\SdFat\SdFatErrorPrint.cpp:64: warning: only initialized variables can be placed into program memory area
C:\Program Files (x86)\Arduino\libraries\SdFat\SdFatErrorPrint.cpp: In member function 'void SdFat::errorPrint(const char*)':
C:\Program Files (x86)\Arduino\libraries\SdFat\SdFatErrorPrint.cpp:73: warning: only initialized variables can be placed into program memory area
C:\Program Files (x86)\Arduino\libraries\SdFat\SdFatErrorPrint.cpp: In member function 'void SdFat::errorPrint_P(const prog_char*)':
C:\Program Files (x86)\Arduino\libraries\SdFat\SdFatErrorPrint.cpp:83: warning: only initialized variables can be placed into program memory area
C:\Program Files (x86)\Arduino\libraries\SdFat\SdFatErrorPrint.cpp: In member function 'void SdFat::initErrorPrint()':
C:\Program Files (x86)\Arduino\libraries\SdFat\SdFatErrorPrint.cpp:115: warning: only initialized variables can be placed into program memory area
C:\Program Files (x86)\Arduino\libraries\SdFat\SdFatErrorPrint.cpp:117: warning: only initialized variables can be placed into program memory area
C:\Program Files (x86)\Arduino\libraries\SdFat\SdFatErrorPrint.cpp:121: warning: only initialized variables can be placed into program memory area
C:\Program Files (x86)\Arduino\libraries\SdFat\SdFatErrorPrint.cpp:123: warning: only initialized variables can be placed into program memory area
C:\Program Files (x86)\Arduino\libraries\SdFat\SdFatErrorPrint.cpp:125: warning: only initialized variables can be placed into program memory area
:
:
C:\Program Files (x86)\Arduino\libraries\SdFat\SdFile.cpp: In member function 'void SdFile::writeln_P(const prog_char*)':
C:\Program Files (x86)\Arduino\libraries\SdFat\SdFile.cpp:82: warning: only initialized variables can be placed into program memory area
:
:
C:\Program Files (x86)\Arduino\hardware\mighty-1284p\cores\mighty\HardwareSerial.cpp: In function 'void store_char(unsigned char, ring_buffer*)':
C:\Program Files (x86)\Arduino\hardware\mighty-1284p\cores\mighty\HardwareSerial.cpp:98: warning: comparison between signed and unsigned integer expressions
C:\Program Files (x86)\Arduino\hardware\mighty-1284p\cores\mighty\HardwareSerial.cpp: In function 'void __vector_20()':
C:\Program Files (x86)\Arduino\hardware\mighty-1284p\cores\mighty\HardwareSerial.cpp:127: warning: unused variable 'c'
C:\Program Files (x86)\Arduino\hardware\mighty-1284p\cores\mighty\HardwareSerial.cpp: In function 'void __vector_28()':
C:\Program Files (x86)\Arduino\hardware\mighty-1284p\cores\mighty\HardwareSerial.cpp:153: warning: unused variable 'c'
C:\Program Files (x86)\Arduino\hardware\mighty-1284p\cores\mighty\HardwareSerial.cpp: In member function 'void HardwareSerial::begin(long unsigned int, byte)':
C:\Program Files (x86)\Arduino\hardware\mighty-1284p\cores\mighty\HardwareSerial.cpp:368: warning: unused variable 'current_config'
C:\Program Files (x86)\Arduino\hardware\mighty-1284p\cores\mighty\HardwareSerial.cpp: In member function 'virtual size_t HardwareSerial::write(uint8_t)':
C:\Program Files (x86)\Arduino\hardware\mighty-1284p\cores\mighty\HardwareSerial.cpp:467: warning: comparison between signed and unsigned integer expressions
:
:
C:\Program Files (x86)\Arduino\hardware\mighty-1284p\cores\mighty\Print.cpp: In member function 'size_t Print::print(const __FlashStringHelper*)':
C:\Program Files (x86)\Arduino\hardware\mighty-1284p\cores\mighty\Print.cpp:44: warning: '__progmem__' attribute ignored
:
:
C:\Program Files (x86)\Arduino\hardware\mighty-1284p\cores\mighty\Tone.cpp:119: warning: only initialized variables can be placed into program memory area
No change in performance with SDfat library in place & the IDE restarted, altho the blinking does seem to be slower after a fresh download.
Tried the unmodified Hex uploader. That makes a Ton of Red when compiled! Very impressive amount!
Okay, this is not working on the '1284P
Card was fully formatted, vs quick format.
The info about the processor is incorrect too.
Time to withdraw to a '328P instead?
Atmega hex file uploader.
Written by Nick Gammon.
Version 1.26
Compiled on Mar 1 2015 at 22:20:19 with Arduino IDE 106.
Reading SD card ...
Invalid format, reformat SD.
--------- Starting ---------
Attempting to enter programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x95 0x0F
Processor = ATmega328P
Flash memory size = 32768 bytes.
LFuse = 0xFF
HFuse = 0xD6
EFuse = 0xFD
Lock byte = 0xCF
Clock calibration = 0x8C
Actions:
[E] erase flash
[F] modify fuses
Enter action:
Programming mode off.
Ok, found a 2GB card, these 16GBs are both dead apparently.
Hexfile uploader is working now.
Good to see the SD card part of the Bobuino2 is working.
Fast blink.
Rebootloaded the Uno (duemilanove actually) and put slow blink program on via Serial.
Uploaded Standalone programmer back into 1284.
With my 1284 mod attempts, it blinks Red twice -
Red x 2 = Cannot read file 'firmware.hex'
Without the mods, your original program, it blinks Red 3 times -
Red x 3 = Cannot enter programming mode in target chip