Do not get any data from SD CARD.

Technical discussions related to any XMOS development kit or reference design. Eg XK-1A, sliceKIT, etc.
jems
Member++
Posts: 27
Joined: Tue Jun 25, 2019 1:23 pm

Do not get any data from SD CARD.

Post by jems »

Hello !!
The problem-related to the SD card read/write as per this library suggestion.
https://github.com/xcore/sc_sdcard

Mode for communication which I selected SDCardHostSPI.
I am using xCORE-200 Explorer Kit for this operation. Connection wire as per mentioned in SDCardHostSPI.xc file.
Also, I placed pull up resistor on the MISO pin. It is necessary or not which I am not sure.

MMC card adapter using for the place my SD CARD model number SanDisk Ultra 32GB Class 10.
Also, I resolved all the warning(not necessary) Still I did it.

When I run this program I got the error like,

Failed with rc=3.

I hope any one help to resolve my problem. Thank you.


User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am

Post by mon2 »

Hi. Received your private message.

1) post your full project and full output log from execution.

2) post your wiring diagram. What is the power rail for this sd-card?

3) post a picture of your sd-card

See limited but working reports in the forum for this topic.

Is the sd card formatted? To which format?
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am

Post by mon2 »

XM-009579-AN-2-AN00213_ How to use the SDCard Library.pdf
Hi. The project and code is not supported by XMOS due to the age of the post but see if the attached document helps. I think you have assorted options including the use of a low cost external spi bus sd-card reader, etc. you could mate with the XMOS CPU.
You do not have the required permissions to view the files attached to this post.
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am

Post by mon2 »

I think the best way to approach this is..

1) confirm you can replicate the results in the posted document

2) consider to source the low cost arduino and sd-card hardware setup shown here:

https://create.arduino.cc/projecthub/el ... ata-37f390

3) confirm that the arduino setup works for you. Then tweak the XMOS code to do the same.

4) a low cost spi bus sniffer from eBay , Amazon, etc. will be helpful here to confirm you can send and receive over the spi bus.
jems
Member++
Posts: 27
Joined: Tue Jun 25, 2019 1:23 pm

Post by jems »

Onces again thanks for reply me.
I am using stable version of 1.0.1 and my connection should be liked,

// Structure for the ports to access the SD Card
C M S M
s o c I
s l s
i k o
__________________
/ | | | | | | | | |
|| C D - + C - D |
| S I G 3 L G O |
| N . K N |
| D 3 D |
| V |
*/
static SDHostInterface SDif[] = /* LIST HERE THE PORTS USED FOR THE INTERFACES
cs, sclk, Mosi, miso */
{{XS1_CLKBLK_1, XS1_CLKBLK_2, XS1_PORT_1L, XS1_PORT_1I, XS1_PORT_1K, XS1_PORT_1J, 0, 0}}; // resources used for interface #0

So, I directly connect sd card to xmos pins no other hardware I am using for interface. Even I checked my sd card in arduino for interfacing.
Also, I am using the 14.0.1 xmos software for build this program.
As per pdf, XMOS SDCARD library - Version 1.3.0 required if possible then share my folder because I tried to find but I couldn't get it.
I hope you really help me.
Thank you.
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am

Post by mon2 »

Zip up your full project and post here for a review.

If you wish, you can use a cloud service like wetransfer and then post the url.

Post your makefile.

What is the value of SD_SPI_ENABLE?

It should be SD_SPI_ENABLE=1 in the makefile so that SPI mode (1 bit ports) is selected.
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am

Post by mon2 »

Also...from the github source code:

Code: Select all

typedef enum {
        RES_OK = 0,             /* 0: Successful */
        RES_ERROR,              /* 1: R/W Error */
        RES_WRPRT,              /* 2: Write Protected */
        RES_NOTRDY,             /* 3: Not Ready */
        RES_PARERR              /* 4: Invalid Parameter */
} DRESULT;
So rc=3 means, Not Ready.

Check your wiring. Check your voltage to the sd card.

Do you have a multimeter or scope or logic analyzer tool?

Use them to confirm that your spi port pins are actually working when you run this code.
Gvsdavr
New User
Posts: 2
Joined: Tue Dec 22, 2020 8:55 am

Post by Gvsdavr »

SD card? Are not all mobile hard drives now? I haven't used the SD card for a long time, and there is no portable hard drive.
jems
Member++
Posts: 27
Joined: Tue Jun 25, 2019 1:23 pm

Post by jems »

As per this link, I tried to get data through SD card still I do not get it.

https://tuck1s.blogspot.com/2015/08/xmo ... to-sd.html

My memory card should be this one,
mc80073.jpg
I am using Sandisk Adapter,
71DDK-mxfUL._SL1028_.jpg
Pin1 (CS ) ----> P1L
Pin2 (MOSI[DI]) ---> P1K
Pin3 (GND) ---> GND
Pin4 (3V) ---> 3V3
Pin5 (CLK) ---> P1I
Pin6 (GND) ---> GND
Pin7 (MISO[DO]) ---> P1J
Pin8 (NC) --->NC
Pin9 (NC) --->NC

I tried to place 10k pull up on pin2[MOSI] and pin7[MISO]. Still do not get any response.

I tested the same thing Arduino sd card module it works well.

In SDCardHostSPI.xc,

static SDHostInterface SDif[] = // LIST HERE THE PORTS USED FOR THE INTERFACES
// cs, sclk, Mosi, miso
{{XS1_CLKBLK_1, XS1_CLKBLK_2, XS1_PORT_1L, XS1_PORT_1I, XS1_PORT_1K, XS1_PORT_1J, 0, 0}}; // resources used for interface #0

changed as per defined output.

I hope anyone help me getting out this problem.
You do not have the required permissions to view the files attached to this post.
Last edited by jems on Fri Jan 08, 2021 6:07 am, edited 2 times in total.
jems
Member++
Posts: 27
Joined: Tue Jun 25, 2019 1:23 pm

Post by jems »

here the link for my code.

https://we.tl/t-18MXkYfgEo