OPEnSLab-OSU/Loom

SD Failed to Initialize

Closed this issue · 3 comments

Describe the bug
Code compiles and uploads successfully but fails to initialize the SD, thus no data is recorded. The sensors will still report data to the console, they just go unrecorded.

Hardware in Use
Arduino Feather M0
Hypnos

To Reproduce
Steps to reproduce the behavior:

  1. Upload Hypnos_SD example to M0 board
  2. Open Console

Expected behavior
The SD card should Initialize

Code

///////////////////////////////////////////////////////////////////////////////

// This is a basic example that demonstrates usage of the Hypnos board.

// The Hypnos board includes
// - SD
// - DS3231 RTC
// - Ability to power of peripherals

// Further details about the Hypnos board can be found here:
// https://github.com/OPEnSLab-OSU/OPEnS-Lab-Home/wiki/Hypnos

///////////////////////////////////////////////////////////////////////////////

#include <Loom.h>

// Include configuration
const char* json_config = 
#include "config.h"
;

// Set enabled modules
LoomFactory<
	Enable::Internet::Disabled,
	Enable::Sensors::Enabled,
	Enable::Radios::Enabled,
	Enable::Actuators::Enabled,
	Enable::Max::Enabled
> ModuleFactory{};

LoomManager Loom{ &ModuleFactory };



void setup() 
{
	// Needs to be done for Hypno Board
	pinMode(5, OUTPUT);		// Enable control of 3.3V rail 
	pinMode(6, OUTPUT);		// Enable control of 5V rail 

	//See Above
	digitalWrite(5, LOW);	// Enable 3.3V rail
	digitalWrite(6, HIGH);	// Enable 5V rail

	Loom.begin_serial(true);
	Loom.parse_config(json_config);
	Loom.print_config();

	LPrintln("\n ** Setup Complete ** ");
}


void loop() 
{
	Loom.measure();
	Loom.package();
	Loom.display_data();

	// Log using default filename as provided in configuration
	// in this case, 'datafile.csv'
	Loom.SDCARD().log();

	Loom.pause();	
}

Config

"{\
	'general':\
	{\
		'name':'Device',\
		'instance':1,\
		'interval':5000,\
		'print_verbosity':2\
	},\
	'components':[\
		{\
			'name':'Analog',\
			'params':'default'\
		},\
		{\
			'name':'SD',\
			'params': 'default'\
		},\
		{\
			'name':'DS3231',\
			'params':'default'\
		}\
	]\
}"

Additional context
I have seen Max use the exact same board and Hypnos and it worked for him. I am unsure what is the cause .

Changing the version of the Adafruit SAMD core to v1.5.7 fixes the issue. I will investigate what change caused this problem.

To change the version of the Adafruit SAMD core you are using:

  1. In Arduino, navigate to Tools->Board->Boards Manager, and wait for the window to finish loading.
  2. In the search box, type Adafruit SAMD. There should be a two results, one labeled Adafruit SAMD Boards and the other labeled Arduino SAMD Boards (32-bits ARM Cortex-M0+). Next to the title, there should be text indicating which version of each board profile you have installed. If the installed version of the Adafruit SAMD Boards profile is v1.5.7, then this fix will not work and you should submit a separate issue with your code and symptoms.
  3. We will now downgrade the Adafruit board profile to v1.5.7. Click on Adafruit SAMD Boards, select v1.5.7 from the dropdown list, and click the Install button. Arduino will download and extract board profile, which may take some time.
  4. Close the Boards Manager window.

After completing the instructions above, you should be able to use an SD card with Loom. If you continue to experience the SD initialization failed error, please submit another issue with your code and symptoms.

I have filed an issue with the Adafruit SAMD core and the SdFat library to address this bug.

Hello I have problem in Sd root error to make in display lcd how the solve it thank you