element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Avnet Boards Forums
  • Products
  • Dev Tools
  • Avnet & Tria Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
Software Application Development standalone SD card SDIO
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Avnet Boards Forums to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 19 replies
  • Subscribers 357 subscribers
  • Views 2929 views
  • Users 0 members are here
Related

standalone SD card SDIO

Former Member
Former Member over 11 years ago

Hello,

I try to use the SD card of the Zedboard via the SDIO port. I use chans FatFs. First I implemented the diskio.c by my own, but then debugging it I found that there is an implementation in an example project, so now I use that one.
It can be found here:
XilinxSDK2014.2dataembeddedswlibsw_servicesxilffs_v2_1


Initialization works partly, but not fully:
.

XSdPs_SdCardInitialize
XSdPs_Change_ClkFreq(&SdInstance, SD_CLK_25_MHZ);
and XSdPs_Select_Card
.

work propperly, but XSdPs_Get_BusWidth does not anymore.
It seems like commands are accepted, but DMA transfers are not:
.
/*
* Send block write command
*/
Status = XSdPs_CmdTransfer(InstancePtr, CMD55,
tttInstancePtr->RelCardAddr, 0);
tif (Status != XST_SUCCESS) {
t....Status = XST_FAILURE;
t....goto RETURN_PATH;
t}

tBlkCnt = XSDPS_SCR_BLKCNT;
tBlkSize = XSDPS_SCR_BLKSIZE;

t/*
t * Set block size to the value passed
t */
tBlkSize &= XSDPS_BLK_SIZE_MASK;
tXSdPs_WriteReg16(InstancePtr->Config.BaseAddress,
tttXSDPS_BLK_SIZE_OFFSET, BlkSize);

tXSdPs_SetupADMA2DescTbl(InstancePtr, BlkCnt, SCR);

tXSdPs_WriteReg16(InstancePtr->Config.BaseAddress,
tttXSDPS_XFER_MODE_OFFSET,
tttXSDPS_TM_DAT_DIR_SEL_MASK | XSDPS_TM_DMA_EN_MASK);

tStatus = XSdPs_CmdTransfer(InstancePtr, ACMD51, 0, BlkCnt);
tif (Status != XST_SUCCESS) {
t....Status = XST_FAILURE;
t....goto RETURN_PATH;
t}
.
SdPs_CmdTransfer(InstancePtr, ACMD51, 0, BlkCnt) returns with 1.
.

Maybe I did something wrong in the hardware design. I added the SD 0 Peripheral and assigned CD to MIO 47, WP to MIO46.
Do I have to activate the DMA somehow?
.
There is one funny fact: when I let the example program run, a file is generated on the SD, but it cannot be neither read nor written by the zynq.
.
Best regards,
Yaro

  • Sign in to reply
  • Cancel
  • Former Member
    0 Former Member over 10 years ago in reply to Former Member

    Hi Yaro123,

    Thanks a lot for sharing your Project. However I am unable to open up the zynq IP as it seems to be one version higher up and i'm still using 2014.2. (There's other concerns that I'll have to deal with if I upgrade).

    Can you answer a couple of questions.

    1) What was the clock frequency provided to the SD card? I understand that this goes through pin E14, however don't really know if it takes FCLK0.

    2) What is the max frequency that I can clock the SD card at with this specific bundle of example application?

    Thanks again for sharing this.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago in reply to Former Member

    Hi Yaro123,

    Thanks a lot for sharing your Project. However I am unable to open up the zynq IP as it seems to be one version higher up and i'm still using 2014.2. (There's other concerns that I'll have to deal with if I upgrade).

    Can you answer a couple of questions.

    1) What was the clock frequency provided to the SD card? I understand that this goes through pin E14, however don't really know if it takes FCLK0.

    2) What is the max frequency that I can clock the SD card at with this specific bundle of example application?

    Thanks again for sharing this.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago in reply to Former Member

    Hi Yaro,

    I realize this is quite some time after your post.

    Can you tell me how I find out what frequency the SD card is clocked at? Unfortunately I cannot open up your project as it is a later version of the IP. Also cannot upgrade for other reasons.

    I'm trying to figure out what is the fastest data rite speed I can get with that example project.

    Omkar

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago in reply to Former Member

    Hi Edh4,

    I have the same problem, I ran the the whole flow with both configurations: selecting SD0 and not selecting. In both I am getting the same error.

    any suggestion is appreciated.

    Mohammad

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago

    You can find a detailed article on using the SD card of the Zedboard (Zynq7000) in standalone software platform on this article: http://embeddedcentric.com/data-logging-using-sd-cards/

    The article also talks about the FatFs APIs, SD card electrical interface, time stamping. Source code and complete Vivado project is included (Vivado Suite 15.2)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago in reply to Former Member

    Hi guys, we are trying to implement a way to read/write to an sd card using vivado system and a Zedboard. We are very noob about the argument. Can you give us an hand (send us some example and basic code) ?
    Thanks in advance for the help

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago

    Hi,

    I'm using Zedboard and I want to use the SD card not as boot.

    The example xilffs_polled_example.c  works good,

    How can I use the f_write function in order to write data from DDR?

    Thanks,
    Danna

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago

    Hi guys.
    I'm using for the first time a FPGA and I need to communicate with a "Pmod SD Card" using a Zedboard Zynq, with Vivado system (Vivado + HLS + SDK).
    My scope is to read/write data just using the Programmable Logic and the SPI protocolo, without the ARM interaction.
    Do you have some similar projects to send me?
    Thank you in advance.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago

    Hey Guys,
    I try to use the ff.h library to write a string of data to the sdcard. For this I used the example given by sdk. The example works fine like it is. But when I try to write a string which size is smaller than 256 byte. Only the file is created, but no data is in it.
    Do you have any idea how I can fix it?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
<
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube