SD Card + ASF doesn't work

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi.

What I have to do to use SD Card in Atmel Studio.

I add all necessary parts for SD CARD from ASF, but It doesn't work.

I get error 240 from sd_mmc_check(slot).

I know that board is OK, because I use SAME70 Explained and It works with ASF Example.

 

 

My main in main.c:

char test_file_name[] = "0:sd_mmc_test.txt";
	Ctrl_status status;
	FRESULT res;
	FATFS fs;
	FIL file_object;
	const usart_serial_options_t usart_serial_options = {
		.baudrate   = CONF_TEST_BAUDRATE,
		.charlength = CONF_TEST_CHARLENGTH,
		.paritytype = CONF_TEST_PARITY,
		.stopbits   = CONF_TEST_STOPBITS,
	};

	irq_initialize_vectors();
	cpu_irq_enable();
	/* Insert system clock initialization code here (sysclk_init()). */
	sysclk_init();
	board_init();
	stdio_serial_init(CONF_TEST_USART, &usart_serial_options);
	/* Insert application code here, after the board has been initialized. */
	sd_mmc_init();
	uint8_t slot = 0;
	card_version_t card_version;
	slot = sd_mmc_nb_slot();
	card_version = sd_mmc_get_version(slot);
	while(1);

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can't believe Atmel wrote an sd_mmc_init() function with a void return!

 

The most likely thing is that the card init does not work for some reason but I guess you'll never know if they don't return an error code?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You have to remove this definition #define CONF_BOARD_ENABLE_CACHE.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't know if this is any help, but I recently got HSMCI working on an S70 in 4 bit mode. The project is an Atmel Start one (ASF4) https://github.com/nsayer/Orthrus

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thx, I solved it. Issue caused that constant above.