Using the on-board SD-Slot of a SAM4S Xplained Pro

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

Hi Everyone,

 

I have been trying to use the on-board SD-Slot of a SAM4S Splained Pro, but so far I can only get back "CARD UNUSABLE" status. I have tried many different approaches and am puling my hair for days on this.

So far I did change accordingly the card CD Gpio from portc C/27 to port C/12, and also configured all the initialization steps I could think of.

I am using ASF under Atmel Studio 6.2 and accessing the card via the HSMCI interface.

I have added all the modules via the ASF Wizard, correctly I believe.

Considering that this is my first project with the SAM4S Xplained Pro I may be forgetting to do something, or making a mistake, so at this point I can only ask someone who may have succeeded in accessing the on-board SD-slot to share a piece of code which shows the "Rosetta Stone".

 

Thanks a lot,

Marcelo.

Last Edited: Wed. May 13, 2020 - 11:15 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry to bump.

Is anyone there using this SAM4S Xplained pro who could share a bit of thought?

 

Thanks a lot,

Marcelo.

 

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

Hi,

 

You asked this question via PB, here is my answer (also as PB to you) :

Hi Marcelo,

 

First, I'm not using ASF, I wrote my own routines to access the different peripherals in the SAM4S device.  So if your question concerns ASF, I cannot help you...

But, I created a project on Atmel Spaces where I have published my sourcecode.  I suggest you take a look there.  There is an article on how you can obtain the sourcecode from the repository. 

The most important classes for accessing the SD card in HSMCI-mode are SPg_HSMCard(.h & .cpp), SPg_SDCard, SPg_Storrage etc, and of corse the whole FatFS framework.

Please do not hesitate to contact me if you need further assistance ;)


Greetz,

 

Paul.

Did this solved your question ?

 

Paul.

"As simple as possible, but not simpler"

GUI Framework for Atmel Xplained Pro

Last Edited: Thu. Dec 11, 2014 - 12:05 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Paul,

 

Yes, it did answer.

Thanks for the prompt reply.

 

I am now working on getting the ASF replaced by your framework. 

 

Thanks immensely,

Marcelo.

 

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

I'm suffering from the same issue, just using a sample project! The project is configured to use SPI for the SD card interface though. But gpio_pin_is_low(SD_MMC_0_CD_GPIO) is always returnening false.

 

Paul, I envision your post may be helpful to me, but I don't see a link to the source code. A google search brought me to http://www.paulvandenbergh.be/in..., but I still don't see source. Is that something you can pass me the link to?

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

Hi Aaron,

 

I am still banging my head on this.

In fact I gave up trying right after I got Paul's code, and put my SAM4S on a drawer.

Now that Atmel Studio 7 came out I got my board back and decided to give it another try. Still no joy.

I am able (using Atmel ASF) to make the card detect signal work (it is defined incorrectly on the ASF code example, it is PC12, not PA6), but that's about it.

Once I try to initialize the card, it stays on the "DEBOUNCE" status forever.

 

Please let me know if you were able to go any further on this.

 

Cheers,

Marcelo.

 

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

Using the ASF code for the SAM4E-EK and what schematics I could find online for the SAM4S Xplained Pro, I was finally able to edit the ASF source files to initialize and use the on-board SD card slot!

 

The edited ASF source code is available in an example project that comes with my company's open-source IoT filesystem, Reliance Edge, which is available here: https://github.com/datalightinc/... .

 

If you want to skip to the ASF source code changes that enable the on-board SD card, search for "CUSTOMIZATION" in sam4s_xplained_pro.h and init.c here: https://github.com/datalightinc/... .

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

Hi Aaron,

Is there an updated link for the edited ASF source code?

I am having the same issues and am wondering if that code could help me out.

Thank you for any help.

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

Last reply is from 4 years ago. If you have AS7 installed you should be able to update ASF from there.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Why is this even in that AVR32 forum at all?

 

edit

 

now moved by moderator

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Wed. May 13, 2020 - 12:19 PM