Jump to content
  • 0

zybo/zedboard standalone USB mass storage example


andrew M

Question

I am using a ZYBO development board and I am trying to create a standalone application that writes something on an USB Mass Storage Device that is connected to it.

My problem is with the drivers provided by the guys from xilinx. I am using their example from the folder usbps_v1_05_a/examples/ but it seams to do just....nothing.

My problem is that I can't manage to figure it out how to write a file on the USB.

Does someone have an example of any kind (an example for the sd card would also be great...)?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Hello Andrew,

We don't have any such examples. We do test SD and USB in our manufacturing tests, but it does not go as far as knowing anything about files. For both SD and USB Mass-storage you will need file system support. FatFs is a good open-source example. The lower-level drivers are the ones provided by Xilinx and we use them ourselves. For example, reading the first data block on an SD is as simple as:

#include "sdps.h"

    /// Initialize the read buffer
    memset(arrbyReadBuff, 0, kwBlockSizeBytes);

    /// Initialize SDIO controller
    psSdConfig = XSdPs_LookupConfig(XPAR_PS7_SD_0_DEVICE_ID);
    if (XSdPs_CfgInitialize(&sSdPs, psSdConfig, psSdConfig->BaseAddress) !=
            XST_SUCCESS)
    {
        VERBOSE("%s (line %d) error", __func__, __LINE__);
        FAIL_AND_RETURN;
    }

    /// Initialize SD card
    if (XSdPs_CardInitialize(&sSdPs) != XST_SUCCESS)
    {
        VERBOSE("%s (line %d) error", __func__, __LINE__);
        FAIL_AND_RETURN;
    }

    /// Change bus width to 4-bit
    if (XSdPs_Change_BusWidth(&sSdPs) != XST_SUCCESS)
    {
        VERBOSE("%s (line %d) error", __func__, __LINE__);
        FAIL_AND_RETURN;
    }

    /// Issue a read of the first block (boot block)
    XSdPs_ReadPolled(&sSdPs, 0, 1, arrbyReadBuff);

 

 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...