0

Data logger fails to initialize SD card with Mega 2560
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Data logger fails to initialize SD card with Mega 2560

by pyTronix on Fri Feb 26, 2021 4:14 am

Adafruit Assembled Data Logging shield for Arduino PRODUCT ID: 1141, Working on Arduino UNO R3 fails to initialize SD card when installed in Arduino MEGA2560 R3.
After replacing the standard SD.h library with Adafruit provided at https://github.com/adafruit/SD.git, and modifying Cardinfo making: const int chipSelect = 10; pinMode(53, OUTPUT); and while (!card.init(SPI_HALF_SPEED, 10, 11, 12, 13)) {, the failure persisted.

This was the result editing Sd2Card changing #define MEGA_SOFT_SPI 0 to #define MEGA_SOFT_SPI 1:

C:\Users\rolan\OneDrive\Documents\Arduino\libraries\SD\utility\Sd2Card.cpp: In member function 'uint8_t Sd2Card::setSckRate(uint8_t)':
C:\Users\rolan\OneDrive\Documents\Arduino\libraries\SD\utility\Sd2Card.cpp:585:3: error: 'SPI' was not declared in this scope
SPI.setClockDivider(v);
^~~
C:\Users\rolan\OneDrive\Documents\Arduino\libraries\SD\utility\Sd2Card.cpp:585:3: note: suggested alternative: 'SPIE'
SPI.setClockDivider(v);
^~~
SPIE
exit status 1
Error compiling for board Arduino Mega or Mega 2560.

Several SD cards freshly formatted using THE SD-3C, LLC formatter were used to exclude the card as a source of the issue, three working Arduino MEGA2560 R3 were used to exclude the board a source of the issue.

pyTronix
 
Posts: 5
Joined: Tue Oct 08, 2013 2:13 am

Re: Data logger fails to initialize SD card with Mega 2560

by ieee488 on Sat Feb 27, 2021 6:00 pm

On that page https://github.com/adafruit/SD that you linked,
they wrote this library fork is being archived - the Arduino SD lirbary has all these capabilities in it now.
It is dated July 25, 2019

In addition, I am not sure what THE SD-3C, LLC is.
I use https://www.sdcard.org/downloads/formatter/sd-memory-card-formatter-for-windows-download/

ieee488
 
Posts: 5
Joined: Sat Aug 24, 2019 10:24 pm

Re: Data logger fails to initialize SD card with Mega 2560

by pyTronix on Sun Feb 28, 2021 2:16 pm

"In addition, I am not sure what THE SD-3C, LLC is.
I use https://www.sdcard.org/downloads/format ... -download/

SD and related marks and logos are trademarks of SD-3C LLC.
© 2000 - 2021 SD-3C LLC. All Rights Reserved.

pyTronix
 
Posts: 5
Joined: Tue Oct 08, 2013 2:13 am

Please be positive and constructive with your questions and comments.