writing a text file into sd card

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
GiSa_4520796
Level 4
Level 4
First like received

I have created one text file (.txt) and now i want it to integrate(path of file) in fx3 main code where should i include that path in code so that that text file should be written into sd card can anyone help me to do this.

0 Likes
1 Solution

Hi Srujana,

It's not like creating an array and writing data into it.

The process mostly is related to the host application.

You will have to write your own host application which should be able to do the following:

1.) Access the firmware to find the path of the file that is integrated into the firmware.

2,) Access the MSC drivers.

3.) Read and access the file location using Windows API's.

4.) Write that file to the SD card using SCSI commands via the MSC driver.

The host application should be able to perform the above steps and transfer data across PC and SD card via the MSC driver.

Please refer the Mass Storage Spec for get an insight on the API and function calls that can be used to implement.


Regards,

Yashwant

View solution in original post

0 Likes
11 Replies
YashwantK_46
Moderator
Moderator
Moderator
100 solutions authored 50 solutions authored 50 likes received

Hi,

Can you please tell which firmware you are using to program the FX3?


Also, does this text file need to be written to the SD card when you send a vendor command or is there a specific way in which you plan on implementing the wriiting the file part?

Regards,

Yashwant

Hi Yashwant,Thank you for responding my question.

I am using EZ USB SUITE and i want this text file need to be written to the SD card wihout sending a vendor command.I should be able to read that text file when i insert that SD card in mobile phone or tablet.

Hi,

Firstly, you can't use a SD card with FX3, you will have to go with EZ-USB® FX3S SuperSpeed USB Controller.

Also, can i get to know the exact use case that you intend to implement?

Is it like you will integrate the test file in the firmware and then write it to the SD card, remove it from the controller board and then place it in another device ( phone / tablet ) and then read the contents of the card?

Or is there any other process or step involved other than the one stated above?

Also, if your application matches the above use case, you can go through the msc_example in the EZ-USB suite from the path: C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\msc_examples\cyfx3s_msc

Kindly go through the firmware also and ask if you have any queries.


Regards,
Yashwant

Hi,

Yes i want to integrate the test file in the firmware and then write it to the SD card, remove it from the controller and then place it in another device and read contents of SD card.For that i was confused to add which part of the code in FX3S final code.can you please help me to solve this issue.

Thank you.

0 Likes

Hi,


Can you please tell the file system that will be used in both the cases?

What will be the file system in the host side and what file system would exist on the device side( when you will remove the SD card from the controller and place it in another device)?

Also, what is the maximum size of the test file that you want to write to the SD card?

Regards,
Yashwant

lock attach
Attachments are accessible only for community members.

Hi,

I should be able to read the sd card in mobile without using file system .Can you please explain the method i should follow to read the SD Card.Present i am trying to write 256 bytes of data into SD Card.If we use file system how to use it in our project?

i attached the code below where should i include the path of that file,please correct me.

Regards,

Srujana.

0 Likes

Hello Srujana,

There's no provision for adding a path of a file into the firmware of FX3 or FX3S till now.

The only way that you can kind of implement this is by creating a array and then writing it into the SD card and then you can try and read it in any other device.

I went through the firmware and found that you have modified the DMA channel to work between P-port and SIB block. But how do you plan on getting the data to the P-Port of FX3 from the host?


Regards,

Yashwant

0 Likes

Hi,

I didn't get this point---->The only way that you can kind of implement this is by creating a array and then writing it into the SD card.

For example, I want to write 512 bytes of data into SD Card how to create an array for this so that i can test it in firmware and read the contents in mobile.

Regards,

Srujana.

0 Likes

Hi Srujana,

It's not like creating an array and writing data into it.

The process mostly is related to the host application.

You will have to write your own host application which should be able to do the following:

1.) Access the firmware to find the path of the file that is integrated into the firmware.

2,) Access the MSC drivers.

3.) Read and access the file location using Windows API's.

4.) Write that file to the SD card using SCSI commands via the MSC driver.

The host application should be able to perform the above steps and transfer data across PC and SD card via the MSC driver.

Please refer the Mass Storage Spec for get an insight on the API and function calls that can be used to implement.


Regards,

Yashwant

0 Likes

Hi,

I am new to this FX3S SDK and i dont know how to create host application like what you suggested me.Can you please give me brief explanation to create Host Application.

Regards,

Srujana.

0 Likes

Hi,

I am waiting for your reply.

Regards,

Srujana.

0 Likes